This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Fix building with yacc
- From: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- To: gdb-patches at sourceware dot org
- Date: Mon, 3 Feb 2014 14:51:43 +0100 (CET)
- Subject: [PATCH] Fix building with yacc
- Authentication-results: sourceware.org; auth=none
OpenBSD yacc doesn't use YYPRINT, so we end up with gcc complaining
that c_print_token is defined but not used. As far as I can determine
YYPRINT is a bison-ism, so the diff below wraps c_print_token in
#ifdef YYBISON.
ok?
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 277242e..b76a06b 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -169,8 +169,10 @@ static struct stoken operator_stoken (const char *);
static void check_parameter_typelist (VEC (type_ptr) *);
static void write_destructor_name (struct stoken);
+#ifdef YYBISON
static void c_print_token (FILE *file, int type, YYSTYPE value);
#define YYPRINT(FILE, TYPE, VALUE) c_print_token (FILE, TYPE, VALUE)
+#endif
%}
%type <voidval> exp exp1 type_exp start variable qualified_name lcurly
@@ -3201,10 +3203,12 @@ c_parse (void)
return result;
}
+#ifdef YYBISON
+
/* This is called via the YYPRINT macro when parser debugging is
enabled. It prints a token's value. */
-static void
+void
c_print_token (FILE *file, int type, YYSTYPE value)
{
switch (type)
@@ -3255,6 +3259,8 @@ c_print_token (FILE *file, int type, YYSTYPE value)
}
}
+#endif
+
void
yyerror (char *msg)
{