With macOS's (Mojave 10.14.6) built-in GNU bison 2.3 (/usr/bin/bison), the build fails because of the confliction of the keyword `STRING`: $ make ... /bin/sh ../../gdb/../ylwrap ../../gdb/ada-exp.y y.tab.c ada-exp.c.tmp -- \ bison -y || (rm -f ada-exp.c.tmp; false) g++ -x c++ -std=gnu++11 -g -O2 -I. -I../../gdb -I../../gdb/config -DLOCALEDIR="\"/Users/wsh/opt/gdb/share/locale\"" -DHAVE_CONFIG_H -I../../gdb/../include/opcode -I../../gdb/../readline/readline/.. -I../../gdb/../zlib -I../bfd -I../../gdb/../bfd -I../../gdb/../include -I../libdecnumber -I../../gdb/../libdecnumber -I../../gdb/../gnulib/import -I../gnulib/import -DTUI=1 -I/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/usr/local/Cellar/source-highlight/3.1.8_12/include -I/usr/local/opt/boost/include -I../../gdb/.. -pthread -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wno-sign-compare -Wno-mismatched-tags -Wno-error=deprecated-register -Wredundant-move -Wformat -Wformat-nonliteral -Werror -c -o ada-exp.o -MT ada-exp.o -MMD -MP -MF ./.deps/ada-exp.Tpo `if test -f ada-exp.c; then echo ada-exp.c; else echo ../../gdb/ada-exp.c; fi` In file included from ../../gdb/ada-exp.y:38: In file included from ../../gdb/defs.h:652: In file included from ../../gdb/utils.h:24: In file included from ../../gdb/exceptions.h:23: ../../gdb/ui-out.h:81:5: error: expected identifier STRING, ^ ada-exp.c:125:16: note: expanded from macro 'STRING' #define STRING 265 ^ In file included from ../../gdb/ada-exp.y:38: In file included from ../../gdb/defs.h:652: In file included from ../../gdb/utils.h:24: In file included from ../../gdb/exceptions.h:23: ../../gdb/ui-out.h:129:26: error: expected unqualified-id tmp.kind = field_kind::STRING; ^ ada-exp.c:125:16: note: expanded from macro 'STRING' #define STRING 265 ^ 2 errors generated. make[2]: *** [ada-exp.o] Error 1 make[1]: *** [all-gdb] Error 2 make: *** [all] Error 2 With bison 3.4.2 installed via Homebrew (configure YACC='/usr/local/Cellar/bison/3.4.2/bin/bison -y'), the build passes. This failure seems to start at 2a3c1174c, which introduced `enum class field_kind { STRING }`. I think the keyword `STRING` should be avoided, or older bison should be rejected in `configure`. For reference, I pasted the output of bison on gist: https://gist.github.com/wataash/a9949604a7b7966cd0a6bbc0a391e349
*** Bug 25289 has been marked as a duplicate of this bug. ***
Testing a patch.
The master branch has been updated by Tom Tromey <tromey@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=28ce7b07473c33f2e4e380a861973d68ffe8017f commit 28ce7b07473c33f2e4e380a861973d68ffe8017f Author: Tom Tromey <tromey@adacore.com> Date: Wed Dec 18 08:03:01 2019 -0700 Fix build failure on macOS PR build/25250 notes that the gdb 9 pre-release fails to build on macOS, due to a name clash between field_kind::STRING and the STRING token in ada-exp.y. I am not sure (I couldn't reproduce this myself), but presumably this is due to differences caused by the version of bison in use there. This patch works around the problem by renaming the field_kind enumerator. I chose to rename this one because it is used in relatively few places -- it's just an implementation detail of the style code. This version also renames field_kind::SIGNED for consistency. Let me know what you think. I intend to check this in on the gdb 9 branch as well. gdb/ChangeLog 2019-12-18 Tom Tromey <tromey@adacore.com> PR build/25250: * ui-out.c (ui_out::vmessage): Update. * ui-out.h (enum class field_kind) <FIELD_STRING, FIELD_SIGNED>: Rename. (string_field): Update. (signed_field): Update. Change-Id: Iae9f36f1b793e22c61fee0de2ab2d508668ee7e4
The gdb-9-branch branch has been updated by Tom Tromey <tromey@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1c66314dcbf262b8ef5793f3e08347de9c85e620 commit 1c66314dcbf262b8ef5793f3e08347de9c85e620 Author: Tom Tromey <tromey@adacore.com> Date: Wed Dec 18 08:03:01 2019 -0700 Fix build failure on macOS PR build/25250 notes that the gdb 9 pre-release fails to build on macOS, due to a name clash between field_kind::STRING and the STRING token in ada-exp.y. I am not sure (I couldn't reproduce this myself), but presumably this is due to differences caused by the version of bison in use there. This patch works around the problem by renaming the field_kind enumerator. I chose to rename this one because it is used in relatively few places -- it's just an implementation detail of the style code. This version also renames field_kind::SIGNED for consistency. Let me know what you think. I intend to check this in on the gdb 9 branch as well. 2019-12-18 Tom Tromey <tromey@adacore.com> PR build/25250: * ui-out.c (ui_out::vmessage): Update. * ui-out.h (enum class field_kind) <FIELD_STRING, FIELD_SIGNED>: Rename. (string_field): Update. (signed_field): Update. Change-Id: Iae9f36f1b793e22c61fee0de2ab2d508668ee7e4
Fixed.