c++: use nullptr for C++11.

C++11 introduces "nullptr" which plays the role of C's NULL, in
replacement of "0".  Fix the C++ skeletons to avoid warnings about
uses of "0" in place of "nullptr", and improve C skeletons to also use
this "nullptr" when compiled with a C++11 compiler.

* configure.ac: More C++ warnings.
* NEWS (2.5.1): Document this.
* data/c++.m4, data/c.m4 (b4_null_define): New.
(b4_null): Use YY_NULL instead of 0.
* data/glr.c, data/lalr1.cc, data/location.cc, data/yacc.c:
Call b4_null_define/b4_null where appropriate.
Use YY_NULL instead of NULL.
* data/location.cc (initialize): Accept a default argument,
YY_NULL.
* tests/actions.at, tests/calc.at: Adjust.

* data/glr.c, lib/libiberty.h, src/system.h (__attribute__):
Do not disable it when __STRICT_ANSI__ is defined, as, for
instance, it disables the __attribute__((unused)) which
protects us from some compiler warnings.
This was already done elsewhere in Bison, in 2001, see
4a0d893695.
* tests/regression.at: Adjust output.
This commit is contained in:
Akim Demaille
2012-03-30 15:50:45 +02:00
parent e85056ef5f
commit ef51bfa744
13 changed files with 105 additions and 73 deletions

8
NEWS
View File

@@ -9,6 +9,9 @@ Bison News
tools such as diff, warning messages from the test suite itself,
etc.
__attribute__ is not longer disabled when __STRICT_ANSI__ is defined
(i.e., when -std is passed to GCC).
** Warnings during the build procedure have been eliminated.
** Many minor improvements have been made to the manual:
@@ -26,6 +29,11 @@ Bison News
The Java parser no longer throws ArrayIndexOutOfBoundsException if
the first token leads to a syntax error. Some minor clean ups.
** C++11 compatibility:
C and C++ parsers use nullptr instead of 0 when __cplusplus is
201103L or higher.
* Changes in version 2.5 (2011-05-14):
** Grammar symbol names can now contain non-initial dashes: