Control: tags 1074798 + patch
Control: tags 1074798 + pending

Dear maintainer,

I've prepared an NMU for a56 (versioned as 1.3+dfsg-10.2) and
uploaded it to DELAYED/10. Please feel free to tell me if I
should delay it longer.

These changes are also available on the "build-clean" branch of
<https://salsa.debian.org/benh/a56.git>.

Ben.

-- 
Ben Hutchings
Computers are not intelligent.  They only think they are.
diff -Nru a56-1.3+dfsg/debian/a56-tobin.c a56-1.3+dfsg/debian/a56-tobin.c
--- a56-1.3+dfsg/debian/a56-tobin.c	2024-01-13 23:00:00.000000000 +0100
+++ a56-1.3+dfsg/debian/a56-tobin.c	2024-07-27 02:42:12.000000000 +0200
@@ -21,6 +21,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/types.h>
+#include <err.h>
 
 int
 main (int argc, char *argv[])
@@ -58,7 +59,8 @@
       if (offset > 0x7000)
         offset = prev_offset + 1;
       
-      pwrite (fd, value, 3, (off_t) (offset * 3));
+      if (pwrite (fd, value, 3, (off_t) (offset * 3)) < 0)
+	err (1, "Failed to write %s", argv[1]);
 
       prev_offset = offset;
     }
diff -Nru a56-1.3+dfsg/debian/changelog a56-1.3+dfsg/debian/changelog
--- a56-1.3+dfsg/debian/changelog	2024-03-16 21:29:00.000000000 +0100
+++ a56-1.3+dfsg/debian/changelog	2024-07-27 02:42:48.000000000 +0200
@@ -1,3 +1,21 @@
+a56 (1.3+dfsg-10.2) unstable; urgency=medium
+
+  * Non-maintainer upload
+  * Update patches to fix new errors in gcc-14 (Closes: #1074798):
+    - Drop "non-void should return a value bug in main." (clang-ftbfs.diff)
+      as the affected function should actually return void
+    - Replace the many partial function declaration patches with a single
+      patch that fixes all missing prototypes and K&R style definitions
+  * Drop "Replace undeclared fatal" (replace-undecl-fatal.patch), as
+    fatal() is now declared
+  * Add format attributes to allow type checks on *printf() wrappers
+  * Enable most compiler warnings (-Wall -Wextra with some overrides)
+  * Fix remaining warnings in upstream code with gcc-14
+  * a56-tobin: Check for errors from pwrite()
+  * Add debian/.gitgnore file to make 'git add debian' safer
+
+ -- Ben Hutchings <b...@debian.org>  Sat, 27 Jul 2024 02:42:48 +0200
+
 a56 (1.3+dfsg-10.1) unstable; urgency=medium
 
   * Non-maintainer upload.
diff -Nru a56-1.3+dfsg/debian/patches/ansi-c.patch a56-1.3+dfsg/debian/patches/ansi-c.patch
--- a56-1.3+dfsg/debian/patches/ansi-c.patch	2024-03-16 21:29:00.000000000 +0100
+++ a56-1.3+dfsg/debian/patches/ansi-c.patch	2024-07-27 02:32:30.000000000 +0200
@@ -3,8 +3,6 @@
 Date: Fri, 17 May 2013 10:46:34 +0200
 Subject: More code cleanup and converstion to ANSI C.
 ---
-diff --git a/frac2int.c b/frac2int.c
-index 8f01796..a045a70 100644
 --- a/frac2int.c
 +++ b/frac2int.c
 @@ -98,21 +98,26 @@
@@ -12,81 +10,44 @@
  \******************************************************************/
  
 -main()
--{
--           double fractnum;              /* double precision floating pt */
--           long   hexval;                /* long integer */
--
--    for(;;) {
--        /* Read 1 Decimal Floating Point Number from the Keyboard */
--           printf("Enter the decimal fraction: ");
--           scanf("%lf", &fractnum);
 +#include <stdio.h>
 +#include <stdlib.h>
- 
--        /* Convert to a Hex Integer which can be used by the DSP56200 */
--           hexval =  (long) (8388608.0 * fractnum);
--           hexval =  0x00ffffffL & hexval;
--
--        /* Write the Hex number out to the Terminal */
--           printf("DSP56200 Coefficient = %06lx\n", hexval);
--    }
++
 +int
 +main(void)
-+{
+ {
+-           double fractnum;              /* double precision floating pt */
+-           long   hexval;                /* long integer */
 +	double fractnum;              /* double precision floating pt */
 +	long   hexval;                /* long integer */
-+
+ 
+-    for(;;) {
+-        /* Read 1 Decimal Floating Point Number from the Keyboard */
+-           printf("Enter the decimal fraction: ");
+-           scanf("%lf", &fractnum);
 +	for(;;) {
 +		/* Read 1 Decimal Floating Point Number from the Keyboard */
 +		printf("Enter the decimal fraction: ");
 +		scanf("%lf", &fractnum);
-+
+ 
+-        /* Convert to a Hex Integer which can be used by the DSP56200 */
+-           hexval =  (long) (8388608.0 * fractnum);
+-           hexval =  0x00ffffffL & hexval;
 +		/* Convert to a Hex Integer which can be used by the DSP56200 */
 +		hexval =  (long) (8388608.0 * fractnum);
 +		hexval =  0x00ffffffL & hexval;
-+
+ 
+-        /* Write the Hex number out to the Terminal */
+-           printf("DSP56200 Coefficient = %06lx\n", hexval);
+-    }
 +		/* Write the Hex number out to the Terminal */
 +		printf("DSP56200 Coefficient = %06lx\n", hexval);
 +	}
 +	return(EXIT_SUCCESS);
  }
-diff --git a/main.c b/main.c
-index 06f6dc4..9d2aacf 100644
 --- a/main.c
 +++ b/main.c
-@@ -21,6 +21,7 @@
-  */
- #include <unistd.h>
- #include <stdbool.h>
-+#include <string.h>
- 
- static char *Copyright = "Copyright (C) 1990-1994 Quinn C. Jensen";
- 
-@@ -45,11 +46,12 @@ BOOL list_on_next = TRUE;
- 
- 
-+void dump_symtab();
- void summarize(struct psect *);
- 
- 
- void psect_summary();
- void reset_psects();
- 
- int
- main(int argc, char *argv[])
- {
-@@ -107,8 +111,8 @@ struct inc inc[MAX_NEST];
- int inc_p = 0;
- FILE *yyin;
- 
--include(file)
--char *file;
-+void
-+include(char *file)
- {
- 	FILE *fp = open_read(file);
- 
-@@ -205,7 +209,7 @@ sym_def(char *sym, int type, int seg, int i, double f)
+@@ -205,7 +205,7 @@ void sym_def(char *sym, int type, int se
  			sp->n.val.f = f;
  	} else {
  		sp = find_sym(sym);
@@ -95,36 +56,6 @@
  			fatal("internal error 304\n");
  		if(sp->n.type != type ||
  			type == INT && sp->n.val.i != (i & 0xFFFFFF) ||
-@@ -214,8 +218,8 @@ sym_def(char *sym, int type, int seg, int i, double f)
- 	}		
- }
- 
--struct sym *find_sym(sym)
--char *sym;
-+struct sym *
-+find_sym(char *sym)
- {
- 	struct sym *sp, **stop;
- 
-@@ -228,6 +232,8 @@ char *sym;
- }
- 
- extern char segs[];
-+
-+void
- dump_symtab()
- {
- 	struct sym *sp, **stop;
-@@ -339,6 +345,7 @@ char *s;
- 
- #define ONE 0x4000000
- 
-+int
- makefrac(char *s)
- {
- 	int frac = 0, div = 1;
-diff --git a/torom.c b/torom.c
-index afb79c2..cf19d5b 100644
 --- a/torom.c
 +++ b/torom.c
 @@ -5,7 +5,7 @@
@@ -136,7 +67,7 @@
  
  /*
   * Copyright (C) 1990-1994 Quinn C. Jensen
-@@ -27,12 +27,14 @@ static char *Copyright = "Copyright (C) 1990-1994 Quinn C. Jensen";
+@@ -27,12 +27,14 @@ static char *Copyright = "Copyright (C)
   *
   */
  
diff -Nru a56-1.3+dfsg/debian/patches/clang-ftbfs.diff a56-1.3+dfsg/debian/patches/clang-ftbfs.diff
--- a56-1.3+dfsg/debian/patches/clang-ftbfs.diff	2024-01-13 23:00:00.000000000 +0100
+++ a56-1.3+dfsg/debian/patches/clang-ftbfs.diff	1970-01-01 01:00:00.000000000 +0100
@@ -1,23 +0,0 @@
-Author: Arthur Marble <art...@info9.net>
-Description: non-void should return a value bug in main.c
-Forwarded: not-needed as there is no upstream anymore
---- a/main.c
-+++ b/main.c
-@@ -185,7 +185,7 @@ double f;
- 			pass = 2;				/* what a kludge */
- 			yyerror("%s: multiply defined symbol", sym);
- 			pass = 1;
--			return;
-+			return 1;
- 		}
- 		stop = &symtab[HASH(sym)];
- 		sp = NEW(struct sym);
-@@ -395,7 +395,7 @@ struct psect *pp;
- 	int used, avail, of;
- 
- 	if(pp == NULL)
--		return;
-+		return 1;
- 
- 	used = pp->pc - pp->bottom;
- 	avail = pp->top - pp->pc;
diff -Nru a56-1.3+dfsg/debian/patches/clang.patch a56-1.3+dfsg/debian/patches/clang.patch
--- a56-1.3+dfsg/debian/patches/clang.patch	2024-03-16 21:29:00.000000000 +0100
+++ a56-1.3+dfsg/debian/patches/clang.patch	1970-01-01 01:00:00.000000000 +0100
@@ -1,38 +0,0 @@
-Origin: https://github.com/rkujawa/a56/commit/b2a3a9ca8c88bc9b0fec947ad4bdd2a4ceb4acfd
-From: =?UTF-8?q?Rados=C5=82aw=20Kujawa?= <radoslaw.kuj...@c0ff33.net>
-Date: Mon, 6 May 2013 00:46:45 +0200
-Subject: Make this compile with modern compiler (tested with clang).
----
-diff --git a/main.c b/main.c
-index e85f8a1..611d4eb 100644
---- a/main.c
-+++ b/main.c
-@@ -41,5 +41,9 @@ extern BOOL list_on;
- BOOL list_on_next = TRUE;
- 
-+void
-+summarize(struct psect *);
-+
-+int
- main(argc,argv)
- int argc;
- char *argv[];
-@@ -172,6 +176,7 @@ char *sym;
- 
- struct sym *symtab[HASHSIZE];
- 
-+void
- sym_def(sym, type, seg, i, f)
- char *sym;
- int type;
-@@ -390,8 +395,8 @@ SSSSSSSSSSSSSSSSSSSSSSSS  X  FFFF FFFF FFFF 99999 100%  99999 100%  99999
- 	printf("\n");
- }
- 
--summarize(pp)
--struct psect *pp;
-+void
-+summarize(struct psect *pp)
- {
- 	int used, avail, of;
- 
diff -Nru a56-1.3+dfsg/debian/patches/clean-up.patch a56-1.3+dfsg/debian/patches/clean-up.patch
--- a56-1.3+dfsg/debian/patches/clean-up.patch	2024-03-16 21:29:00.000000000 +0100
+++ a56-1.3+dfsg/debian/patches/clean-up.patch	2024-07-27 02:32:30.000000000 +0200
@@ -3,8 +3,6 @@
 Date: Thu, 16 May 2013 21:07:45 +0200
 Subject: Clean up code some more...
 ---
-diff --git a/Makefile b/Makefile
-index 49574e5..c4f4433 100644
 --- a/Makefile
 +++ b/Makefile
 @@ -56,8 +56,8 @@ POSTPROCESS = echo
@@ -18,8 +16,6 @@
  
  DEFINES = $(CCDEFS)
  #DEFINES = -DYYDEBUG -DLDEBUG $(CCDEFS)
-diff --git a/a56.h b/a56.h
-index 474688b..ec85e9b 100644
 --- a/a56.h
 +++ b/a56.h
 @@ -5,7 +5,7 @@
@@ -31,11 +27,9 @@
  
  /*
   * Copyright (C) 1990-1994 Quinn C. Jensen
-diff --git a/keybld.c b/keybld.c
-index f3d6ce6..ba8613a 100644
 --- a/keybld.c
 +++ b/keybld.c
-@@ -10,6 +10,29 @@
+@@ -10,6 +10,25 @@
   * provided "as is" without express or implied warranty.
   *
   */
@@ -54,18 +48,14 @@
 +		void *arg;
 +	} trans[TRANSITIONS];
 +	struct state *next;
-+} empty_state, *stop = NULL, *scur = NULL, *new_state();
++} empty_state, *stop = NULL, *scur = NULL;
 +
 +int n_states = 0;
 +
-+int 	follow(char, char *, struct state *);
-+void	dump_machine(void);
-+int	add_tok(char *, char *);
-+
  static char *Copyright = "Copyright (C) 1990-1994 Quinn C. Jensen";
  
  /*
-@@ -17,12 +40,12 @@ static char *Copyright = "Copyright (C) 1990-1994 Quinn C. Jensen";
+@@ -17,7 +40,6 @@ static char *Copyright = "Copyright (C)
   *
   */
  
@@ -73,21 +63,14 @@
  #include "a56.h"
  
  char buf[1024];
- 
--main()
-+int
-+main(void)
- {
- 	int line = 0;
- 
-@@ -43,20 +66,7 @@ main()
+@@ -49,20 +71,7 @@ int main(void)
  	return 0;
  }
  
 -#define MAX_CHAR 'z'
- 
--#define TRANSITIONS (MAX_CHAR + 1)
 -
+-#define TRANSITIONS (MAX_CHAR + 1)
+ 
 -struct state {
 -	int number;
 -	char *seen;
@@ -96,62 +79,11 @@
 -		void *arg;
 -	} trans[TRANSITIONS];
 -	struct state *next;
--} empty_state, *stop = NULL, *scur = NULL, *new_state();
+-} empty_state, *stop = NULL, *scur = NULL;
 -int n_states = 0;
  
  /* actions */
  #define NOMATCH 0	/* argument is nothing */
-@@ -69,8 +79,8 @@ struct user_action {
- } *utop = NULL, *ucur = NULL;
- int n_user_actions = 0;
- 
--add_tok(tok, actions)
--char *tok, *actions;
-+int
-+add_tok(char *tok, char *actions)
- {
- 	struct state *scur;
- 	struct user_action *unew = (struct user_action *)alloc(sizeof *unew);
-@@ -92,10 +102,8 @@ char *tok, *actions;
- 	return 0;
- }
- 
--follow(c, tp, sp)
--char c;
--char *tp;
--struct state *sp;
-+int
-+follow(char c, char *tp, struct state *sp)
- {
- 	struct trans *arcp, *arcup;
- 	
-@@ -160,7 +168,8 @@ char *tp;
- 	return snew;
- }
- 
--dump_machine()
-+void
-+dump_machine(void)
- {
- 	struct state *sp;
- 	struct user_action *up;
-diff --git a/lex.c b/lex.c
-index 5195793..8b3670b 100644
---- a/lex.c
-+++ b/lex.c
-@@ -438,8 +438,8 @@ char line_buf[INLINE];
- char *cur_line = line_buf;		/* points to current line buffer */
- char *clp = NULL;				/* where we're at in cur_line */
- 
--lgetc(fp)
--FILE *fp;
-+int
-+lgetc(FILE *fp)
- {
- 	int c;
- 
-diff --git a/main.c b/main.c
-index 611d4eb..06f6dc4 100644
 --- a/main.c
 +++ b/main.c
 @@ -5,7 +5,7 @@
@@ -163,153 +95,15 @@
  
  /*
   * Copyright (C) 1990-1994 Quinn C. Jensen
-@@ -19,6 +19,9 @@
+@@ -19,6 +19,8 @@
   * provided "as is" without express or implied warranty.
   *
   */
 +#include <unistd.h>
-+#include <stdbool.h>
 +
  static char *Copyright = "Copyright (C) 1990-1994 Quinn C. Jensen";
  
  /*
-@@ -41,12 +44,14 @@ extern BOOL list_on;
- BOOL list_on_next = TRUE;
- 
--void
--summarize(struct psect *);
-+
-+void summarize(struct psect *);
-+
-+
-+void psect_summary();
-+void reset_psects();
- 
- int
--main(argc,argv)
--int argc;
--char *argv[];
-+main(int argc, char *argv[])
- {
- 	int i;
- 	extern char *optarg;
-@@ -151,8 +156,7 @@ yywrap()
- }
- 
- struct n
--sym_ref(sym)		/* return symbol value or UNDEF if not defined yet */
--char *sym;
-+sym_ref(char *sym)	/* return symbol value or UNDEF if not defined yet */
- {
- 	struct sym *sp, *find_sym();
- 	struct n result;
-@@ -177,12 +181,7 @@ char *sym;
- struct sym *symtab[HASHSIZE];
- 
- void
--sym_def(sym, type, seg, i, f)
--char *sym;
--int type;
--int seg;
--int i;
--double f;
-+sym_def(char *sym, int type, int seg, int i, double f)
- {
- 	struct sym *sp, **stop, *find_sym();
- 
-@@ -291,8 +290,8 @@ int n;
- 
- extern char segs[];
- 
--gencode(seg, pc, word)
--int seg, pc, word;
-+void
-+gencode(int seg, int pc, int word)
- {
- 	fprintf(obj, "%c %04X %06X\n", segs[seg], pc, word & 0xFFFFFF);
- }
-@@ -340,8 +339,7 @@ char *s;
- 
- #define ONE 0x4000000
- 
--makefrac(s)
--char *s;
-+makefrac(char *s)
- {
- 	int frac = 0, div = 1;
- 	int scale = 1;
-@@ -369,6 +367,7 @@ char *s;
- 
- struct psect *ptop = NULL, *cur_psect = NULL;
- 
-+void
- reset_psects()
- {
- 	struct psect *pp;
-@@ -380,6 +379,7 @@ reset_psects()
- 	set_psect(NULL);
- }
- 
-+void
- psect_summary()
- {
- 	printf("\nSummary of psect usage\n\n");
-@@ -415,8 +415,8 @@ summarize(struct psect *pp)
- 		of);
- }
- 
--struct psect *find_psect(name)
--char *name;
-+struct psect *
-+find_psect(char *name)
- {
- 	struct psect *pp;
- 
-@@ -427,33 +427,30 @@ char *name;
- 	return NULL;
- }
- 
--set_psect(pp)
--struct psect *pp;
-+void
-+set_psect(struct psect *pp)
- {
- 	cur_psect = pp;
- }
- 
--check_psect(seg, pc)
--int seg;
--unsigned int pc;
-+bool
-+check_psect(int seg, unsigned int pc)
- {
- 	if(cur_psect) {
- 		if(seg == cur_psect->seg && pc >= cur_psect->bottom && 
- 			pc <= cur_psect->top) {
- 			cur_psect->pc = pc;
--			return TRUE;
-+			return true;
- 		} else {
--			return FALSE;
-+			return false;
- 		}
- 	} else {
--		return TRUE;
-+		return true;
- 	}
- }
- 
--struct psect *new_psect(name, seg, bottom, top)
--char *name;
--int seg;
--unsigned int bottom, top;
-+struct psect *
-+new_psect(char *name, int seg, unsigned int bottom, unsigned int top)
- {
- 	struct psect *pp = find_psect(name);
- 
-diff --git a/subs.c b/subs.c
-index a9e0b5e..4e92adc 100644
 --- a/subs.c
 +++ b/subs.c
 @@ -5,7 +5,7 @@
@@ -321,35 +115,17 @@
  
  /*
   * Copyright (C) 1990-1994 Quinn C. Jensen
-@@ -26,6 +26,9 @@ static char *Copyright = "Copyright (C) 1990-1994 Quinn C. Jensen";
-  *
+@@ -27,6 +27,8 @@ static char *Copyright = "Copyright (C)
   */
  
+ #include <stdarg.h>
 +#include <stdlib.h>
 +#include <string.h>
-+
- #include "a56.h"
  
- #define MAX 1024
-@@ -68,8 +71,8 @@ char *file;
- 	return fp;
- }
- 
--fatal(c, a1, a2, a3, a4, a5, a6, a7, a8)
--char *c, *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8;
-+void
-+fatal(char *c, char *a1, char *a2, char *a3, char *a4, char *a5, char *a6, char *a7, char *a8)
- {
- 	fprintf(stderr, c, a1, a2, a3, a4, a5, a6, a7, a8);
- 	exit(1);
-@@ -117,13 +120,12 @@ register int stops;
- 	return o;
- }
+ #include "a56.h"
  
--char *alloc(size)
--int size;
-+char *
-+alloc(int size)
+@@ -116,9 +118,8 @@ char *untabn(register char *s, register
+ char *alloc(int size)
  {
  	char *p = (char *)malloc(size);
 -	if(NOT p)
@@ -360,7 +136,7 @@
  	return p;
  }
  
-@@ -134,6 +136,7 @@ int size;
+@@ -129,6 +130,7 @@ char *alloc(int size)
  	(c) >= 'A' && (c) <= 'Z' || \
  	(c) >= 'a' && (c) <= 'z')
  
@@ -368,13 +144,11 @@
  strtol(s, p, base)
  register char *s, **p;
  register int base;
-@@ -163,3 +166,4 @@ register int base;
+@@ -158,3 +160,4 @@ register int base;
  
  	return sign ? -result : result;
  }
 +*/
-diff --git a/toomf.c b/toomf.c
-index 2504b80..fdb887b 100644
 --- a/toomf.c
 +++ b/toomf.c
 @@ -5,7 +5,7 @@
@@ -397,19 +171,7 @@
  static char *Copyright = "Copyright (C) 1990-1994 Quinn C. Jensen";
  
  /*
-@@ -31,9 +35,8 @@ static char *Copyright = "Copyright (C) 1990-1994 Quinn C. Jensen";
- 
- #define MAX 256
- 
--main(argc,argv)
--int argc;
--char *argv[];
-+int
-+main(int argc, char *argv[])
- {
- 	char buf[MAX];
- 	int curaddr = 0;
-@@ -57,4 +60,6 @@ char *argv[];
+@@ -57,4 +61,6 @@ int main(int argc, char **argv)
  		}
  	}
  	printf("\n_END %04X\n", startaddr);
diff -Nru a56-1.3+dfsg/debian/patches/declare-attribute-format.patch a56-1.3+dfsg/debian/patches/declare-attribute-format.patch
--- a56-1.3+dfsg/debian/patches/declare-attribute-format.patch	1970-01-01 01:00:00.000000000 +0100
+++ a56-1.3+dfsg/debian/patches/declare-attribute-format.patch	2024-07-27 02:38:09.000000000 +0200
@@ -0,0 +1,94 @@
+From: Ben Hutchings <b...@debian.org>
+Date: Sat, 27 Jul 2024 01:32:06 +0200
+Subject: Add format attributes to allow type checks on *printf() wrappers
+Forwarded: not-needed as there is no upstream anymore
+
+Varargs functions normally can't be type-checked.  However gcc can
+parse printf()-style format strings and check the following arguments
+against them.  Declare fatal(), yyerror(), and yywarning() with the
+required function attribute.
+
+Adding this will trigger new errors:
+
+main.c:82:25: error: format not a string literal and no format arguments [-Werror=format-security]
+   82 |                         fatal(usage);
+      |                         ^~~~~
+main.c:85:9: error: format not a string literal and no format arguments [-Werror=format-security]
+   85 |         if(input_file == NULL) fatal(usage);
+      |         ^~
+
+To avoid that, change the 'usage' variable to be a const array and
+change the format parameters of these functions to be const-qualified.
+
+---
+--- a/a56.h
++++ b/a56.h
+@@ -95,7 +95,7 @@ struct psect {
+ 
+ /* gram.c (from a56.y) */
+ char *tok_print(int tok);
+-void yyerror(char *s, ...);
++void yyerror(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
+ 
+ /* kparse.c (from keybld.c) */
+ int kparse(char *kp);
+@@ -122,7 +122,7 @@ struct psect *new_psect(char *name, int
+ FILE *open_read(char *file);
+ FILE *open_write(char *file);
+ FILE *open_append(char *file);
+-void fatal(char *c, ...);
++void fatal(const char *c, ...) __attribute__ ((format (printf, 1, 2)));
+ char *alloc(int size);
+ char *untab(char *s);
+ char *untabn(char *s, int stops);
+--- a/a56.y
++++ b/a56.y
+@@ -70,7 +70,7 @@ struct n binary_op(struct n a1, int op,
+ struct n unary_op(int op, struct n a1);
+ int n2int(struct n n);
+ int n2frac(struct n n);
+-void yywarning(char *s, ...);
++void yywarning(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
+ char *luntab(char *s);
+ 
+ #define R_R6				0x0001
+@@ -2056,7 +2056,7 @@ char *tok_print(int tok)
+ 	return "*bogus*";
+ }
+ 
+-void yyerror(char *s, ...)
++void yyerror(const char *s, ...)
+ {
+ 	extern int error;
+ 	char buf[1024];
+@@ -2076,7 +2076,7 @@ void yyerror(char *s, ...)
+ 	}
+ }
+ 
+-void yywarning(char *s, ...)
++void yywarning(const char *s, ...)
+ {
+ 	extern int warning;
+ 	char buf[1024];
+--- a/main.c
++++ b/main.c
+@@ -60,7 +60,7 @@ int main(int argc, char *argv[])
+ 	int c;
+ 	char *output_file = "a56.out";
+ 	char *input_file;
+-	char *usage = "usage: a56  [-b]  [-l]  [-d]  [-o output-file]  input-file\n";
++	const char usage[] = "usage: a56  [-b]  [-l]  [-d]  [-o output-file]  input-file\n";
+ 
+ 	while((c = getopt(argc, argv, "bldo:")) != EOF) switch (c) {
+ 		case 'b':
+--- a/subs.c
++++ b/subs.c
+@@ -65,7 +65,7 @@ FILE *open_append(char *file)
+ 	return fp;
+ }
+ 
+-void fatal(char *c, ...)
++void fatal(const char *c, ...)
+ {
+ 	va_list ap;
+ 
diff -Nru a56-1.3+dfsg/debian/patches/fix-miscellaneous-warnings.patch a56-1.3+dfsg/debian/patches/fix-miscellaneous-warnings.patch
--- a56-1.3+dfsg/debian/patches/fix-miscellaneous-warnings.patch	1970-01-01 01:00:00.000000000 +0100
+++ a56-1.3+dfsg/debian/patches/fix-miscellaneous-warnings.patch	2024-07-27 02:41:55.000000000 +0200
@@ -0,0 +1,107 @@
+From: Ben Hutchings <b...@debian.org>
+Date: Fri, 26 Jul 2024 23:54:35 +0200
+Subject: Fix miscellaneous warnings
+Forwarded: not-needed as there is no upstream anymore
+
+gcc warns:
+
+a56.y: In function ‘unary_name’:
+a56.y:1922:1: warning: control reaches end of non-void function [-Wreturn-type]
+ 1922 | }
+      | ^
+
+It's not clear to me whether this function can be called with a value
+that's not handled in the switch(), so add a default case to fix this.
+
+a56.y: In function ‘unary_op’:
+a56.y:1927:18: warning: variable ‘result’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]
+ 1927 |         struct n result;
+      |                  ^~~~~~
+
+Fix this by declaring it volatile.
+
+a56.y: In function ‘unary_op’:
+a56.y:1959:43: warning: operation on ‘result.val.f’ may be undefined [-Wsequence-point]
+ 1959 |                         else result.val.f = result.val.f = a1.val.f < 0 ? -a1.val.f : a1.val.f;
+      |                              ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+There's clearly no need to assign to result.val.f twice here.
+Delete the duplicate assignment.
+
+lex.c: In function ‘lgetc’:
+lex.c:465:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
+  465 |                 c = '\n';
+      |                 ~~^~~~~~
+lex.c:466:9: note: here
+  466 |         case '\n':
+      |         ^~~~
+
+This fallthrough looks intentional, so declare that.
+
+toomf.c: In function ‘main’:
+toomf.c:36:14: warning: unused parameter ‘argc’ [-Wunused-parameter]
+   36 | int main(int argc, char **argv)
+      |          ~~~~^~~~
+toomf.c:36:27: warning: unused parameter ‘argv’ [-Wunused-parameter]
+   36 | int main(int argc, char **argv)
+      |                    ~~~~~~~^~~~
+
+Change the parameter list to void.
+
+---
+--- a/a56.y
++++ b/a56.y
+@@ -1900,7 +1900,7 @@ struct n binary_op(struct n a1, int op,
+ jmp_buf unary_env;
+ 
+ void
+-sigfpu(int signum)
++sigfpu(int signum __attribute__((unused)))
+ {
+ 	longjmp(unary_env, 1);
+ }
+@@ -1918,12 +1918,13 @@ char *unary_name(int op)
+    	case 'l':	return "ln";
+ 	case 'L':	return "log";
+ 	case 'a':	return "abs";
++	default:	return "???";
+ 	}
+ }
+ 
+ struct n unary_op(int op, struct n a1)
+ {
+-	struct n result;
++	volatile struct n result;
+ 	void (*orig)(int);
+ 	double farg;
+ 
+@@ -1956,7 +1957,7 @@ struct n unary_op(int op, struct n a1)
+ 		case 'a':
+ 			result.type = a1.type;
+ 			if(a1.type == INT) result.val.i = a1.val.i < 0 ? -a1.val.i : a1.val.i;
+-			else result.val.f = result.val.f = a1.val.f < 0 ? -a1.val.f : a1.val.f;
++			else result.val.f = a1.val.f < 0 ? -a1.val.f : a1.val.f;
+ 			break;
+ 		case 's':
+ 			result.type = FLT;
+--- a/lex.c
++++ b/lex.c
+@@ -463,6 +463,7 @@ int lgetc(FILE *fp)
+ 		break;
+ 	case '\0':
+ 		c = '\n';
++		__attribute__((fallthrough));
+ 	case '\n':
+ 		clp = NULL;
+ 		break;
+--- a/toomf.c
++++ b/toomf.c
+@@ -37,7 +37,7 @@ static char *Copyright = "Copyright (C)
+ 
+ #define MAX 256
+ 
+-int main(int argc, char **argv)
++int main(void)
+ {
+ 	char buf[MAX];
+ 	int curaddr = 0;
diff -Nru a56-1.3+dfsg/debian/patches/fix-type-warnings.patch a56-1.3+dfsg/debian/patches/fix-type-warnings.patch
--- a56-1.3+dfsg/debian/patches/fix-type-warnings.patch	1970-01-01 01:00:00.000000000 +0100
+++ a56-1.3+dfsg/debian/patches/fix-type-warnings.patch	2024-07-27 02:38:09.000000000 +0200
@@ -0,0 +1,102 @@
+From: Ben Hutchings <b...@debian.org>
+Date: Fri, 26 Jul 2024 23:32:47 +0200
+Subject: Fix type warnings
+Forwarded: not-needed as there is no upstream anymore
+
+gcc warns:
+
+keybld.c: In function ‘follow’:
+keybld.c:119:50: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
+  119 |                         arcp->arg = arcup->arg = (void *)n_user_actions;
+      |
+keybld.c:185:47: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
+  185 |                                 printf("%d", -(int)tp->arg - 1);
+      |
+
+The trans::arg struct member is declared with type void * but is used
+to store both pointers and integers.  This is generally unsafe, but it
+is OK to store pointers in intptr_t-typed variables.  Change
+trans::arg to intptr_t and update the casts accordingly.
+
+keybld.c: In function ‘dump_machine’:
+keybld.c:171:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat=]
+  171 |         printf("/* %d bytes required for transition table storage */\n",
+      |                    ~^
+      |                     |
+      |                     int
+      |                    %ld
+  172 |                 sizeof(short) * TRANSITIONS * n_states);
+      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+      |                                             |
+      |                                             long unsigned int
+
+Fix this by changing the format string to "%zu".
+
+kparse.c: In function ‘kparse’:
+kparse.c:2480:55: warning: array subscript has type ‘char’ [-Wchar-subscripts]
+ 2480 |                 short transition = transitions[state][*kp];
+      |                                                       ^~~
+
+This warning is implemented because the char type may or may not be
+signed.  In this case we know char is ASCII alphanumeric so that
+doesn't actually make a difference.  Add a cast to unsigned char to
+avoid the warning.
+
+---
+--- a/keybld.c
++++ b/keybld.c
+@@ -10,6 +10,7 @@
+  * provided "as is" without express or implied warranty.
+  *
+  */
++#include <stdint.h>
+ #include <stdio.h>
+ #include <string.h>
+ 
+@@ -22,7 +23,7 @@ struct state {
+ 	char *seen;
+ 	struct trans {
+ 		char action;
+-		void *arg;
++		intptr_t arg;
+ 	} trans[TRANSITIONS];
+ 	struct state *next;
+ } empty_state, *stop = NULL, *scur = NULL;
+@@ -122,16 +123,16 @@ int follow(char c, char *tp, struct stat
+ 			return -1;
+ 		} else {
+ 			arcp->action = arcup->action = TERMINAL;
+-			arcp->arg = arcup->arg = (void *)n_user_actions;
++			arcp->arg = arcup->arg = n_user_actions;
+ 			return 0;
+ 		}
+ 	} else {
+ 		if(arcp->action == GOTO) {
+-			return follow(*tp, tp + 1, arcp->arg);
++			return follow(*tp, tp + 1, (struct state *)arcp->arg);
+ 		} else {
+ 			struct state *new = new_state(tp);
+ 			arcp->action = arcup->action = GOTO;
+-			arcp->arg = arcup->arg = (void *)new;
++			arcp->arg = arcup->arg = (intptr_t)new;
+ 			return follow(*tp, tp + 1, new);
+ 		}
+ 	}
+@@ -174,7 +175,7 @@ void dump_machine(void)
+ 
+ 	printf("/* state machine generated by keybld */\n");
+ 	printf("/* states=%d actions=%d */\n", n_states, n_user_actions);
+-	printf("/* %d bytes required for transition table storage */\n",
++	printf("/* %zu bytes required for transition table storage */\n",
+ 		sizeof(short) * TRANSITIONS * n_states);
+ 
+ 	printf("short transitions[%d][%d] = {\n", n_states, TRANSITIONS);
+@@ -208,7 +209,7 @@ int kparse(char *kp)\n\
+ 	int state = 0;\n\
+ \n\
+ 	for(;;) {\n\
+-		short transition = transitions[state][*kp];\n");
++		short transition = transitions[state][(unsigned char)*kp];\n");
+ 
+ printf("\
+ 		if(transition == 0) {\n\
diff -Nru a56-1.3+dfsg/debian/patches/prototype.patch a56-1.3+dfsg/debian/patches/prototype.patch
--- a56-1.3+dfsg/debian/patches/prototype.patch	2024-01-13 23:00:00.000000000 +0100
+++ a56-1.3+dfsg/debian/patches/prototype.patch	1970-01-01 01:00:00.000000000 +0100
@@ -1,40 +0,0 @@
-Author: Thorsten Alteholz <deb...@alteholz.de>
-Description: add missing prototype, this is patch 04 from the original
-Forwarded: not-needed as there is no upstream anymore
-Index: a56/a56.h
-===================================================================
---- a56.orig/a56.h	2012-11-26 12:11:37.000000000 +0100
-+++ a56/a56.h	2012-11-26 13:12:04.000000000 +0100
-@@ -92,3 +92,7 @@
- 
- #define ASSERT(expr, str) \
- 		if(expr) fprintf(stderr, "ASSERT: %s: line %d: %s\n", __FILE__, __LINE__, str);
-+
-+char *alloc (int size);
-+char *fixstring (char *s);
-+
-Index: a56/main.c
-===================================================================
---- a56.orig/main.c	1995-06-12 14:12:49.000000000 +0200
-+++ a56/main.c	2012-11-26 13:12:21.000000000 +0100
-@@ -39,7 +39,6 @@
- FILE *obj = NULL;
- extern BOOL list_on;
- BOOL list_on_next = TRUE;
--char *alloc();
- 
- main(argc,argv)
- int argc;
-Index: a56/subs.c
-===================================================================
---- a56.orig/subs.c	2012-11-26 12:14:29.000000000 +0100
-+++ a56/subs.c	2012-11-26 13:12:33.000000000 +0100
-@@ -30,8 +30,6 @@
- 
- #define MAX 1024
- 
--char *alloc();
--
- FILE *open_read(file)
- char *file;
- {
diff -Nru a56-1.3+dfsg/debian/patches/prototype2.patch a56-1.3+dfsg/debian/patches/prototype2.patch
--- a56-1.3+dfsg/debian/patches/prototype2.patch	2024-03-16 21:29:00.000000000 +0100
+++ a56-1.3+dfsg/debian/patches/prototype2.patch	1970-01-01 01:00:00.000000000 +0100
@@ -1,101 +0,0 @@
-Description: Add function prototypes
- Correct some sym_def calls by adding the last (unevaluated) parameter.
-Author: Bastian Germann <b...@debian.org>
----
---- a56-1.3+dfsg.orig/a56.y
-+++ a56-1.3+dfsg/a56.y
-@@ -334,7 +334,7 @@ good_stuff
- 			w0 = w1 = 0; uses_w1 = FALSE; 
- 			long_symbolic_expr = FALSE;}
- 	|	SYM 
--			{sym_def($1, INT, seg, pc);
-+			{sym_def($1, INT, seg, pc, 0.0f);
- 			free($1);
- 			if(pass == 2 && list_on) {
- 				sprintf(list_buf, "%c:%04X%s", segs[seg], pc, spaces(14-8));
-@@ -428,7 +428,7 @@ assembler_ops
- 			     pc += (align - (pc % align));
- 			}
- 			if($1)
--			{   sym_def($1, INT, seg, pc);
-+			{   sym_def($1, INT, seg, pc, 0.0f);
-  			    free($1);
- 			}
- 			pc += size;
-@@ -498,7 +498,7 @@ space
- 
- label_field
- 	:	SYM
--			{sym_def($1, INT, seg, pc);
-+			{sym_def($1, INT, seg, pc, 0.0f);
- 			free($1);}
- 	|	/* empty */
- 	;
-@@ -2060,14 +2060,14 @@ int tok;
- 	return "*bogus*";
- }
- 
--yyerror(s, a0, a1, a2, a3)
--char *s, *a0, *a1, *a2, *a3;
-+yyerror(s, a0)
-+char *s, *a0;
- {
- 	extern int error;
- 	char buf[1024];
- 
- 	error++;
--	sprintf(buf, s, a0, a1, a2, a3);
-+	sprintf(buf, s, a0);
- 
- 	if(pass == 2) {
- 		fprintf(stderr, "%s: line %d: %s (tok=%s)\n", curfile, curline,
---- a56-1.3+dfsg.orig/a56.h
-+++ a56-1.3+dfsg/a56.h
-@@ -58,6 +58,9 @@ struct sym {
- 	struct sym *next;
- } *find_sym();
- 
-+void sym_def(char *sym, int type, int seg, int i, double f);
-+int n2int(struct n n);
-+int n2frac(struct n n);
- extern int pass;
- 
- #define NEW(object) ((object *)alloc(sizeof(object)))
-@@ -83,6 +86,9 @@ struct psect {
- 	struct psect *next;
- } *find_psect(), *new_psect();
- 
-+_Bool check_psect(int seg, unsigned int pc);
-+void set_psect(struct psect *);
-+
- FILE *open_read(), *open_write(), *open_append();
- 
- 	/* save string s somewhere */
-@@ -97,4 +103,14 @@ FILE *open_read(), *open_write(), *open_
- 
- char *alloc (int size);
- char *fixstring (char *s);
--
-+void include(char *file);
-+void gencode(int seg, int pc, int word);
-+char *untab(register char *s);
-+
-+void yyerror(char *s, ...);
-+void yywarning(char *s, ...);
-+int yylex();
-+int yyparse();
-+int yywrap();
-+int kparse(char *tok);
-+char *tok_print(int tok);
---- a56-1.3+dfsg.orig/lex.c
-+++ a56-1.3+dfsg/lex.c
-@@ -33,6 +33,9 @@ int ldebug = 0;
- extern YYSTYPE yyval;
- 
- double atof();
-+static int is_keyword(char *tok);
-+static int lgetc(FILE *fp);
-+static int next_tok();
- 
- /**************** yylex - returns next token *****************************/
- 
diff -Nru a56-1.3+dfsg/debian/patches/replace-undecl-fatal.patch a56-1.3+dfsg/debian/patches/replace-undecl-fatal.patch
--- a56-1.3+dfsg/debian/patches/replace-undecl-fatal.patch	2024-03-16 21:29:00.000000000 +0100
+++ a56-1.3+dfsg/debian/patches/replace-undecl-fatal.patch	1970-01-01 01:00:00.000000000 +0100
@@ -1,62 +0,0 @@
-Description: Replace undeclared fatal
-Author: Bastian Germann <b...@debian.org>
----
---- a56-1.3+dfsg.orig/main.c
-+++ a56-1.3+dfsg/main.c
-@@ -80,7 +80,8 @@ main(int argc, char *argv[])
- 			break;
- 		case '?':
- 		default:
--			fatal(usage);
-+			fprintf(stderr, "%s", usage);
-+			exit(1);
- 	}
- 	input_file = argv[optind++];
- 	if(input_file == NULL) fatal(usage);
-@@ -84,6 +84,9 @@ main(int argc, char *argv[])
- 	}
- 	input_file = argv[optind++];
--	if(input_file == NULL) fatal(usage);
-+	if(input_file == NULL) {
-+		fprintf(stderr, "%s", usage);
-+		exit(1);
-+	}
- 	obj = open_write(output_file);
- 
- 	pc = 0;
-@@ -118,7 +121,10 @@ include(char *file)
- 
- 	inc_p++;
- 	if(inc_p >= MAX_NEST)
--		fatal("%s: include nesting too deep\n", file);
-+	{
-+		fprintf(stderr, "%s: include nesting too deep\n", file);
-+		exit(1);
-+	}
- 
- 	inc[inc_p].file = file;
- 	inc[inc_p].fp = fp;
-@@ -210,7 +216,10 @@ sym_def(char *sym, int type, int seg, in
- 	} else {
- 		sp = find_sym(sym);
- 		if(!sp)
--			fatal("internal error 304\n");
-+		{
-+			fprintf(stderr, "%s", "internal error 304\n");
-+			exit(1);
-+		}
- 		if(sp->n.type != type ||
- 			type == INT && sp->n.val.i != (i & 0xFFFFFF) ||
- 			type == FLT && sp->n.val.f != f)
---- a56-1.3+dfsg.orig/torom.c
-+++ a56-1.3+dfsg/torom.c
-@@ -49,7 +49,8 @@ main(int argc, char *argv[])
- 				break;
- 			} else {
- 				if(addr < curaddr) {
--					fatal("%s: input line %d: can't go back\n", argv[0], line);
-+					fprintf(stderr, "%s: input line %d: can't go back\n", argv[0], line);
-+					exit(1);
- 				} else if(addr != curaddr) {
- 					while(curaddr < addr) {
- 						putword(0);
diff -Nru a56-1.3+dfsg/debian/patches/series a56-1.3+dfsg/debian/patches/series
--- a56-1.3+dfsg/debian/patches/series	2024-03-16 21:29:00.000000000 +0100
+++ a56-1.3+dfsg/debian/patches/series	2024-07-27 02:38:09.000000000 +0200
@@ -1,11 +1,10 @@
 pc-type.patch
-prototype.patch
 include.patch
 Makefile.patch
-clang-ftbfs.diff
 fgets.patch
-clang.patch
+use-standard-function-declarations.patch
+declare-attribute-format.patch
 clean-up.patch
 ansi-c.patch
-replace-undecl-fatal.patch
-prototype2.patch
+fix-type-warnings.patch
+fix-miscellaneous-warnings.patch
diff -Nru a56-1.3+dfsg/debian/patches/use-standard-function-declarations.patch a56-1.3+dfsg/debian/patches/use-standard-function-declarations.patch
--- a56-1.3+dfsg/debian/patches/use-standard-function-declarations.patch	1970-01-01 01:00:00.000000000 +0100
+++ a56-1.3+dfsg/debian/patches/use-standard-function-declarations.patch	2024-07-27 02:38:09.000000000 +0200
@@ -0,0 +1,789 @@
+From: Ben Hutchings <b...@debian.org>
+Date: Fri, 26 Jul 2024 22:18:42 +0200
+Subject: Use standard function declarations
+Forwarded: not-needed as there is no upstream anymore
+
+a56 ues K&R style function definitions, and does not declare many of
+the functions that are called from another source file (or from before
+their definition).  This is generally rather dangerous, and with
+recent compiler versions it's a fatal error.
+
+Convert all function definitions to standard C syntax, and:
+
+- For functions that do not return a value, set the return type to
+  void instead of the previous implicit int.
+- For functions that are *printf() wrappers, use varargs instead of
+  the previous arbitrary-length parameter lists that don't match their
+  callers.
+- Fix sigfpu() to take an int parameter, as required for signal
+  handlers.
+
+Add/include prototypes as necessary:
+
+- Include gram.h in main.c and update its dependencies in Makefile.
+- For functions called from another source file, add a prototype in
+  a56.h.
+- For functions only called from earlier in the same source file,
+  add a prototype near the top of the file.  (These functions should
+  also be declared static, but that's not a serious issue.)
+- Fix sym_def() callers to always pass the final 'f' parameter.
+  It could alternately be changed to use varargs, but this seemed
+  like the simpler change.
+
+---
+--- a/Makefile
++++ b/Makefile
+@@ -81,7 +81,7 @@ ksubs.o:	subs.c
+ 	$(HOSTCC) $(CFLAGS) -c subs.c
+ 	$(MV) subs.o ksubs.o
+ 
+-lex.o:	lex.c gram.h
++lex.o:	lex.c a56.h gram.h
+ 
+ kparse.c:	a56.key keybld
+ 	./keybld < a56.key > kparse.c
+@@ -108,7 +108,9 @@ torom:	torom.o subs.o
+ tape:	toktab.c
+ 	csh -c 'tar cvbf 1 - `cat files` | gzip > a56.tar.gz'
+ 
+-main.o gram.o lex.o:	a56.h
++gram.o:	a56.h
++
++main.o:	a56.h gram.h
+ 
+ clean:	; rm -f a56 toomf y.output *.o *.out tmp *.bak a56.tar.gz keybld
+ 
+--- a/a56.h
++++ b/a56.h
+@@ -56,7 +56,7 @@ struct sym {
+ 		} val;
+ 	} n;
+ 	struct sym *next;
+-} *find_sym();
++};
+ 
+ extern int pass;
+ 
+@@ -81,9 +81,7 @@ struct psect {
+ 	int seg;
+ 	unsigned int pc, bottom, top;
+ 	struct psect *next;
+-} *find_psect(), *new_psect();
+-
+-FILE *open_read(), *open_write(), *open_append();
++};
+ 
+ 	/* save string s somewhere */
+ #define strsave(s) ((s) != NULL ? \
+@@ -94,3 +92,38 @@ FILE *open_read(), *open_write(), *open_
+ 
+ #define ASSERT(expr, str) \
+ 		if(expr) fprintf(stderr, "ASSERT: %s: line %d: %s\n", __FILE__, __LINE__, str);
++
++/* gram.c (from a56.y) */
++char *tok_print(int tok);
++void yyerror(char *s, ...);
++
++/* kparse.c (from keybld.c) */
++int kparse(char *kp);
++
++/* lex.c */
++int yylex(void);
++
++/* main.c */
++void include(char *file);
++BOOL yywrap(void);
++struct n sym_ref(char *sym);
++void sym_def(char *sym, int type, int seg, int i, double f);
++char *printcode(int word);
++char *spaces(int n);
++void gencode(int seg, int pc, int word);
++char *fixstring(char *s);
++struct psect *find_psect(char *name);
++void set_psect(struct psect *pp);
++BOOL check_psect(int seg, unsigned int pc);
++struct psect *new_psect(char *name, int seg, unsigned int bottom,
++			unsigned int top);
++
++/* subs.c */
++FILE *open_read(char *file);
++FILE *open_write(char *file);
++FILE *open_append(char *file);
++void fatal(char *c, ...);
++char *alloc(int size);
++char *untab(char *s);
++char *untabn(char *s, int stops);
++char *alloc(int size);
+--- a/a56.y
++++ b/a56.y
+@@ -65,11 +65,13 @@ char list_buf[1024 + 80];		/* listing bu
+ char list_buf2[1024 + 80];		/* listing buffer for two-line code */
+ BOOL uses_buf2 = FALSE;			/* list_buf2 is alive */
+ BOOL list_print_line = FALSE;	/* whether or not to print line in listing */
+-char *spaces(), *luntab();
+ 
+-struct n binary_op();
+-struct n unary_op();
+-struct n sym_ref();
++struct n binary_op(struct n a1, int op, struct n a2);
++struct n unary_op(int op, struct n a1);
++int n2int(struct n n);
++int n2frac(struct n n);
++void yywarning(char *s, ...);
++char *luntab(char *s);
+ 
+ #define R_R6				0x0001
+ #define R_R5				0x0002
+@@ -314,7 +316,7 @@ good_stuff
+ 	|	assembler_ops
+ 			{long_symbolic_expr = FALSE;}
+ 	|	label_field operation_field
+-			{char *printcode();
++			{
+ 			if(pass == 2) {
+ 				gencode(seg, pc, w0);
+ 				sprintf(list_buf, "%c:%04X %s ", segs[seg], pc, printcode(w0));
+@@ -334,7 +336,7 @@ good_stuff
+ 			w0 = w1 = 0; uses_w1 = FALSE; 
+ 			long_symbolic_expr = FALSE;}
+ 	|	SYM 
+-			{sym_def($1, INT, seg, pc);
++			{sym_def($1, INT, seg, pc, 0.0);
+ 			free($1);
+ 			if(pass == 2 && list_on) {
+ 				sprintf(list_buf, "%c:%04X%s", segs[seg], pc, spaces(14-8));
+@@ -428,7 +430,7 @@ assembler_ops
+ 			     pc += (align - (pc % align));
+ 			}
+ 			if($1)
+-			{   sym_def($1, INT, seg, pc);
++			{   sym_def($1, INT, seg, pc, 0.0);
+  			    free($1);
+ 			}
+ 			pc += size;
+@@ -498,7 +500,7 @@ space
+ 
+ label_field
+ 	:	SYM
+-			{sym_def($1, INT, seg, pc);
++			{sym_def($1, INT, seg, pc, 0.0);
+ 			free($1);}
+ 	|	/* empty */
+ 	;
+@@ -1797,15 +1799,14 @@ expr
+ 
+ %%
+ 
++#include <stdarg.h>
+ #include <stdio.h>
+ #include <setjmp.h>
+ #include <sys/signal.h>
+ 
+ int yydebug;
+ 
+-struct n binary_op(a1, op, a2)
+-struct n a1, a2;
+-int op;
++struct n binary_op(struct n a1, int op, struct n a2)
+ {
+ 	struct n result;
+ 	int iarg1, iarg2;
+@@ -1899,12 +1900,12 @@ int op;
+ jmp_buf unary_env;
+ 
+ void
+-sigfpu()
++sigfpu(int signum)
+ {
+ 	longjmp(unary_env, 1);
+ }
+ 
+-char *unary_name(op)
++char *unary_name(int op)
+ {
+ 	switch(op) {
+ 	case 's':	return "sin";
+@@ -1920,12 +1921,10 @@ char *unary_name(op)
+ 	}
+ }
+ 
+-struct n unary_op(op, a1)
+-int op;
+-struct n a1;
++struct n unary_op(int op, struct n a1)
+ {
+ 	struct n result;
+-	void (*orig)();
++	void (*orig)(int);
+ 	double farg;
+ 
+ 	if(a1.type == UNDEF) {
+@@ -2002,8 +2001,7 @@ struct n a1;
+ 	return result;
+ }
+ 
+-n2int(n)
+-struct n n;
++int n2int(struct n n)
+ {
+ 	if(n.type == UNDEF)
+ 		return UNDEF;
+@@ -2013,8 +2011,7 @@ struct n n;
+ 		return n.val.f;
+ }
+ 
+-n2frac(n)
+-struct n n;
++int n2frac(struct n n)
+ {
+ 	double adval = n.val.f >= 0.0 ? n.val.f : -n.val.f;
+ 
+@@ -2038,8 +2035,7 @@ struct n n;
+ extern struct {int n; char *name;} tok_tab[];
+ extern int n_tok;
+ 
+-char *tok_print(tok)
+-int tok;
++char *tok_print(int tok)
+ {
+ 	int i;
+ 	static char buf[32];
+@@ -2060,14 +2056,16 @@ int tok;
+ 	return "*bogus*";
+ }
+ 
+-yyerror(s, a0, a1, a2, a3)
+-char *s, *a0, *a1, *a2, *a3;
++void yyerror(char *s, ...)
+ {
+ 	extern int error;
+ 	char buf[1024];
++	va_list ap;
+ 
+ 	error++;
+-	sprintf(buf, s, a0, a1, a2, a3);
++	va_start(ap, s);
++	vsprintf(buf, s, ap);
++	va_end(ap);
+ 
+ 	if(pass == 2) {
+ 		fprintf(stderr, "%s: line %d: %s (tok=%s)\n", curfile, curline,
+@@ -2078,14 +2076,16 @@ char *s, *a0, *a1, *a2, *a3;
+ 	}
+ }
+ 
+-yywarning(s, a0, a1, a2, a3)
+-char *s, *a0, *a1, *a2, *a3;
++void yywarning(char *s, ...)
+ {
+ 	extern int warning;
+ 	char buf[1024];
++	va_list ap;
+ 
+ 	warning++;
+-	sprintf(buf, s, a0, a1, a2, a3);
++	va_start(ap, s);
++	vsprintf(buf, s, ap);
++	va_end(ap);
+ 
+ 	if(pass == 2) {
+ 		fprintf(stderr, "%s: line %d: %s (tok=%s)\n", curfile, curline,
+@@ -2096,8 +2096,7 @@ char *s, *a0, *a1, *a2, *a3;
+ 	}
+ }
+ 
+-char *luntab(s)
+-char *s;
++char *luntab(char *s)
+ {
+ 	static char buf[1024];
+ 	int p;
+--- a/getopt.c
++++ b/getopt.c
+@@ -26,9 +26,7 @@ static	char	sccsfid[] = "@(#) getopt.c 5
+ /* this is included because index is not on some UNIX systems */
+ static
+ char *
+-index (s, c)
+-register	char	*s;
+-register	int 	c;
++index (register char *s, register int c)
+ 	{
+ 	while (*s)
+ 		if (c == *s) return (s);
+@@ -48,10 +46,7 @@ char	*optarg;		/* argument associated wi
+ 		fputc(optopt,stderr);fputc('\n',stderr);return(BADCH);
+ 
+ 
+-getopt(nargc,nargv,ostr)
+-int	nargc;
+-char	**nargv,
+-	*ostr;
++int getopt(int nargc, char **nargv, char *ostr)
+ {
+ 	static char	*place = EMSG;	/* option letter processing */
+ 	register char	*oli;		/* option letter list index */
+@@ -92,7 +87,7 @@ char	**nargv,
+ static	char	sccspid[] = "@(#) getopt.c 5.1 (WangInst) 6/15/85";
+ #endif
+ 
+-main (argc, argv) char **argv;
++int main (int argc, char **argv)
+ 	{
+ 	char	*optstring = argv[1];
+ 	char	*argv0 = argv[0];
+--- a/keybld.c
++++ b/keybld.c
+@@ -22,7 +22,13 @@ static char *Copyright = "Copyright (C)
+ 
+ char buf[1024];
+ 
+-main()
++struct state;
++int add_tok(char *tok, char *actions);
++int follow(char c, char *tp, struct state *sp);
++struct state *new_state(char *);
++void dump_machine(void);
++
++int main(void)
+ {
+ 	int line = 0;
+ 
+@@ -55,7 +61,7 @@ struct state {
+ 		void *arg;
+ 	} trans[TRANSITIONS];
+ 	struct state *next;
+-} empty_state, *stop = NULL, *scur = NULL, *new_state();
++} empty_state, *stop = NULL, *scur = NULL;
+ int n_states = 0;
+ 
+ /* actions */
+@@ -69,8 +75,7 @@ struct user_action {
+ } *utop = NULL, *ucur = NULL;
+ int n_user_actions = 0;
+ 
+-add_tok(tok, actions)
+-char *tok, *actions;
++int add_tok(char *tok, char *actions)
+ {
+ 	struct state *scur;
+ 	struct user_action *unew = (struct user_action *)alloc(sizeof *unew);
+@@ -92,10 +97,7 @@ char *tok, *actions;
+ 	return 0;
+ }
+ 
+-follow(c, tp, sp)
+-char c;
+-char *tp;
+-struct state *sp;
++int follow(char c, char *tp, struct state *sp)
+ {
+ 	struct trans *arcp, *arcup;
+ 	
+@@ -130,8 +132,7 @@ struct state *sp;
+ 	}
+ }
+ 
+-struct state *new_state(tp)
+-char *tp;
++struct state *new_state(char *tp)
+ {
+ 	struct state *snew = (struct state *)alloc(sizeof *snew);
+ 	char tmp[1024];
+@@ -160,7 +161,7 @@ char *tp;
+ 	return snew;
+ }
+ 
+-dump_machine()
++void dump_machine(void)
+ {
+ 	struct state *sp;
+ 	struct user_action *up;
+@@ -197,8 +198,7 @@ dump_machine()
+ 
+ 	printf("\
+ \n\
+-kparse(kp)\n\
+-char *kp;\n\
++int kparse(char *kp)\n\
+ {\n\
+ 	int state = 0;\n\
+ \n\
+--- a/lex.c
++++ b/lex.c
+@@ -16,6 +16,10 @@
+ #include "a56.h"
+ #include "gram.h"
+ 
++int is_keyword(char *tok);
++int next_tok(void);
++int lgetc(FILE *fp);
++
+ int ldebug = 0;
+ #ifdef LDEBUG
+ #define RET(val) \
+@@ -32,14 +36,12 @@ int ldebug = 0;
+ 
+ extern YYSTYPE yyval;
+ 
+-double atof();
+-
+ /**************** yylex - returns next token *****************************/
+ 
+ #define MAX_TOK 1024
+ char tok[MAX_TOK];
+ 
+-yylex()
++int yylex(void)
+ {
+ 	int ltok = next_tok();
+ 	int itok;
+@@ -88,8 +90,7 @@ yylex()
+ 	}
+ }
+ 
+-is_keyword(tok)
+-char *tok;
++int is_keyword(char *tok)
+ {
+ 	int kval = kparse(tok);
+ 	if(kval > 0)
+@@ -110,7 +111,7 @@ struct ascii_tab {
+ 
+ extern FILE *yyin;
+ 
+-int next_tok()
++int next_tok(void)
+ {
+ 	char *tp = tok;
+ 	enum {S_TOP, S_HEXNUM, S_NUM, S_ALNUM, S_CHAR, S_ESC_CHAR, S_COMMENT,
+@@ -438,8 +439,7 @@ char line_buf[INLINE];
+ char *cur_line = line_buf;		/* points to current line buffer */
+ char *clp = NULL;				/* where we're at in cur_line */
+ 
+-lgetc(fp)
+-FILE *fp;
++int lgetc(FILE *fp)
+ {
+ 	int c;
+ 
+--- a/main.c
++++ b/main.c
+@@ -27,9 +27,21 @@ static char *Copyright = "Copyright (C)
+  */
+ 
+ #include "a56.h"
++#include "gram.h"
+ 
+ #define MAX 1024
+ 
++struct sym *find_sym(char *sym);
++void dump_symtab(void);
++int makefrac(char *s);
++void reset_psects(void);
++void psect_summary(void);
++void summarize(struct psect *pp);
++struct psect *find_psect(char *name);
++void set_psect(struct psect *pp);
++struct psect *new_psect(char *name, int seg, unsigned int bottom,
++			unsigned int top);
++
+ int pass;
+ int error, warning;
+ extern unsigned int pc;
+@@ -39,11 +51,8 @@ BOOL list_includes = FALSE;
+ FILE *obj = NULL;
+ extern BOOL list_on;
+ BOOL list_on_next = TRUE;
+-char *alloc();
+ 
+-main(argc,argv)
+-int argc;
+-char *argv[];
++int main(int argc, char *argv[])
+ {
+ 	int i;
+ 	extern char *optarg;
+@@ -98,8 +107,7 @@ struct inc inc[MAX_NEST];
+ int inc_p = 0;
+ FILE *yyin;
+ 
+-include(file)
+-char *file;
++void include(char *file)
+ {
+ 	FILE *fp = open_read(file);
+ 
+@@ -131,7 +139,7 @@ char *file;
+ #endif
+ }
+ 
+-yywrap()
++BOOL yywrap(void)
+ {
+ 	fclose(inc[inc_p].fp);
+ 	inc_p--;
+@@ -147,10 +155,9 @@ yywrap()
+ }
+ 
+ struct n
+-sym_ref(sym)		/* return symbol value or UNDEF if not defined yet */
+-char *sym;
++sym_ref(char *sym)	/* return symbol value or UNDEF if not defined yet */
+ {
+-	struct sym *sp, *find_sym();
++	struct sym *sp;
+ 	struct n result;
+ 
+ 	result.type = UNDEF;
+@@ -172,14 +179,9 @@ char *sym;
+ 
+ struct sym *symtab[HASHSIZE];
+ 
+-sym_def(sym, type, seg, i, f)
+-char *sym;
+-int type;
+-int seg;
+-int i;
+-double f;
++void sym_def(char *sym, int type, int seg, int i, double f)
+ {
+-	struct sym *sp, **stop, *find_sym();
++	struct sym *sp, **stop;
+ 
+ 	if(pass == 1) {
+ 		if(find_sym(sym)) {
+@@ -210,8 +212,7 @@ double f;
+ 	}		
+ }
+ 
+-struct sym *find_sym(sym)
+-char *sym;
++struct sym *find_sym(char *sym)
+ {
+ 	struct sym *sp, **stop;
+ 
+@@ -224,7 +225,7 @@ char *sym;
+ }
+ 
+ extern char segs[];
+-dump_symtab()
++void dump_symtab(void)
+ {
+ 	struct sym *sp, **stop;
+ 	int i;
+@@ -250,8 +251,7 @@ SSSSSSSSSSSSSSSS S DDDDDDDDD.DDDDDDDDDD
+ 	}   
+ }
+ 
+-char *printcode(word)
+-int word;
++char *printcode(int word)
+ {
+ 	static char list[MAX], *lp;
+ 	int i;
+@@ -278,24 +278,21 @@ char *spacespace[2] = {
+  "              ",
+ /*P:XXXX_XXXXXX(XXXX_XXXX_XXXX_XXXX_XXXX_XXXX)_*/
+  "                                             "};
+-char *spaces(n)
+-int n;
++char *spaces(int n)
+ {
+ 	return spacespace[binary_listing ? 1 : 0] + n;
+ }
+ 
+ extern char segs[];
+ 
+-gencode(seg, pc, word)
+-int seg, pc, word;
++void gencode(int seg, int pc, int word)
+ {
+ 	fprintf(obj, "%c %04X %06X\n", segs[seg], pc, word & 0xFFFFFF);
+ }
+ 
+ char fixbuf[1024];
+ 
+-char *fixstring(s)
+-char *s;
++char *fixstring(char *s)
+ {
+ 	char *bp = fixbuf;
+ 	int ival;
+@@ -335,8 +332,7 @@ char *s;
+ 
+ #define ONE 0x4000000
+ 
+-makefrac(s)
+-char *s;
++int makefrac(char *s)
+ {
+ 	int frac = 0, div = 1;
+ 	int scale = 1;
+@@ -364,7 +360,7 @@ char *s;
+ 
+ struct psect *ptop = NULL, *cur_psect = NULL;
+ 
+-reset_psects()
++void reset_psects(void)
+ {
+ 	struct psect *pp;
+ 
+@@ -375,7 +371,7 @@ reset_psects()
+ 	set_psect(NULL);
+ }
+ 
+-psect_summary()
++void psect_summary(void)
+ {
+ 	printf("\nSummary of psect usage\n\n");
+ 
+@@ -390,8 +386,7 @@ SSSSSSSSSSSSSSSSSSSSSSSS  X  FFFF FFFF F
+ 	printf("\n");
+ }
+ 
+-summarize(pp)
+-struct psect *pp;
++void summarize(struct psect *pp)
+ {
+ 	int used, avail, of;
+ 
+@@ -410,8 +405,7 @@ struct psect *pp;
+ 		of);
+ }
+ 
+-struct psect *find_psect(name)
+-char *name;
++struct psect *find_psect(char *name)
+ {
+ 	struct psect *pp;
+ 
+@@ -422,15 +416,12 @@ char *name;
+ 	return NULL;
+ }
+ 
+-set_psect(pp)
+-struct psect *pp;
++void set_psect(struct psect *pp)
+ {
+ 	cur_psect = pp;
+ }
+ 
+-check_psect(seg, pc)
+-int seg;
+-unsigned int pc;
++BOOL check_psect(int seg, unsigned int pc)
+ {
+ 	if(cur_psect) {
+ 		if(seg == cur_psect->seg && pc >= cur_psect->bottom && 
+@@ -445,10 +436,8 @@ unsigned int pc;
+ 	}
+ }
+ 
+-struct psect *new_psect(name, seg, bottom, top)
+-char *name;
+-int seg;
+-unsigned int bottom, top;
++struct psect *new_psect(char *name, int seg, unsigned int bottom,
++			unsigned int top)
+ {
+ 	struct psect *pp = find_psect(name);
+ 
+--- a/subs.c
++++ b/subs.c
+@@ -26,14 +26,13 @@ static char *Copyright = "Copyright (C)
+  *
+  */
+ 
++#include <stdarg.h>
++
+ #include "a56.h"
+ 
+ #define MAX 1024
+ 
+-char *alloc();
+-
+-FILE *open_read(file)
+-char *file;
++FILE *open_read(char *file)
+ {
+ 	FILE *fp;
+ 
+@@ -46,8 +45,7 @@ char *file;
+ 	return fp;
+ }
+ 
+-FILE *open_write(file)
+-char *file;
++FILE *open_write(char *file)
+ {
+ 	FILE *fp;
+ 	if ((fp = fopen(file, "w")) == NULL) {
+@@ -57,8 +55,7 @@ char *file;
+ 	return fp;
+ }
+ 
+-FILE *open_append(file)
+-char *file;
++FILE *open_append(char *file)
+ {
+ 	FILE *fp;
+ 	if ((fp = fopen(file, "a")) == NULL) {
+@@ -68,26 +65,25 @@ char *file;
+ 	return fp;
+ }
+ 
+-fatal(c, a1, a2, a3, a4, a5, a6, a7, a8)
+-char *c, *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8;
++void fatal(char *c, ...)
+ {
+-	fprintf(stderr, c, a1, a2, a3, a4, a5, a6, a7, a8);
++	va_list ap;
++
++	va_start(ap, c);
++	vfprintf(stderr, c, ap);
+ 	exit(1);
+ }
+ 
+ #define TABS 8
+ #define MAX_BUF 256
+ 
+-char tabbuf[MAX_BUF], *untabn();
+-char *untab(s)	/* expand tabs in s */
+-register char *s;
++char tabbuf[MAX_BUF];
++char *untab(register char *s)	/* expand tabs in s */
+ {
+ 	return untabn(s, TABS);
+ }
+ 
+-char *untabn(s, stops)	/* expand tabs in s */
+-register char *s;
+-register int stops;
++char *untabn(register char *s, register int stops)	/* expand tabs in s */
+ {
+ 	char *o = s;
+ 
+@@ -117,8 +113,7 @@ register int stops;
+ 	return o;
+ }
+ 
+-char *alloc(size)
+-int size;
++char *alloc(int size)
+ {
+ 	char *p = (char *)malloc(size);
+ 	if(NOT p)
+--- a/toomf.c
++++ b/toomf.c
+@@ -33,9 +33,7 @@ static char *Copyright = "Copyright (C)
+ 
+ #define MAX 256
+ 
+-main(argc,argv)
+-int argc;
+-char *argv[];
++int main(int argc, char **argv)
+ {
+ 	char buf[MAX];
+ 	int curaddr = 0;
diff -Nru a56-1.3+dfsg/debian/rules a56-1.3+dfsg/debian/rules
--- a56-1.3+dfsg/debian/rules	2024-01-13 23:00:00.000000000 +0100
+++ a56-1.3+dfsg/debian/rules	2024-07-27 02:38:09.000000000 +0200
@@ -6,6 +6,7 @@
 export DH_OPTIONS
 
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+export DEB_CFLAGS_MAINT_APPEND = -Wall -Wextra -Wno-comment -Wno-parentheses -Wno-unused-variable
 
 %:
 	dh $@ --no-parallel

Attachment: signature.asc
Description: PGP signature

Reply via email to