GCC 15 patch for a2ps

Adam Sampson <[email protected]> Fri, 11 Jul 2025 05:36:20 +0100
Newsgroups gmane.comp.printing.a2ps.bugs
Message-ID <[email protected]>
--ai/PdowKi6Fc7NnB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi a2ps maintainers,

Building a2ps with GCC 15 fails owing to some non-C23-friendly
prototypes in the two yacc parsers. I've attached the patch I use as a
workaround, but you might prefer to rework the prototypes instead...

Thanks very much,

-- 
Adam Sampson <[email protected]>                         <http://offog.org/>

--ai/PdowKi6Fc7NnB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=gcc-15.diff

Remove these debugging functions - the prototype is not C23.

--- a2ps-4.15.6/liba2ps/parseppd.y	2023-02-04 17:40:12.000000000 +0000
+++ a2ps-4.15.6/liba2ps/parseppd.y	2025-07-04 03:50:54.153566317 +0100
@@ -42,7 +42,6 @@
 
 #define YYDEBUG 1
 #define YYERROR_VERBOSE 1
-#define YYPRINT(file, type, value)   yyprint (file, type, value)
 
 /* Comes from the caller */
 extern FILE * ppdin;
@@ -50,7 +49,6 @@
 
 /* Local prototypes */
 void yyerror (const char *msg);
-static void yyprint ();
 
 /* Initilizes the obstacks */
 void ppdlex_initialize (void);
@@ -150,27 +148,6 @@
   error_at_line (1, 0, ppdfilename, ppdlineno, "%s", msg);
 }
 
-/*
- * For debugging
- */
-static void
-yyprint (FILE *file, int type, YYSTYPE value)
-{
-  switch (type) {
-  case STRING:
-    fprintf (file, " \"%s\"", value.string);
-    break;
-
-  case SYMBOL:
-    fprintf (file, " %s", value.string);
-    break;
-
-  case USTRING:
-    fprintf (file, " u\"%s\"", value.ustring);
-    break;
-  }
-}
-
 struct ppd *
 a2ps_ppd_parse (const char * filename, char * const * path)
 {
--- a2ps-4.15.6/src/parsessh.y	2024-03-13 13:29:27.000000000 +0000
+++ a2ps-4.15.6/src/parsessh.y	2025-07-04 03:51:17.561943754 +0100
@@ -42,7 +42,6 @@
 
 #define YYDEBUG 1
 #define YYERROR_VERBOSE 1
-#define YYPRINT(file, type, value)   yyprint (file, type, value)
 
 /* We need to use the same `const' as bison, to avoid the following
    prototypes to diverge from the function declarations */
@@ -63,7 +62,6 @@
 
 /* Local prototypes */
 void yyerror (const char *msg);
-static void yyprint ();
 
 /* Initilizes the obstacks */
 void sshlex_initialize (void);
@@ -728,36 +726,6 @@
   error_at_line (1, 0, sshfilename, sshlineno, "%s", msg);
 }
 
-/*
- * FIXME: Cover the other relevant types
- */
-static void
-yyprint (FILE *file, int type, YYSTYPE value)
-{
-  switch (type) {
-  case tBACK_REF:
-    fprintf (file, " \\%d", value.integer);
-    break;
-
-  case tFFLAGS:
-    putc (' ', file);
-    fflag_self_print (value.fflags, file);
-    break;
-
-  case tFACE:
-    fprintf (file, " %s", face_to_string (value.face));
-    break;
-
-  case tREGEX:
-    fprintf (file, " /%s/", value.pattern->pattern);
-    break;
-
-  case tSTRING:
-    fprintf (file, " \"%s\"", value.string);
-    break;
-  }
-}
-
 struct style_sheet *
 parse_style_sheet (const char * filename)
 {

--ai/PdowKi6Fc7NnB--