bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/3] maint: be compilable with GCC 4.0


From: Akim Demaille
Subject: [PATCH 1/3] maint: be compilable with GCC 4.0
Date: Fri, 26 Oct 2012 14:33:11 +0200

The "shadows a global declaration" warning in GCC 4.0 was a bit
annoying.  It does not like that a type name be used in a prototype of
a function (not the implementation, just the declaration):

  In file included from src/LR0.c:38:
  src/reader.h:56: warning: declaration of 'named_ref' shadows a
                            global declaration
  src/named-ref.h:35: warning: shadowed declaration is here

It does not like either when a global variable name is used in a
prototype.  Flex 2.5.37 generates this prototype:

  void gram_set_debug (int debug_flag  );

* src/getargs.h, src/getargs.c (debug_flag): Rename as...
(debug): this.
Adjust dependencies.
* src/reader.h: Don't use "named_ref" as a formal argument name.
---
 src/getargs.c    | 4 ++--
 src/getargs.h    | 2 +-
 src/output.c     | 2 +-
 src/parse-gram.y | 2 +-
 src/reader.h     | 4 ++--
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/getargs.c b/src/getargs.c
index 70a25e0..6490569 100644
--- a/src/getargs.c
+++ b/src/getargs.c
@@ -49,7 +49,7 @@
 #include "quote.h"
 #include "uniqstr.h"
 
-bool debug_flag;
+bool debug;
 bool defines_flag;
 bool graph_flag;
 bool xml_flag;
@@ -664,7 +664,7 @@ getargs (int argc, char *argv[])
        break;
 
       case 't':
-       debug_flag = true;
+       debug = true;
        break;
 
       case 'v':
diff --git a/src/getargs.h b/src/getargs.h
index 22538cf..ef97822 100644
--- a/src/getargs.h
+++ b/src/getargs.h
@@ -34,7 +34,7 @@ extern int skeleton_prio;
 /* for -I */
 extern char const *include;
 
-extern bool debug_flag;                        /* for -t */
+extern bool debug;                     /* for -t */
 extern bool defines_flag;              /* for -d */
 extern bool graph_flag;                        /* for -g */
 extern bool xml_flag;                  /* for -x */
diff --git a/src/output.c b/src/output.c
index e77a2d1..4a4d62d 100644
--- a/src/output.c
+++ b/src/output.c
@@ -628,7 +628,7 @@ prepare (void)
     use_push_for_pull_flag = true;
 
   /* Flags. */
-  MUSCLE_INSERT_BOOL ("debug_flag", debug_flag);
+  MUSCLE_INSERT_BOOL ("debug_flag", debug);
   MUSCLE_INSERT_BOOL ("defines_flag", defines_flag);
   MUSCLE_INSERT_BOOL ("error_verbose_flag", error_verbose);
   MUSCLE_INSERT_BOOL ("glr_flag", glr_parser);
diff --git a/src/parse-gram.y b/src/parse-gram.y
index 6a49923..5f77a5b 100644
--- a/src/parse-gram.y
+++ b/src/parse-gram.y
@@ -252,7 +252,7 @@ prologue_declaration:
                         plain_code.code, @1);
       code_scanner_last_string_free ();
     }
-| "%debug"                         { debug_flag = true; }
+| "%debug"                         { debug = true; }
 | "%define" variable content.opt
     {
       muscle_percent_define_insert ($2, @2, $3,
diff --git a/src/reader.h b/src/reader.h
index 3722a7f..e154deb 100644
--- a/src/reader.h
+++ b/src/reader.h
@@ -51,9 +51,9 @@ void grammar_current_rule_prec_set (symbol *precsym, location 
loc);
 void grammar_current_rule_dprec_set (int dprec, location loc);
 void grammar_current_rule_merge_set (uniqstr name, location loc);
 void grammar_current_rule_symbol_append (symbol *sym, location loc,
-                                        named_ref *named_ref);
+                                        named_ref *nref);
 void grammar_current_rule_action_append (const char *action, location loc,
-                                        named_ref *named_ref);
+                                        named_ref *nref);
 void reader (void);
 void free_merger_functions (void);
 
-- 
1.7.12.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]