Control: tag -1 patch

Hi!

On Wed, 2024-03-13 at 12:51:07 +0100, Lucas Nussbaum wrote:
> Source: gravitywars
> Version: 1.102-35
> Severity: serious
> Justification: FTBFS
> Tags: trixie sid ftbfs
> User: lu...@debian.org
> Usertags: ftbfs-20240313 ftbfs-trixie ftbfs-impfuncdef

> During a rebuild of all packages in sid, your package failed to build
> on amd64.
> 
> This is most likely caused by a change in dpkg 1.22.6, that enabled
> -Werror=implicit-function-declaration. For more information, see
> https://wiki.debian.org/qa.debian.org/FTBFS#A2024-03-13_-Werror.3Dimplicit-function-declaration
> 
> Relevant part (hopefully):
> > cc -g -O2 -Werror=implicit-function-declaration 
> > -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong 
> > -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection 
> > -DUSE_SDL -DUSE_JOYSTICK `pkg-config sdl --cflags` -Wdate-time 
> > -D_FORTIFY_SOURCE=2  -c -o blocks.o blocks.c
> > misc.c: In function ‘waitanykey’:
> > misc.c:6:9: error: implicit declaration of function ‘keyboard_update’ 
> > [-Werror=implicit-function-declaration]
> >     6 |   while(keyboard_update())
> >       |         ^~~~~~~~~~~~~~~
> > misc.c:7:5: error: implicit declaration of function ‘vga_waitretrace’ 
> > [-Werror=implicit-function-declaration]
> >     7 |     vga_waitretrace();
> >       |     ^~~~~~~~~~~~~~~
> > misc.c: In function ‘doPanic’:
> > misc.c:18:3: error: implicit declaration of function ‘printf’ 
> > [-Werror=implicit-function-declaration]
> >    18 |   printf("------------------------------\n"
> >       |   ^~~~~~
> > misc.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
> >   +++ |+#include <stdio.h>
> >     1 | /* GravityWars 1.1,  (C) Sami Niemi -95 */
> > misc.c:18:3: warning: incompatible implicit declaration of built-in 
> > function ‘printf’ [-Wbuiltin-declaration-mismatch]
> >    18 |   printf("------------------------------\n"
> >       |   ^~~~~~
> > misc.c:18:3: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
> > misc.c:21:3: error: implicit declaration of function ‘keyboard_close’ 
> > [-Werror=implicit-function-declaration]
> >    21 |   keyboard_close();
> >       |   ^~~~~~~~~~~~~~
> > misc.c:22:3: error: implicit declaration of function ‘mouse_close’ 
> > [-Werror=implicit-function-declaration]
> >    22 |   mouse_close();
> >       |   ^~~~~~~~~~~
> > misc.c:23:3: error: implicit declaration of function ‘exit’ 
> > [-Werror=implicit-function-declaration]
> >    23 |   exit(1);
> >       |   ^~~~
> > misc.c:1:1: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
> >   +++ |+#include <stdlib.h>
> >     1 | /* GravityWars 1.1,  (C) Sami Niemi -95 */
> > misc.c:23:3: warning: incompatible implicit declaration of built-in 
> > function ‘exit’ [-Wbuiltin-declaration-mismatch]
> >    23 |   exit(1);
> >       |   ^~~~
> > misc.c:23:3: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
> > hole.c: In function ‘OLDmakehole’:
> > hole.c:30:3: error: implicit declaration of function ‘vga_setpage’ 
> > [-Werror=implicit-function-declaration]
> >    30 |   vga_setpage(page);
> >       |   ^~~~~~~~~~~
> > hole.c: In function ‘makehole’:
> > hole.c:68:3: error: implicit declaration of function ‘getbox’ 
> > [-Werror=implicit-function-declaration]
> >    68 |   getbox(x,y,tmpmix);
> >       |   ^~~~~~
> > hole.c:80:3: error: implicit declaration of function ‘changeblocks’ 
> > [-Werror=implicit-function-declaration]
> >    80 |   changeblocks(x,y,tmpmix);
> >       |   ^~~~~~~~~~~~
> > pixel.c: In function ‘setpixel’:
> > pixel.c:11:3: error: implicit declaration of function ‘vga_setpage’ 
> > [-Werror=implicit-function-declaration]
> >    11 |   vga_setpage(adr >> 16);
> >       |   ^~~~~~~~~~~
> > bullet.c: In function ‘setbullet’:
> > bullet.c:17:3: error: implicit declaration of function ‘vga_setpage’ 
> > [-Werror=implicit-function-declaration]
> >    17 |   vga_setpage(page);
> >       |   ^~~~~~~~~~~
> > cc1: some warnings being treated as errors
> > make[2]: *** [<builtin>: misc.o] Error 1

The attached debdiff patch should fix this.

I pondered creating a single header and including all declarations
there to have a smaller delta, but decided to follow the existing
pattern in the project. If you'd prefer to see a single header,
instead of all new headers, I'm happy to rework the patch.

Thanks,
Guillem
diff -Nru gravitywars-1.102/debian/patches/implicit-decls.patch gravitywars-1.102/debian/patches/implicit-decls.patch
--- gravitywars-1.102/debian/patches/implicit-decls.patch	1970-01-01 01:00:00.000000000 +0100
+++ gravitywars-1.102/debian/patches/implicit-decls.patch	2024-05-03 18:57:53.000000000 +0200
@@ -0,0 +1,412 @@
+Description: Add function declarations
+ With the compiler setting -Werror=implicit-function-declaration by default,
+ we need to properly declare all functions in the relevant headers.
+ .
+ Create one header per C file to match the existing code patterns, even
+ though those where very partially implemented.
+Author: Guillem Jover <guil...@hadrons.org>
+Origin: vendor
+Forwarded: no
+
+---
+ GravityWars101.c |    8 ++++++++
+ animate.c        |    4 ++++
+ animate.h        |    7 +++++++
+ blocks.c         |    2 ++
+ blocks.h         |   14 ++++++++++++++
+ bullet.c         |    1 +
+ bullet.h         |    7 +++++++
+ config.h         |    5 ++++-
+ control.c        |    9 +++++++++
+ control.h        |    6 ++++++
+ hole.c           |    2 ++
+ hole.h           |    6 ++++++
+ init.c           |    2 ++
+ init.h           |   11 +++++++++++
+ introutro.c      |    4 ++++
+ introutro.h      |    7 +++++++
+ macros.h         |    6 ++++++
+ makepic.c        |    3 +++
+ makepic.h        |    6 ++++++
+ misc.c           |    5 +++++
+ misc.h           |    7 +++++++
+ moveship.c       |    8 ++++++++
+ moveship.h       |    6 ++++++
+ pixel.c          |    1 +
+ score.c          |    2 ++
+ score.h          |   11 +++++++++++
+ scroll.c         |    3 +++
+ scroll.h         |    7 +++++++
+ vgastubs.h       |    1 +
+ water.h          |    6 ++++++
+ 30 files changed, 166 insertions(+), 1 deletion(-)
+
+--- a/misc.c
++++ b/misc.c
+@@ -1,5 +1,10 @@
+ /* GravityWars 1.1,  (C) Sami Niemi -95 */
+ 
++#include <stdio.h>
++#include <stdlib.h>
++#include "misc.h"
++#include "vgastubs.h"
++
+ /* Wait Any Key */
+ void waitanykey() {
+ 
+--- a/blocks.c
++++ b/blocks.c
+@@ -1,6 +1,8 @@
+ /* GravityWars 1.1,  (C) Sami Niemi -95 */
+ 
+ #include "memory.h"
++#include "blocks.h"
++#include "vgastubs.h"
+  
+ /*-------------------------------------------------------------------putbox */
+ /* Put a 32*32 linear box into an unlinear 65536 block address space        */
+--- a/hole.c
++++ b/hole.c
+@@ -1,6 +1,8 @@
+ /* GravityWars 1.1,  (C) Sami Niemi -95 */
+ 
+ #include "memory.h"
++#include "blocks.h"
++#include "vgastubs.h"
+ 
+ /*-----------------------------------------------------------------setbullet */
+ /* I think this one made holes just in the screen. Not in the virtual
+--- a/pixel.c
++++ b/pixel.c
+@@ -1,6 +1,7 @@
+ /* GravityWars 1.1,  (C) Sami Niemi -95 */
+ 
+ #include "memory.h"
++#include "vgastubs.h"
+  
+ /*-----------------------------------------------------------------setpixel */
+ void setpixel(int x, int y, uchar c) {
+--- a/introutro.c
++++ b/introutro.c
+@@ -7,8 +7,12 @@
+ #include <vga.h>
+ #include <asm/io.h>
+ #endif
++#include <stdio.h>
+ #include <math.h>
++#include <unistd.h>
+ #include "memory.h"
++#include "blocks.h"
++#include "misc.h"
+  
+ void intro() {
+ 
+--- a/score.c
++++ b/score.c
+@@ -1,6 +1,8 @@
+ /* GravityWars 1.1,  (C) Sami Niemi -95 */
+ 
+ #include "memory.h"
++#include "vgastubs.h"
++#include "score.h"
+ 
+ /* Level code letters */
+ void putletter(short adr, short num) {   /* adr=x+(y<<8) */
+--- /dev/null
++++ b/blocks.h
+@@ -0,0 +1,14 @@
++#ifndef BLOCKS_H
++#define BLOCKS_H
++
++#include "config.h"
++
++void putbox(int x, int y, uchar *dp);
++void getbox(int orx, int ory, uchar *out);
++void changeblocks(int orx, int ory, uchar *out);
++void getbox2(int x, int y, uchar *dp);
++void putstamp(short x, short y, short a, short b, short c);
++void killstamp(short x, short y);
++void stampnum(short num);
++
++#endif
+--- a/bullet.c
++++ b/bullet.c
+@@ -1,6 +1,7 @@
+ /* GravityWars 1.1,  (C) Sami Niemi -95 */
+ 
+ #include "memory.h"
++#include "vgastubs.h"
+  
+ /*-----------------------------------------------------------------setbullet */
+ void setbullet(int x, int y,int num) {
+--- a/config.h
++++ b/config.h
+@@ -1,5 +1,8 @@
+ /* GravityWars 1.1,  (C) Sami Niemi -95 */
+ 
++#ifndef CONFIG_H
++#define CONFIG_H
++
+ /*------------------ TESTING OPTIONS ------------------------*/
+ #define SCORE 
+ #define ANIM
+@@ -85,4 +88,4 @@
+ #define  uchar unsigned char
+   
+ 
+-
++#endif
+--- a/GravityWars101.c
++++ b/GravityWars101.c
+@@ -44,6 +44,14 @@
+ #include <unistd.h>
+ #include "includes.h"
+ #include "memory.h"
++#include "blocks.h"
++#include "control.h"
++#include "init.h"
++#include "introutro.h"
++#include "makepic.h"
++#include "misc.h"
++#include "moveship.h"
++#include "score.h"
+ 
+ #if defined (USE_SDL) && defined (USE_JOYSTICK)
+ #include <stdlib.h>
+--- a/animate.c
++++ b/animate.c
+@@ -1,6 +1,10 @@
+ /* GravityWars 1.1,  (C) Sami Niemi -95 */
+ 
+ #include "memory.h"
++#include "blocks.h"
++#include "vgastubs.h"
++#include "animate.h"
++#include "score.h"
+  
+ /*------------------------------------------------------------------ animate */
+ void animate() {
+--- /dev/null
++++ b/animate.h
+@@ -0,0 +1,7 @@
++#ifndef ANIMATE_H
++#define ANIMATE_H
++
++void animate();
++void AnimateAll();
++
++#endif
+--- a/control.c
++++ b/control.c
+@@ -5,7 +5,16 @@
+ #else
+ #include <vgakeyboard.h>
+ #endif
++#include <unistd.h>
++#include "macros.h"
+ #include "memory.h"
++#include "blocks.h"
++#include "bullet.h"
++#include "hole.h"
++#include "misc.h"
++#include "moveship.h"
++#include "score.h"
++#include "scroll.h"
+ 
+  
+ /*------------------------------------------------------------------ control */
+--- a/init.c
++++ b/init.c
+@@ -10,6 +10,8 @@
+ #endif
+ #include <math.h>
+ #include "memory.h"
++#include "misc.h"
++#include "introutro.h"
+ 
+ /*--------------------------------------------------------------- initScreen */
+ int initScreen() {
+--- /dev/null
++++ b/introutro.h
+@@ -0,0 +1,7 @@
++#ifndef INTROUTRO_H
++#define INTROUTRO_H
++
++void intro();
++void outro();
++
++#endif
+--- a/macros.h
++++ b/macros.h
+@@ -1,5 +1,8 @@
+ /* GravityWars 1.1,  (C) Sami Niemi -95 */
+ 
++#ifndef MACROS_H
++#define MACROS_H
++
+ /*--------------------------------------------------------------------- beep */
+ #ifndef NOSOUND
+    #define beep(time) ioctl(1,KDMKTONE, 3276800+time);
+@@ -7,4 +10,7 @@
+    #define beep(time) 
+ #endif
+ 
++void the_end();
++void explode();
+ 
++#endif
+--- a/makepic.c
++++ b/makepic.c
+@@ -1,6 +1,9 @@
+ /* GravityWars 1.1,  (C) Sami Niemi -95 */
+ 
+ #include "memory.h"
++#include "blocks.h"
++#include "vgastubs.h"
++#include "makepic.h"
+  
+ /*---------------------------------------------------------- drawSplitScreen */
+ void drawSplitScreen() {
+--- /dev/null
++++ b/misc.h
+@@ -0,0 +1,7 @@
++#ifndef MISC_H
++#define MISC_H
++
++void waitanykey();
++void doPanic();
++
++#endif
+--- a/moveship.c
++++ b/moveship.c
+@@ -7,7 +7,15 @@
+ #endif
+ #include <string.h>
+ #include "memory.h"
++#include "blocks.h"
+ #include "macros.h"
++#include "vgastubs.h"
++#include "animate.h"
++#include "init.h"
++#include "makepic.h"
++#include "score.h"
++#include "scroll.h"
++#include "water.h"
+ 
+ 
+ /*----------------------------------------------------------------- moveShip */
+--- /dev/null
++++ b/score.h
+@@ -0,0 +1,11 @@
++#ifndef SCORE_H
++#define SCORE_H
++
++void putscore(int nr, short y);
++void putscoreOnly(int nr, short y);
++void killscore(int nr, short y, short newy);
++void updatescore();
++void putdigit(short adr, short num);
++void putletter(short adr, short num);
++
++#endif
+--- a/scroll.c
++++ b/scroll.c
+@@ -1,6 +1,9 @@
+ /* GravityWars 1.1,  (C) Sami Niemi -95 */
+ 
+ #include "memory.h"
++#include "animate.h"
++#include "vgastubs.h"
++#include "score.h"
+  
+ /*--------------------------------------------------------------- centerShip */
+ /* Centers the scrolling picture in Y direction */
+--- /dev/null
++++ b/scroll.h
+@@ -0,0 +1,7 @@
++#ifndef SCROLL_H
++#define SCROLL_H
++
++void scrollY(short nr, short y1, short y2);
++void centerShip(short nr);
++
++#endif
+--- a/vgastubs.h
++++ b/vgastubs.h
+@@ -25,6 +25,7 @@ typedef void vga_modeinfo;
+ int vga_init(void);
+ int vga_setmode(int mode);
+ void vga_setsplitline(int sl);
++void vga_waitretrace(void);
+ int vga_claimvideomemory(int m);
+ unsigned char *vga_getgraphmem(void);
+ void vga_setpage(int page);
+--- /dev/null
++++ b/water.h
+@@ -0,0 +1,6 @@
++#ifndef WATER_H
++#define WATER_H
++
++void watermask(short x, short y, uchar type, char *back_adr);
++
++#endif
+--- /dev/null
++++ b/init.h
+@@ -0,0 +1,11 @@
++#ifndef INIT_H
++#define INIT_H
++
++int initScreen();
++void initParams();
++void readquotes(char *dest);
++void loaddata();
++int loadGfx();
++int rotGfx();
++
++#endif
+--- /dev/null
++++ b/makepic.h
+@@ -0,0 +1,6 @@
++#ifndef MAKEPIC_H
++#define MAKEPIC_H
++
++int drawScreen();
++
++#endif
+--- /dev/null
++++ b/moveship.h
+@@ -0,0 +1,6 @@
++#ifndef MOVESHIP_H
++#define MOVESHIP_H
++
++int moveShip(short nr, unsigned char flag);
++
++#endif
+--- /dev/null
++++ b/bullet.h
+@@ -0,0 +1,7 @@
++#ifndef BULLET_H
++#define BULLET_H
++
++void setbullet(int x, int y,int num);
++void killbullet(int x, int y,int num);
++
++#endif
+--- /dev/null
++++ b/control.h
+@@ -0,0 +1,6 @@
++#ifndef CONTROL_H
++#define CONTROL_H
++
++void control(short nr);
++
++#endif
+--- /dev/null
++++ b/hole.h
+@@ -0,0 +1,6 @@
++#ifndef HOLE_H
++#define HOLE_H
++
++void makehole(int x, int y, int type);
++
++#endif
diff -Nru gravitywars-1.102/debian/patches/series gravitywars-1.102/debian/patches/series
--- gravitywars-1.102/debian/patches/series	2021-02-03 02:09:11.000000000 +0100
+++ gravitywars-1.102/debian/patches/series	2024-05-03 14:37:34.000000000 +0200
@@ -11,3 +11,4 @@
 040_hardening.patch
 buildflags.patch
 spelling.patch
+implicit-decls.patch

Reply via email to