bison-patches
[Top][All Lists]
Advanced

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

Re: bison configure


From: Paul Eggert
Subject: Re: bison configure
Date: Thu, 19 Jan 2006 16:10:12 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

twlevo <address@hidden> writes:

> ./configure CFLAGS="-O6 -Wall"
> ./configure --enable-gcc-warnings
> and there a very few details to fix, just a notice.

Thanks.  We don't bother to try to remove all the -Wall messages, but
--enable-gcc-warnings should work.  I also tried "make
maintainer-check" and found a few more glitches.  I installed this:

2006-01-19  Paul Eggert  <address@hidden>

        Minor fixups to get 'make maintainer-check' to work.
        * configure.ac: Don't use -Wnested-externs, as it's incompatible
        with the new verify.h implementation.
        * data/c.m4 (b4_yy_symbol_print_generate): YYUSE (yyoutput).
        * data/glr.c (YYUSE): Depend on __GNUC__ as well.
        * data/yacc.c (YYUSE): Likewise.
        * data/lalr1.cc (yysyntax_error_): YYUSE (yystate).
        * lib/subpipe.c (end_of_output_subpipe): The args are unused.
        * src/parse-gram.y (declaration): Don't pass a string constant
        to a function that expects char *, since GCC might complain
        about the constant value.
        * src/reader.c (symbol_typed_p): Add parens to pacify GCC.
        * tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): #undef yylloc and yylval
        before #defining them.
        * tests/glr-regression.at
        (Incorrectly initialized location for empty right-hand side in GLR):
        In yyerror, use the msg arg.
        (Corrupted semantic options if user action cuts parse):
        (Incorrect lookahead during deterministic GLR):
        (Incorrect lookahead during nondeterministic GLR):
        Don't name a local var 'index'; it shadows string.h's 'index'.

Index: configure.ac
===================================================================
RCS file: /cvsroot/bison/bison/configure.ac,v
retrieving revision 1.61
diff -p -u -r1.61 configure.ac
--- configure.ac        21 Oct 2005 09:13:00 -0000      1.61
+++ configure.ac        19 Jan 2006 23:58:23 -0000
@@ -1,6 +1,7 @@
 # Configure template for GNU Bison.                   -*-Autoconf-*-
 #
-# Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software
+# Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -58,7 +59,6 @@ if test "${enableval}" = yes; then
   BISON_WARNING(-Wbad-function-cast)
   BISON_WARNING(-Wmissing-declarations)
   BISON_WARNING(-Wmissing-prototypes)
-  BISON_WARNING(-Wnested-externs)
   BISON_WARNING(-Wshadow)
   BISON_WARNING(-Wstrict-prototypes)
   AC_DEFINE([lint], 1, [Define to 1 if the compiler is checking for lint.])
Index: data/c.m4
===================================================================
RCS file: /cvsroot/bison/bison/data/c.m4,v
retrieving revision 1.51
diff -p -u -r1.51 c.m4
--- data/c.m4   6 Jan 2006 20:09:31 -0000       1.51
+++ data/c.m4   19 Jan 2006 23:58:23 -0000
@@ -472,6 +472,8 @@ b4_parse_param_use[]dnl
 [# ifdef YYPRINT
   if (yytype < YYNTOKENS)
     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+# else
+  YYUSE (yyoutput);
 # endif
   switch (yytype)
     {
Index: data/glr.c
===================================================================
RCS file: /cvsroot/bison/bison/data/glr.c,v
retrieving revision 1.159
diff -p -u -r1.159 glr.c
--- data/glr.c  12 Jan 2006 01:43:03 -0000      1.159
+++ data/glr.c  19 Jan 2006 23:58:23 -0000
@@ -253,7 +253,7 @@ b4_syncline(address@hidden@], address@hidden@])
 #endif
 
 /* Suppress unused-variable warnings by "using" E.  */
-#ifndef lint
+#if !defined (lint) || defined (__GNUC__)
 # define YYUSE(e) ((void) (e))
 #else
 # define YYUSE(e) /* empty */
@@ -1103,7 +1103,7 @@ yynewGLRStackItem (yyGLRStack* yystackp,
 
 /** Add a new semantic action that will execute the action for rule
  *  RULENUM on the semantic values in RHS to the list of
- *  alternative actions for STATE.  Assumes that RHS comes from 
+ *  alternative actions for STATE.  Assumes that RHS comes from
  *  stack #K of *STACKP. */
 static void
 yyaddDeferredAction (yyGLRStack* yystackp, size_t yyk, yyGLRState* yystate,
@@ -1536,7 +1536,7 @@ yysplitStack (yyGLRStack* yystackp, size
       yybool* yynewLookaheadNeeds;
 
       yynewStates = NULL;
-      
+
       if (yystackp->yytops.yycapacity
          > (YYSIZEMAX / (2 * sizeof yynewStates[0])))
        yyMemoryExhausted (yystackp);
Index: data/lalr1.cc
===================================================================
RCS file: /cvsroot/bison/bison/data/lalr1.cc,v
retrieving revision 1.119
diff -p -u -r1.119 lalr1.cc
--- data/lalr1.cc       3 Jan 2006 20:25:54 -0000       1.119
+++ data/lalr1.cc       19 Jan 2006 23:58:23 -0000
@@ -829,6 +829,7 @@ b4_error_verbose_if([, yytoken])[));
 b4_error_verbose_if([, int tok])[)
   {
     std::string res;
+    YYUSE (yystate);
 #if YYERROR_VERBOSE
     int yyn = yypact_[yystate];
     if (yypact_ninf_ < yyn && yyn < yylast_)
Index: data/yacc.c
===================================================================
RCS file: /cvsroot/bison/bison/data/yacc.c,v
retrieving revision 1.129
diff -p -u -r1.129 yacc.c
--- data/yacc.c 4 Jan 2006 23:35:43 -0000       1.129
+++ data/yacc.c 19 Jan 2006 23:58:23 -0000
@@ -248,7 +248,7 @@ b4_syncline(address@hidden@], address@hidden@])[
 #endif
 
 /* Suppress unused-variable warnings by "using" E.  */
-#ifndef lint
+#if !defined (lint) || defined (__GNUC__)
 # define YYUSE(e) ((void) (e))
 #else
 # define YYUSE(e) /* empty */
Index: lib/subpipe.c
===================================================================
RCS file: /cvsroot/bison/bison/lib/subpipe.c,v
retrieving revision 1.8
diff -p -u -r1.8 subpipe.c
--- lib/subpipe.c       2 Oct 2005 16:59:19 -0000       1.8
+++ lib/subpipe.c       19 Jan 2006 23:58:23 -0000
@@ -1,6 +1,6 @@
 /* Subprocesses with pipes.
 
-   Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -71,6 +71,18 @@
 #include "gettext.h"
 #define _(Msgid)  gettext (Msgid)
 
+#ifndef __attribute__
+/* This feature is available in gcc versions 2.5 and later.  */
+# if !defined (__GNUC__) || __GNUC__ < 2 || \
+(__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
+#  define __attribute__(Spec) /* empty */
+# endif
+#endif
+
+#ifndef ATTRIBUTE_UNUSED
+# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+#endif
+
 
 /* Initialize this module.  */
 
@@ -168,6 +180,7 @@ reap_subpipe (pid_t pid, char const *pro
 }
 
 void
-end_of_output_subpipe (pid_t pid, int fd[2])
+end_of_output_subpipe (pid_t pid ATTRIBUTE_UNUSED,
+                      int fd[2] ATTRIBUTE_UNUSED)
 {
 }
Index: src/parse-gram.y
===================================================================
RCS file: /cvsroot/bison/bison/src/parse-gram.y,v
retrieving revision 1.68
diff -p -u -r1.68 parse-gram.y
--- src/parse-gram.y    3 Jan 2006 22:35:45 -0000       1.68
+++ src/parse-gram.y    19 Jan 2006 23:58:23 -0000
@@ -206,7 +206,11 @@ declaration:
   grammar_declaration
 | PROLOGUE                                 { prologue_augment ($1, @1); }
 | "%debug"                                 { debug_flag = true; }
-| "%define" string_content                 { muscle_insert ($2, "1"); }
+| "%define" string_content
+    {
+      static char one[] = "1";
+      muscle_insert ($2, one);
+    }
 | "%define" string_content string_content  { muscle_insert ($2, $3); }
 | "%defines"                               { defines_flag = true; }
 | "%error-verbose"                         { error_verbose = true; }
@@ -214,14 +218,14 @@ declaration:
 | "%expect-rr" INT                        { expected_rr_conflicts = $2; }
 | "%file-prefix" "=" string_content        { spec_file_prefix = $3; }
 | "%glr-parser"
-  {
-    nondeterministic_parser = true;
-    glr_parser = true;
-  }
+    {
+      nondeterministic_parser = true;
+      glr_parser = true;
+    }
 | "%initial-action {...}"
-  {
-    muscle_code_grow ("initial_action", $1, @1);
-  }
+    {
+      muscle_code_grow ("initial_action", $1, @1);
+    }
 | "%lex-param {...}"                      { add_param ("lex_param", $1, @1); }
 | "%locations"                             { locations_flag = true; }
 | "%name-prefix" "=" string_content        { spec_name_prefix = $3; }
Index: src/reader.c
===================================================================
RCS file: /cvsroot/bison/bison/src/reader.c,v
retrieving revision 1.248
diff -p -u -r1.248 reader.c
--- src/reader.c        18 Jan 2006 23:48:29 -0000      1.248
+++ src/reader.c        19 Jan 2006 23:58:23 -0000
@@ -221,7 +221,7 @@ static bool
 symbol_typed_p (const symbol_list *s)
 {
   return (s->sym->type_name
-         || s->midrule && s->midrule->used);
+         || (s->midrule && s->midrule->used));
 }
 
 /*----------------------------------------------------------------.
Index: tests/cxx-type.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/cxx-type.at,v
retrieving revision 1.31
diff -p -u -r1.31 cxx-type.at
--- tests/cxx-type.at   3 Jan 2006 19:12:55 -0000       1.31
+++ tests/cxx-type.at   19 Jan 2006 23:58:23 -0000
@@ -155,7 +155,9 @@ yylex (LEX_PARAMETERS)
   static int colNum = 0;
 
 #if YYPURE
+# undef yylloc
 # define yylloc (*llocp)
+# undef yylval
 # define yylval (*lvalp)
 #endif
 
Index: tests/glr-regression.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/glr-regression.at,v
retrieving revision 1.27
diff -p -u -r1.27 glr-regression.at
--- tests/glr-regression.at     12 Jan 2006 01:43:03 -0000      1.27
+++ tests/glr-regression.at     19 Jan 2006 23:58:24 -0000
@@ -240,7 +240,7 @@ AT_DATA_GRAMMAR([glr-regr3.y],
 #include <stdarg.h>
 
 static int MergeRule (int x0, int x1);
-static void yyerror(char const * s);
+static void yyerror (char const * s);
 int yylex (void);
 
 #define RULE(x) (1 << (x))
@@ -650,7 +650,7 @@ AT_DATA_GRAMMAR([glr-regr8.y],
   #include <stdlib.h>
   static void yyerror (char const *);
   static int yylex (void);
-  static void yyerror(const char *msg);
+  static void yyerror (char const *msg);
 %}
 
 %token T_CONSTANT
@@ -684,9 +684,10 @@ OptSignalWord      : /* empty */
 
 %%
 
-void yyerror(const char *msg)
+void
+yyerror (char const *msg)
 {
-  fprintf (stderr, "error\n");
+  fprintf (stderr, "%s\n", msg);
 }
 
 static int lexIndex;
@@ -856,9 +857,9 @@ yylex (void)
 int
 main (void)
 {
-  int index;
-  for (index = 0; index < GARBAGE_SIZE; index+=1)
-    garbage[index] = 108;
+  int i;
+  for (i = 0; i < GARBAGE_SIZE; i+=1)
+    garbage[i] = 108;
   return yyparse ();
 }
 ]])
@@ -1087,11 +1088,11 @@ static int
 yylex (void)
 {
   static char const *input = "ab";
-  static int index = 0;
+  static int i = 0;
   yylloc.first_line = yylloc.last_line = 1;
-  yylloc.first_column = yylloc.last_column = index+1;
-  yylval.value = input[index] + 'A' - 'a';
-  return input[index++];
+  yylloc.first_column = yylloc.last_column = i + 1;
+  yylval.value = input[i] + 'A' - 'a';
+  return input[i++];
 }
 
 static void
@@ -1293,11 +1294,11 @@ static int
 yylex (void)
 {
   static char const *input = "abcdddd";
-  static int index = 0;
+  static int i = 0;
   yylloc.first_line = yylloc.last_line = 1;
-  yylloc.first_column = yylloc.last_column = index+1;
-  yylval.value = input[index] + 'A' - 'a';
-  return input[index++];
+  yylloc.first_column = yylloc.last_column = i + 1;
+  yylval.value = input[i] + 'A' - 'a';
+  return input[i++];
 }
 
 static void




reply via email to

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