]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Make c-exp.y work with Bison 3.8+
authorChristian Biesinger <cbiesinger@google.com>
Fri, 8 Oct 2021 20:09:46 +0000 (16:09 -0400)
committerLuis Machado <luis.machado@arm.com>
Mon, 20 Jun 2022 10:36:47 +0000 (11:36 +0100)
When using Bison 3.8, we get this error:

    ../../gdb/c-exp.y:3455:1: error: 'void c_print_token(FILE*, int, YYSTYPE)' defined but not used [-Werror=unused-function]

That's because bison 3.8 removed YYPRINT support:
https://savannah.gnu.org/forum/forum.php?forum_id=10047

Accordingly, this patch only defines that function for Bison < 3.8.

Change-Id: I3cbf2f317630bb72810b00f2d9b2c4b99fa812ad

gdb/c-exp.y

index 17f317b2e68f117aed7d13815ed8a7101265f6f9..a669f1ae95f067386ff08b543cfd3a962f1c9c06 100644 (file)
@@ -167,7 +167,7 @@ static void check_parameter_typelist (std::vector<struct type *> *);
 static void write_destructor_name (struct parser_state *par_state,
                                   struct stoken);
 
-#ifdef YYBISON
+#if defined(YYBISON) && YYBISON < 30800
 static void c_print_token (FILE *file, int type, YYSTYPE value);
 #define YYPRINT(FILE, TYPE, VALUE) c_print_token (FILE, TYPE, VALUE)
 #endif
@@ -3429,7 +3429,8 @@ c_parse (struct parser_state *par_state)
   return yyparse ();
 }
 
-#ifdef YYBISON
+#if defined(YYBISON) && YYBISON < 30800
+
 
 /* This is called via the YYPRINT macro when parser debugging is
    enabled.  It prints a token's value.  */