aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2016-11-03 16:09:42 +0000
committerYao Qi <yao.qi@linaro.org>2016-11-03 16:09:42 +0000
commit722bcb33bf0383487c1af0e7d401e30301e94e2b (patch)
treec290198bce996f10c3cfae16a164fdabc9a318a0 /gdb
parent034b77cf7875c4ea5aaf3d06dfea2e422abc47db (diff)
downloadgdb-722bcb33bf0383487c1af0e7d401e30301e94e2b.zip
gdb-722bcb33bf0383487c1af0e7d401e30301e94e2b.tar.gz
gdb-722bcb33bf0383487c1af0e7d401e30301e94e2b.tar.bz2
Replace YY_NULL with YY_NULLPTR in LANG-exp.c
As we require c++11, GDB fails to build if bison is not new enough. I see the following error on the system (fedora 19) that bison is 2.6.4, g++ -std=gnu++11 .... \ -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 ../../binutils-gdb/gdb/ada-exp.c; fi` In file included from ../../binutils-gdb/gdb/ada-exp.y:731:0: ada-lex.c:113:0: error: "YY_NULL" redefined [-Werror] #define YY_NULL 0 ^ ada-exp.c:158:0: note: this is the location of the previous definition # define YY_NULL nullptr ^ cc1plus: all warnings being treated as errors make: *** [ada-exp.o] Error 1 Both ada-exp.c and ada-lex.c has macro YY_NULL, like this, $ cat 1.c # ifndef YY_NULL # if defined __cplusplus && 201103L <= __cplusplus # define YY_NULL nullptr # else # define YY_NULL 0 # endif # endif #define YY_NULL 0 as we can see, YY_NULL is defined differently (nullptr vs 0) $ g++ -std=c++11 -Wall 1.c -c 1.c:9:0: warning: "YY_NULL" redefined #define YY_NULL 0 ^ 1.c:3:0: note: this is the location of the previous definition # define YY_NULL nullptr ^ $ g++ -Wall 1.c -c bison renames YY_NULL to YY_NULLPTR in 2013 Nov, https://lists.gnu.org/archive/html/bison-patches/2013-11/msg00002.html and bison released later than 2013 Nov have this patch. Bison 3.0.2, released on 2013 Dec, is OK. The fix is to replace YY_NULL with YY_NULLPTR via sed. With old bison, YY_NULL becomes YY_NULLPTR; with new bison, YY_NULLPTR becomes YY_NULLPTRPTR, gdb: 2016-11-03 Yao Qi <yao.qi@linaro.org> * Makefile.in (.y.c): Replace YY_NULL with YY_NULLPTR.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/Makefile.in1
2 files changed, 5 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c133951..1fd85ce 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,4 +1,8 @@
2016-11-03 Yao Qi <yao.qi@linaro.org>
+
+ * Makefile.in (.y.c): Replace YY_NULL with YY_NULLPTR.
+
+2016-11-03 Yao Qi <yao.qi@linaro.org>
Pedro Alves <palves@redhat.com>
* aarch64-tdep.c (aarch64_default_breakpoint): Change it to
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index d035d8e..6db63c7 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1894,6 +1894,7 @@ po/$(PACKAGE).pot: force
-e 's/\([ \t;,(]\)free\([ \t]*[&(),]\)/\1xfree\2/g' \
-e 's/\([ \t;,(]\)free$$/\1xfree/g' \
-e '/^#line.*y.tab.c/d' \
+ -e 's/YY_NULL/YY_NULLPTR/g' \
< $@.tmp > $@
rm -f $@.tmp
.l.c: