aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Muller <muller@sourceware.org>2002-06-21 14:32:10 +0000
committerPierre Muller <muller@sourceware.org>2002-06-21 14:32:10 +0000
commitf461f5cf7932cc292cafd659b4bc101967f96dee (patch)
tree70e73ce75d2927180bd2f3555f7478a75d74d4ce
parent19d833a2fa6c344238385c4edadb3ffdb9c71509 (diff)
downloadgdb-f461f5cf7932cc292cafd659b4bc101967f96dee.zip
gdb-f461f5cf7932cc292cafd659b4bc101967f96dee.tar.gz
gdb-f461f5cf7932cc292cafd659b4bc101967f96dee.tar.bz2
2002-06-19 Pierre Muller <muller@ics.u-strasbg.fr>
* parse.c (parse_fprintf): New function used to avoid calls to fprintf in bison parser generated debug code. * parser-defs.h: Declaration of new parse_fprintf function. * ada-exp.y, c-exp.y, f-exp.y, jv-exp.y, m2-exp.y, p-exp.y: Set YYDEBUG to 1 by default. Set YYFPRINTF as parse_fprintf.
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/ada-exp.y4
-rw-r--r--gdb/c-exp.y4
-rw-r--r--gdb/f-exp.y4
-rw-r--r--gdb/jv-exp.y4
-rw-r--r--gdb/m2-exp.y4
-rw-r--r--gdb/p-exp.y4
-rw-r--r--gdb/parse.c17
-rw-r--r--gdb/parser-defs.h5
9 files changed, 49 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 141b88f..074b58704 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2002-06-19 Pierre Muller <muller@ics.u-strasbg.fr>
+
+ * parse.c (parse_fprintf): New function used to avoid calls to
+ fprintf in bison parser generated debug code.
+ * parser-defs.h: Declaration of new parse_fprintf function.
+ * ada-exp.y, c-exp.y, f-exp.y, jv-exp.y, m2-exp.y, p-exp.y:
+ Set YYDEBUG to 1 by default.
+ Set YYFPRINTF as parse_fprintf.
+
2002-06-21 Michal Ludvig <mludvig@suse.cz>
* dwarf2cfi.c (read_encoded_pointer): Don't handle pointer
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index 7d46dd2..67185a3 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -92,9 +92,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define yytoks ada_toks /* With YYDEBUG defined */
#ifndef YYDEBUG
-#define YYDEBUG 0 /* Default to no yydebug support */
+#define YYDEBUG 1 /* Default to yydebug support */
#endif
+#define YYFPRINTF parser_fprintf
+
struct name_info {
struct symbol* sym;
struct minimal_symbol* msym;
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index f555518..ea50836 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -100,9 +100,11 @@ extern int hp_som_som_object_present;
#define yycheck c_yycheck
#ifndef YYDEBUG
-#define YYDEBUG 0 /* Default to no yydebug support */
+#define YYDEBUG 1 /* Default to yydebug support */
#endif
+#define YYFPRINTF parser_fprintf
+
int yyparse (void);
static int yylex (void);
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index e1168772..a26f019 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -102,9 +102,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define yycheck f_yycheck
#ifndef YYDEBUG
-#define YYDEBUG 1 /* Default to no yydebug support */
+#define YYDEBUG 1 /* Default to yydebug support */
#endif
+#define YYFPRINTF parser_fprintf
+
int yyparse (void);
static int yylex (void);
diff --git a/gdb/jv-exp.y b/gdb/jv-exp.y
index 495bf3e..f95de24 100644
--- a/gdb/jv-exp.y
+++ b/gdb/jv-exp.y
@@ -96,9 +96,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define yycheck java_yycheck
#ifndef YYDEBUG
-#define YYDEBUG 0 /* Default to no yydebug support */
+#define YYDEBUG 1 /* Default to yydebug support */
#endif
+#define YYFPRINTF parser_fprintf
+
int yyparse (void);
static int yylex (void);
diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y
index 772c6b7..707c9e2 100644
--- a/gdb/m2-exp.y
+++ b/gdb/m2-exp.y
@@ -98,9 +98,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define yycheck m2_yycheck
#ifndef YYDEBUG
-#define YYDEBUG 0 /* Default to no yydebug support */
+#define YYDEBUG 1 /* Default to yydebug support */
#endif
+#define YYFPRINTF parser_fprintf
+
int yyparse (void);
static int yylex (void);
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index 7333f6d..fbdd3f6 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -104,9 +104,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define yycheck pascal_yycheck
#ifndef YYDEBUG
-#define YYDEBUG 0 /* Default to no yydebug support */
+#define YYDEBUG 1 /* Default to yydebug support */
#endif
+#define YYFPRINTF parser_fprintf
+
int yyparse (void);
static int yylex (void);
diff --git a/gdb/parse.c b/gdb/parse.c
index bc81f22..c5de0af 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -1366,6 +1366,23 @@ build_parse (void)
NULL);
}
+/* This function avoids direct calls to fprintf
+ in the parser generated debug code. */
+void
+parser_fprintf (FILE *x, const char *y, ...)
+{
+ va_list args;
+ va_start (args, y);
+ if (x == stderr)
+ vfprintf_unfiltered (gdb_stderr, y, args);
+ else
+ {
+ fprintf_unfiltered (gdb_stderr, " Unknown FILE used.\n");
+ vfprintf_unfiltered (gdb_stderr, y, args);
+ }
+ va_end (args);
+}
+
void
_initialize_parse (void)
{
diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h
index 7db1c77e..062c34d 100644
--- a/gdb/parser-defs.h
+++ b/gdb/parser-defs.h
@@ -216,4 +216,9 @@ struct op_print
extern int target_map_name_to_register (char *, int);
+/* Function used to avoid direct calls to fprintf
+ in the code generated by the bison parser. */
+
+extern void parser_fprintf (FILE *, const char *, ...) ATTR_FORMAT (printf, 2 ,3);
+
#endif /* PARSER_DEFS_H */