gcc/intl
Jakub Jelinek 437eea66a4 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.
2020-04-16 11:55:00 +02:00
..
ChangeLog intl: Unbreak intl build with bison 3 when no regeneration is needed [PR92008] 2020-04-16 11:55:00 +02:00
Makefile.in intl: Unbreak intl build with bison 3 when no regeneration is needed [PR92008] 2020-04-16 11:55:00 +02:00
README
VERSION
aclocal.m4 Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856). 2018-10-31 17:03:16 +00:00
bindtextdom.c
config.h.in intl: Unbreak intl build with bison 3 when no regeneration is needed [PR92008] 2020-04-16 11:55:00 +02:00
config.intl.in
configure intl: Unbreak intl build with bison 3 when no regeneration is needed [PR92008] 2020-04-16 11:55:00 +02:00
configure.ac intl: Unbreak intl build with bison 3 when no regeneration is needed [PR92008] 2020-04-16 11:55:00 +02:00
dcgettext.c
dcigettext.c
dcngettext.c
dgettext.c
dngettext.c
eval-plural.h
explodename.c
finddomain.c
gettext.c
gettextP.h
gmo.h
hash-string.h
intl-compat.c
l10nflist.c
libgnuintl.h libgnuintl.h (_INTL_MAY_RETURN_STRING_ARG, [...]): Backport changes from upstream gettext. 2018-09-18 22:08:49 -06:00
loadinfo.h
loadmsgcat.c
localcharset.c
localcharset.h
locale.alias
localealias.c
localename.c
log.c
ngettext.c
osdep.c
plural-config.h intl: Unbreak intl build with bison 3 when no regeneration is needed [PR92008] 2020-04-16 11:55:00 +02:00
plural-exp.c
plural-exp.h intl: Unbreak intl build with bison 3 when no regeneration is needed [PR92008] 2020-04-16 11:55:00 +02:00
plural.c intl: Unbreak intl build with bison 3 when no regeneration is needed [PR92008] 2020-04-16 11:55:00 +02:00
plural.y intl: Unbreak intl build with bison 3 when no regeneration is needed [PR92008] 2020-04-16 11:55:00 +02:00
relocatable.c
relocatable.h
textdomain.c

README

GNU toolchain edition of GNU libintl 0.12.1

Most of the content of this directory is taken from gettext 0.12.1
and is owned by that project.  Patches should be directed to the
gettext developers first.  However, note the following:

* libintl.h comes from gettext, but is named libgnuintl.h.in in that
  project's source tree.

* The files COPYING.LIB-2.0 and COPYING.LIB-2.1 are redundant with the
  top-level COPYING.LIB and have therefore been removed.

* The files config.charset, ref-add.sin, ref-del.sin, os2compat.c,
  and os2compat.h are not used in this setup and have therefore been 
  removed.

* aclocal.m4 was constructed using automake's "aclocal -I ../config".

* configure.ac, config.intl.in, and Makefile.in were written for this
  directory layout, by Zack Weinberg <zack@codesourcery.com>.  Please
  direct patches for these files to gcc-patches@gcc.gnu.org.