[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
patch to yacc.c and lalr1.cc to avoid warning with pgcc 5.2-1
From: |
Paul Eggert |
Subject: |
patch to yacc.c and lalr1.cc to avoid warning with pgcc 5.2-1 |
Date: |
Fri, 07 Jan 2005 21:24:57 -0800 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
http://lists.gnu.org/archive/html/bug-bison/2005-01/msg00025.html
contains this diagnostic:
"input.cc", line 468: warning: label "yyerrorlab" was declared but never
referenced
yyerrorlab:
^
apparently because pgcc 5.2-1 behaves like CC with respect to the warning,
but it doesn't define __GNUC__. I installed the following patch to work
around this:
2005-01-07 Paul Eggert <address@hidden>
* data/yacc.c (yyparse): Pacify non-GCC compilers about yyerrorlab
being defined and not used.
* data/lalr1.cc (yyparse): Likewise.
Use "if (false)" rather than "if (0)".
Index: data/yacc.c
===================================================================
RCS file: /cvsroot/bison/bison/data/yacc.c,v
retrieving revision 1.79
diff -p -u -r1.79 yacc.c
--- data/yacc.c 22 Dec 2004 21:19:47 -0000 1.79
+++ data/yacc.c 8 Jan 2005 05:21:21 -0000
@@ -1,7 +1,8 @@
m4_divert(-1) -*- C -*-
# Yacc compatible skeleton for Bison
-# Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004
+
+# Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
@@ -1170,12 +1171,11 @@ yyerrlab:
`---------------------------------------------------*/
yyerrorlab:
-#ifdef __GNUC__
- /* Pacify GCC when the user code never invokes YYERROR and the label
- yyerrorlab therefore never appears in user code. */
+ /* Pacify compilers like GCC when the user code never invokes
+ YYERROR and the label yyerrorlab therefore never appears in user
+ code. */
if (0)
goto yyerrorlab;
-#endif
]b4_location_if([[ yyerror_range[0] = yylsp[1-yylen];
yylsp -= yylen;
Index: data/lalr1.cc
===================================================================
RCS file: /cvsroot/bison/bison/data/lalr1.cc,v
retrieving revision 1.80
diff -p -u -r1.80 lalr1.cc
--- data/lalr1.cc 26 Dec 2004 05:42:27 -0000 1.80
+++ data/lalr1.cc 8 Jan 2005 05:21:21 -0000
@@ -1,6 +1,8 @@
m4_divert(-1)
+
# C++ skeleton for Bison
-# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+
+# Copyright (C) 2002, 2003, 2004, 2005 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
@@ -747,12 +749,11 @@ yyerrlab:
`---------------------------------------------------*/
yyerrorlab:
-#ifdef __GNUC__
- /* Pacify GCC when the user code never invokes YYERROR and the label
- yyerrorlab therefore never appears in user code. */
- if (0)
+ /* Pacify compilers like GCC when the user code never invokes
+ YYERROR and the label yyerrorlab therefore never appears in user
+ code. */
+ if (false)
goto yyerrorlab;
-#endif
yyerror_range_[0] = yylocation_stack_[yylen_ - 1];
yypop_ (yylen_);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- patch to yacc.c and lalr1.cc to avoid warning with pgcc 5.2-1,
Paul Eggert <=