From 2cec9080f685192e231333686b411fb524239a1b Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 9 Dec 2005 23:51:26 +0000 Subject: [PATCH] Work around portability problem on Solaris 10: flex-generated files include before , which messes up because the latter defines __EXTENSIONS__. Address the problem by creating two new little files that include first, then include the flex-generated files. Rewrite everyone else to include first, as well. * lib/timevar.c: Always include "config.h". * src/Makefile.am (bison_SOURCES): Replace scan-gram.l with scan-gram-c.c, and scan-skel.l with scan-skel-c.c. (EXTRA_bison_SOURCES): New macro. * src/scan-gram-c.c, src/scan-skel-c.c: New files. * src/system.h: Don't include config.h. * src/LR0.c: Include first. * src/assoc.c: Likewise. * src/closure.c: Likewise. * src/complain.c: Likewise. * src/conflicts.c: Likewise. * src/derives.c: Likewise. * src/files.c: Likewise. * src/getargs.c: Likewise. * src/gram.c: Likewise. * src/lalr.c: Likewise. * src/location.c: Likewise. * src/main.c: Likewise. * src/muscle_tab.c: Likewise. * src/nullable.c: Likewise. * src/output.c: Likewise. * src/parse-gram.y: Likewise. * src/print.c: Likewise. * src/print_graph.c: Likewise. * src/reader.c: Likewise. * src/reduce.c: Likewise. * src/relation.c: Likewise. * src/state.c: Likewise. * src/symlist.c: Likewise. * src/symtab.c: Likewise. * src/tables.c: Likewise. * src/uniqstr.c: Likewise. * src/vcg.c: Likewise. --- ChangeLog | 40 ++++++++++++++++++++++++++++++++++++++++ lib/timevar.c | 5 +++-- src/LR0.c | 1 + src/Makefile.am | 6 ++++-- src/assoc.c | 3 ++- src/closure.c | 5 +++-- src/complain.c | 4 +++- src/conflicts.c | 1 + src/derives.c | 6 +++--- src/files.c | 2 +- src/getargs.c | 1 + src/gram.c | 6 +++--- src/lalr.c | 3 ++- src/location.c | 4 +++- src/main.c | 2 +- src/muscle_tab.c | 1 + src/nullable.c | 3 ++- src/output.c | 2 +- src/parse-gram.y | 1 + src/print.c | 4 ++-- src/print_graph.c | 1 + src/reader.c | 1 + src/reduce.c | 5 +++-- src/relation.c | 1 + src/state.c | 2 +- src/symlist.c | 1 + src/symtab.c | 2 +- src/system.h | 4 ---- src/tables.c | 2 +- src/uniqstr.c | 1 + src/vcg.c | 1 + 31 files changed, 90 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5d03a68f..292460fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,45 @@ 2005-12-09 Paul Eggert + Work around portability problem on Solaris 10: flex-generated + files include before , which messes up + because the latter defines __EXTENSIONS__. Address the problem + by creating two new little files that include first, + then include the flex-generated files. Rewrite everyone else + to include first, as well. + * lib/timevar.c: Always include "config.h". + * src/Makefile.am (bison_SOURCES): Replace scan-gram.l with + scan-gram-c.c, and scan-skel.l with scan-skel-c.c. + (EXTRA_bison_SOURCES): New macro. + * src/scan-gram-c.c, src/scan-skel-c.c: New files. + * src/system.h: Don't include config.h. + * src/LR0.c: Include first. + * src/assoc.c: Likewise. + * src/closure.c: Likewise. + * src/complain.c: Likewise. + * src/conflicts.c: Likewise. + * src/derives.c: Likewise. + * src/files.c: Likewise. + * src/getargs.c: Likewise. + * src/gram.c: Likewise. + * src/lalr.c: Likewise. + * src/location.c: Likewise. + * src/main.c: Likewise. + * src/muscle_tab.c: Likewise. + * src/nullable.c: Likewise. + * src/output.c: Likewise. + * src/parse-gram.y: Likewise. + * src/print.c: Likewise. + * src/print_graph.c: Likewise. + * src/reader.c: Likewise. + * src/reduce.c: Likewise. + * src/relation.c: Likewise. + * src/state.c: Likewise. + * src/symlist.c: Likewise. + * src/symtab.c: Likewise. + * src/tables.c: Likewise. + * src/uniqstr.c: Likewise. + * src/vcg.c: Likewise. + * src/parse-gram.y: Fix minor problems uncovered by lint. (current_lhs, current_lhs_location): Now static. (current_assoc): Remove unused variable. diff --git a/lib/timevar.c b/lib/timevar.c index d647687f..33eec0d8 100644 --- a/lib/timevar.c +++ b/lib/timevar.c @@ -1,5 +1,5 @@ /* Timing variables for measuring compiler performance. - Copyright (C) 2000, 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2004, 2005 Free Software Foundation, Inc. Contributed by Alex Samuel This file is part of Bison, the GNU Compiler Compiler. @@ -19,9 +19,10 @@ along with Bison; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "config.h" + #if IN_GCC -#include "config.h" #include "system.h" #include "intl.h" #include "rtl.h" diff --git a/src/LR0.c b/src/LR0.c index 2cba955a..259b8912 100644 --- a/src/LR0.c +++ b/src/LR0.c @@ -24,6 +24,7 @@ /* See comments in state.h for the data structures that represent it. The entry point is generate_states. */ +#include #include "system.h" #include diff --git a/src/Makefile.am b/src/Makefile.am index 4fc07a29..c973e9e7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -53,8 +53,8 @@ bison_SOURCES = \ reader.c reader.h \ reduce.c reduce.h \ relation.c relation.h \ - scan-gram.l \ - scan-skel.h scan-skel.l \ + scan-gram-c.c \ + scan-skel-c.c scan-skel.h \ state.c state.h \ symlist.c symlist.h \ symtab.c symtab.h \ @@ -64,6 +64,8 @@ bison_SOURCES = \ vcg.c vcg.h \ vcg_defaults.h +EXTRA_bison_SOURCES = scan-skel.l scan-gram.l + BUILT_SOURCES = scan-skel.c scan-gram.c parse-gram.c parse-gram.h MOSTLYCLEANFILES = yacc diff --git a/src/assoc.c b/src/assoc.c index b816499c..479abd8c 100644 --- a/src/assoc.c +++ b/src/assoc.c @@ -1,5 +1,5 @@ /* Associativity information. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -18,6 +18,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include #include "system.h" #include "assoc.h" diff --git a/src/closure.c b/src/closure.c index eb53ee05..001b8316 100644 --- a/src/closure.c +++ b/src/closure.c @@ -1,7 +1,7 @@ /* Closures for Bison - Copyright (C) 1984, 1989, 2000, 2001, 2002, 2004 Free Software - Foundation, Inc. + Copyright (C) 1984, 1989, 2000, 2001, 2002, 2004, 2005 Free + Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -20,6 +20,7 @@ Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include #include "system.h" #include diff --git a/src/complain.c b/src/complain.c index 4769df5c..927dbb63 100644 --- a/src/complain.c +++ b/src/complain.c @@ -1,5 +1,6 @@ /* Declaration for error-reporting function for Bison. - Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation, Inc. + + Copyright (C) 2000, 2001, 2002, 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 the @@ -19,6 +20,7 @@ /* Based on error.c and error.h, written by David MacKenzie . */ +#include #include "system.h" #include diff --git a/src/conflicts.c b/src/conflicts.c index 374c4010..a0296d67 100644 --- a/src/conflicts.c +++ b/src/conflicts.c @@ -20,6 +20,7 @@ Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include #include "system.h" #include diff --git a/src/derives.c b/src/derives.c index 24fde5d2..2e4ff31b 100644 --- a/src/derives.c +++ b/src/derives.c @@ -1,7 +1,7 @@ /* Match rules with nonterminals for bison, - Copyright (C) 1984, 1989, 2000, 2001, 2002, 2003 Free Software - Foundation, Inc. + Copyright (C) 1984, 1989, 2000, 2001, 2002, 2003, 2005 Free + Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -20,7 +20,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - +#include #include "system.h" #include "getargs.h" diff --git a/src/files.c b/src/files.c index 4acf9e89..5bc862d8 100644 --- a/src/files.c +++ b/src/files.c @@ -20,7 +20,7 @@ Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - +#include #include "system.h" #include diff --git a/src/getargs.c b/src/getargs.c index 2b6fa0fb..3d45a3c6 100644 --- a/src/getargs.c +++ b/src/getargs.c @@ -20,6 +20,7 @@ Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include #include "system.h" #include diff --git a/src/gram.c b/src/gram.c index 4636f4e1..cff87d7c 100644 --- a/src/gram.c +++ b/src/gram.c @@ -1,7 +1,7 @@ /* Allocate input grammar variables for Bison. - Copyright (C) 1984, 1986, 1989, 2001, 2002, 2003 Free Software - Foundation, Inc. + Copyright (C) 1984, 1986, 1989, 2001, 2002, 2003, 2005 Free + Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -20,7 +20,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - +#include #include "system.h" #include diff --git a/src/lalr.c b/src/lalr.c index 8627f1cb..e0fae49f 100644 --- a/src/lalr.c +++ b/src/lalr.c @@ -1,6 +1,6 @@ /* Compute look-ahead criteria for Bison. - Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2003, 2004 + Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -25,6 +25,7 @@ which rules need look-ahead in each state, and which look-ahead tokens they accept. */ +#include #include "system.h" #include diff --git a/src/location.c b/src/location.c index 8c235bbb..ecd3658b 100644 --- a/src/location.c +++ b/src/location.c @@ -1,5 +1,6 @@ /* Locations for Bison - Copyright (C) 2002 Free Software Foundation, Inc. + + Copyright (C) 2002, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -18,6 +19,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include #include "system.h" #include diff --git a/src/main.c b/src/main.c index 65db7ca1..8769fef8 100644 --- a/src/main.c +++ b/src/main.c @@ -20,7 +20,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - +#include #include "system.h" #include diff --git a/src/muscle_tab.c b/src/muscle_tab.c index 3e0fb289..c8c5c79d 100644 --- a/src/muscle_tab.c +++ b/src/muscle_tab.c @@ -20,6 +20,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include #include "system.h" #include diff --git a/src/nullable.c b/src/nullable.c index e73344f8..ef65ef46 100644 --- a/src/nullable.c +++ b/src/nullable.c @@ -1,6 +1,6 @@ /* Calculate which nonterminals can expand into the null string for Bison. - Copyright (C) 1984, 1989, 2000, 2001, 2002, 2003, 2004 Free + Copyright (C) 1984, 1989, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -25,6 +25,7 @@ the null string. NULLABLE[I - NTOKENS] is nonzero if symbol I can do so. */ +#include #include "system.h" #include "getargs.h" diff --git a/src/output.c b/src/output.c index 1f3bbcaa..c0be5b0b 100644 --- a/src/output.c +++ b/src/output.c @@ -20,7 +20,7 @@ Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - +#include #include "system.h" #include diff --git a/src/parse-gram.y b/src/parse-gram.y index bf6af663..d4f2731e 100644 --- a/src/parse-gram.y +++ b/src/parse-gram.y @@ -20,6 +20,7 @@ 02110-1301 USA */ +#include #include "system.h" #include "complain.h" diff --git a/src/print.c b/src/print.c index 533e3ca1..cb1600c9 100644 --- a/src/print.c +++ b/src/print.c @@ -1,6 +1,6 @@ /* Print information on generated parser, for bison, - Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2003, 2004 + Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -20,7 +20,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - +#include #include "system.h" #include diff --git a/src/print_graph.c b/src/print_graph.c index dc0f8306..9580f3f1 100644 --- a/src/print_graph.c +++ b/src/print_graph.c @@ -19,6 +19,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include #include "system.h" #include diff --git a/src/reader.c b/src/reader.c index 62f645b4..fed446ad 100644 --- a/src/reader.c +++ b/src/reader.c @@ -20,6 +20,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include #include "system.h" #include diff --git a/src/reduce.c b/src/reduce.c index a6b9e629..72ee3f8a 100644 --- a/src/reduce.c +++ b/src/reduce.c @@ -1,7 +1,7 @@ /* Grammar reduction for Bison. - Copyright (C) 1988, 1989, 2000, 2001, 2002, 2003 Free Software - Foundation, Inc. + Copyright (C) 1988, 1989, 2000, 2001, 2002, 2003, 2005 Free + Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -27,6 +27,7 @@ /* Don't eliminate unreachable terminals: They may be used by the user's parser. */ +#include #include "system.h" #include diff --git a/src/relation.c b/src/relation.c index da62af8f..1d2b42dd 100644 --- a/src/relation.c +++ b/src/relation.c @@ -18,6 +18,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include #include "system.h" #include diff --git a/src/state.c b/src/state.c index e78db69b..d7289a3b 100644 --- a/src/state.c +++ b/src/state.c @@ -19,7 +19,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - +#include #include "system.h" #include diff --git a/src/symlist.c b/src/symlist.c index 106db46c..7c3ebff6 100644 --- a/src/symlist.c +++ b/src/symlist.c @@ -19,6 +19,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include #include "system.h" #include "complain.h" diff --git a/src/symtab.c b/src/symtab.c index 8cbfc54f..634ddfa0 100644 --- a/src/symtab.c +++ b/src/symtab.c @@ -20,7 +20,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - +#include #include "system.h" #include diff --git a/src/system.h b/src/system.h index 369218cd..74639ec5 100644 --- a/src/system.h +++ b/src/system.h @@ -20,10 +20,6 @@ #ifndef BISON_SYSTEM_H #define BISON_SYSTEM_H -#if HAVE_CONFIG_H -# include -#endif - #include #include #include diff --git a/src/tables.c b/src/tables.c index 02d10f15..f88180e2 100644 --- a/src/tables.c +++ b/src/tables.c @@ -20,7 +20,7 @@ Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - +#include #include "system.h" #include diff --git a/src/uniqstr.c b/src/uniqstr.c index f082f338..8804a80e 100644 --- a/src/uniqstr.c +++ b/src/uniqstr.c @@ -19,6 +19,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include #include "system.h" #include diff --git a/src/vcg.c b/src/vcg.c index fa513388..643a1198 100644 --- a/src/vcg.c +++ b/src/vcg.c @@ -19,6 +19,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include #include "system.h" #include -- 2.45.2