• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GCC with patches for Dreamcast


Commit MetaInfo

Revision307707f02e7df822ffccb03bc17bf7a62cfbd0b7 (tree)
Time2021-09-30 15:59:47
AuthorJakub Jelinek <jakub@redh...>
Commiteralaskanemily

Log Message

intl: Unbreak intl build with bison 3 when no regeneration is needed [PR92008]

As Iain reported, my change broke the case when one has bison >= 3,
but make decides there is no reason to regenerate plural.c, unfortunately
that seems to be a scenario I haven't tested. The problem is that
the pregenerated plural.c has been generated with bison 1.35, but when
config.h says HAVE_BISON3, the code assumes it is the bison3 variant.
What used to work fine is when one has bison >= 3 and plural.c has been
regenerated (e.g. do touch intl/plural.y and it will work), or when
one doesn't have any bison (then nothing is regenerated, but HAVE_BISON3
isn't defined either), or when one has bison < 3 and doesn't need to
regenerate, or when one has bison < 3 and it is regenerated.

The following patch fixes this, by killing the HAVE_BISON3 macro from
config.h, and instead remembering the fact whether plural.c has been created
with bison < 3 or bison >= 3 in a separate new plural-config.h header.
The way this works:
- user doesn't have bison
- user has bison >= 3, but intl/{plural-config.h,plural.c} aren't older than intl/plural.y
- user has bison < 3, but intl/{plural-config.h,plural.c} aren't older than intl/plural.y
pregenerated !USE_BISON3 plural.c and plural-config.h from source
dir is used, nothing in the objdir
- user has bison >= 3 and intl/plural.y is newer
Makefile generates plural.c and USE_BISON3 plural-config.h in the
objdir, which is then used in preference to srcdir copies
- user has bison < 3 and intl/plural.y is newer
Makefile generates plural.c and !USE_BISON3 plural-config.h in the
objdir, which is then used in preference to srcdir copies
I have tested all these cases and make all-yes worked in all the cases.
If one uses the unsupported ./configure where srcdir == objdir, I guess
(though haven't tested) that it should still work, just it would be nice
if such people didn't try to check in the plural{.c,-config.h} they have
regenerated.
What doesn't work, but didn't work before either (just tested gcc-9 branch
too) is when one doesn't have bison and plural.y is newer than plural.c.
Don't do that ;)

2020-04-16 Jakub Jelinek <jakub@redhat.com>

PR bootstrap/92008
intl/
* configure.ac: Remove HAVE_BISON3 AC_DEFINE.
* Makefile.in (HEADERS): Add plural-config.h.
(.y.c): Also create plural-config.h.
(dcigettext.o loadmsgcat.o plural.o plural-exp.o): Also depend
on plural-config.h.
(plural-config.h): Depend on plural.c.
* plural-exp.h: Include plural-config.h. Use USE_BISON3 instead
of HAVE_BISON3.
* plural.y: Use USE_BISON3 instead of HAVE_BISON3.
* configure: Regenerated.
* plural.c: Regenerated.
* config.h.in: Regenerated.
* plural-config.h: Generated.
contrib/
* gcc_update: Add intl/plural.y dependency for intl/plural-config.h.

Change Summary

Incremental Difference

--- a/contrib/gcc_update
+++ b/contrib/gcc_update
@@ -72,6 +72,7 @@ fixincludes/configure: fixincludes/configure.ac fixincludes/aclocal.m4
7272 fixincludes/config.h.in: fixincludes/configure.ac fixincludes/aclocal.m4
7373 # intl library
7474 intl/plural.c: intl/plural.y
75+intl/plural-config.h: intl/plural.y
7576 intl/configure: intl/configure.ac intl/aclocal.m4
7677 intl/config.h.in: intl/configure.ac intl/aclocal.m4
7778 # Now, proceed to gcc automatically generated files
--- a/intl/ChangeLog
+++ b/intl/ChangeLog
@@ -4,6 +4,21 @@
44 2020-04-16 Jakub Jelinek <jakub@redhat.com>
55
66 PR bootstrap/92008
7+ * configure.ac: Remove HAVE_BISON3 AC_DEFINE.
8+ * Makefile.in (HEADERS): Add plural-config.h.
9+ (.y.c): Also create plural-config.h.
10+ (dcigettext.o loadmsgcat.o plural.o plural-exp.o): Also depend
11+ on plural-config.h.
12+ (plural-config.h): Depend on plural.c.
13+ * plural-exp.h: Include plural-config.h. Use USE_BISON3 instead
14+ of HAVE_BISON3.
15+ * plural.y: Use USE_BISON3 instead of HAVE_BISON3.
16+ * configure: Regenerated.
17+ * plural.c: Regenerated.
18+ * config.h.in: Regenerated.
19+ * plural-config.h: Generated.
20+
21+ PR bootstrap/92008
722 * configure.ac: Add check for bison >= 3, AC_DEFINE HAVE_BISON3
823 and AC_SUBST BISON3_YES and BISON3_NO.
924 * Makefile.in (.y.c): Prefix $(YACC) invocation with @BISON3_NO@,
--- a/intl/Makefile.in
+++ b/intl/Makefile.in
@@ -57,6 +57,7 @@ HEADERS = \
5757 gettextP.h \
5858 hash-string.h \
5959 loadinfo.h \
60+ plural-config.h \
6061 plural-exp.h \
6162 eval-plural.h \
6263 localcharset.h \
@@ -133,10 +134,12 @@ libintl.h: $(srcdir)/libgnuintl.h
133134 $(COMPILE) $<
134135
135136 .y.c:
137+@BISON3_YES@ echo '#define USE_BISON3' > $(patsubst %.c,%-config.h,$@)
136138 @BISON3_YES@ sed 's,%pure_parser,,;s,^/\* BISON3 \(.*\) \*/$$,\1,' $< > $@.y
137139 @BISON3_YES@ $(YACC) $(YFLAGS) --output $@.c $@.y
138140 @BISON3_YES@ sed 's/\.c\.y"/.y"/' $@.c > $@
139141 @BISON3_YES@ rm -f $@.c $@.y $@.h
142+@BISON3_NO@ echo '/* #define USE_BISON3 */' > $(patsubst %.c,%-config.h,$@)
140143 @BISON3_NO@ $(YACC) $(YFLAGS) --output $@ $<
141144 rm -f $*.h
142145
@@ -165,7 +168,7 @@ dngettext.o finddomain.o gettext.o intl-compat.o loadmsgcat.o \
165168 localealias.o ngettext.o textdomain.o: gettextP.h gmo.h loadinfo.h
166169 dcigettext.o loadmsgcat.o: hash-string.h
167170 explodename.o l10nflist.o: loadinfo.h
168-dcigettext.o loadmsgcat.o plural.o plural-exp.o: plural-exp.h
171+dcigettext.o loadmsgcat.o plural.o plural-exp.o: plural-exp.h plural-config.h
169172 dcigettext.o: eval-plural.h
170173 localcharset.o: localcharset.h
171174 localealias.o localcharset.o relocatable.o: relocatable.h
@@ -242,6 +245,8 @@ $(srcdir)/aclocal.m4: @MAINT@ $(aclocal_deps)
242245 config.h: stamp-h1
243246 test -f config.h || (rm -f stamp-h1 && $(MAKE) stamp-h1)
244247
248+plural-config.h: plural.c
249+
245250 stamp-h1: $(srcdir)/config.h.in config.status
246251 -rm -f stamp-h1
247252 $(SHELL) ./config.status config.h
--- a/intl/config.h.in
+++ b/intl/config.h.in
@@ -28,9 +28,6 @@
2828 /* Define to 1 if you have the <argz.h> header file. */
2929 #undef HAVE_ARGZ_H
3030
31-/* Define if bison 3 or later is used. */
32-#undef HAVE_BISON3
33-
3431 /* Define if the GNU dcgettext() function is already present or preinstalled.
3532 */
3633 #undef HAVE_DCGETTEXT
--- a/intl/configure
+++ b/intl/configure
@@ -6643,9 +6643,6 @@ $as_echo_n "checking bison 3 or later... " >&6; }
66436643 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_prog_version" >&5
66446644 $as_echo "$ac_prog_version" >&6; }
66456645 if test $ac_bison3 = yes; then
6646-
6647-$as_echo "#define HAVE_BISON3 1" >>confdefs.h
6648-
66496646 BISON3_YES=
66506647 BISON3_NO='#'
66516648 fi
--- a/intl/configure.ac
+++ b/intl/configure.ac
@@ -68,7 +68,6 @@ changequote([,])dnl
6868 esac
6969 AC_MSG_RESULT([$ac_prog_version])
7070 if test $ac_bison3 = yes; then
71- AC_DEFINE(HAVE_BISON3, 1, [Define if bison 3 or later is used.])
7271 BISON3_YES=
7372 BISON3_NO='#'
7473 fi
--- /dev/null
+++ b/intl/plural-config.h
@@ -0,0 +1 @@
1+/* #define USE_BISON3 */
--- a/intl/plural-exp.h
+++ b/intl/plural-exp.h
@@ -20,6 +20,8 @@
2020 #ifndef _PLURAL_EXP_H
2121 #define _PLURAL_EXP_H
2222
23+#include <plural-config.h>
24+
2325 #ifndef PARAMS
2426 # if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
2527 # define PARAMS(args) args
@@ -111,7 +113,7 @@ struct parse_args
111113
112114 extern void FREE_EXPRESSION PARAMS ((struct expression *exp))
113115 internal_function;
114-#ifdef HAVE_BISON3
116+#ifdef USE_BISON3
115117 extern int PLURAL_PARSE PARAMS ((struct parse_args *arg));
116118 #else
117119 extern int PLURAL_PARSE PARAMS ((void *arg));
--- a/intl/plural.c
+++ b/intl/plural.c
@@ -59,7 +59,7 @@
5959 # define __gettextparse PLURAL_PARSE
6060 #endif
6161
62-#ifndef HAVE_BISON3
62+#ifndef USE_BISON3
6363 #define YYLEX_PARAM &((struct parse_args *) arg)->cp
6464 #define YYPARSE_PARAM arg
6565 #endif
@@ -89,7 +89,7 @@ static inline struct expression *new_exp_3 PARAMS ((enum operator op,
8989 struct expression *bexp,
9090 struct expression *tbranch,
9191 struct expression *fbranch));
92-#ifdef HAVE_BISON3
92+#ifdef USE_BISON3
9393 static int yylex PARAMS ((YYSTYPE *lval, struct parse_args *arg));
9494 static void yyerror PARAMS ((struct parse_args *arg, const char *str));
9595 #else
@@ -1372,7 +1372,7 @@ FREE_EXPRESSION (exp)
13721372 }
13731373
13741374
1375-#ifdef HAVE_BISON3
1375+#ifdef USE_BISON3
13761376 static int
13771377 yylex (lval, arg)
13781378 YYSTYPE *lval;
@@ -1526,7 +1526,7 @@ yylex (lval, pexp)
15261526 }
15271527
15281528
1529-#ifdef HAVE_BISON3
1529+#ifdef USE_BISON3
15301530 static void
15311531 yyerror (arg, str)
15321532 struct parse_args *arg;
--- a/intl/plural.y
+++ b/intl/plural.y
@@ -40,7 +40,7 @@
4040 # define __gettextparse PLURAL_PARSE
4141 #endif
4242
43-#ifndef HAVE_BISON3
43+#ifndef USE_BISON3
4444 #define YYLEX_PARAM &((struct parse_args *) arg)->cp
4545 #define YYPARSE_PARAM arg
4646 #endif
@@ -71,7 +71,7 @@ static inline struct expression *new_exp_3 PARAMS ((enum operator op,
7171 struct expression *bexp,
7272 struct expression *tbranch,
7373 struct expression *fbranch));
74-#ifdef HAVE_BISON3
74+#ifdef USE_BISON3
7575 static int yylex PARAMS ((YYSTYPE *lval, struct parse_args *arg));
7676 static void yyerror PARAMS ((struct parse_args *arg, const char *str));
7777 #else
@@ -266,7 +266,7 @@ FREE_EXPRESSION (exp)
266266 }
267267
268268
269-#ifdef HAVE_BISON3
269+#ifdef USE_BISON3
270270 static int
271271 yylex (lval, arg)
272272 YYSTYPE *lval;
@@ -420,7 +420,7 @@ yylex (lval, pexp)
420420 }
421421
422422
423-#ifdef HAVE_BISON3
423+#ifdef USE_BISON3
424424 static void
425425 yyerror (arg, str)
426426 struct parse_args *arg;