c++: compute the header guards.

This is a frequent request.  Recently pointed out by Wei Song,
<http://lists.gnu.org/archive/html/help-bison/2012-05/msg00002.html>.

* data/c.m4 (b4_tocpp, b4_cpp_guard, b4_cpp_guard_open)
(b4_cpp_guard_close): New.
* data/lalr1.cc, data/location.cc, data/stack.hh: Use them.
* TODO (Header Guards): Move to...
* NEWS: here.
Formatting changes.
This commit is contained in:
Akim Demaille
2012-05-21 14:21:51 +02:00
parent a19728cbb5
commit 22172d4731
7 changed files with 63 additions and 23 deletions

27
NEWS
View File

@@ -26,12 +26,35 @@ 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:
** Changes for C++:
*** C++11 compatibility:
C and C++ parsers use "nullptr" instead of "0" when __cplusplus is 201103L
or higher.
** C++ locations:
*** Header guards
The header files such as "parser.hh", "location.hh", etc. used a constant
name for preprocessor guards, for instance:
#ifndef BISON_LOCATION_HH
# define BISON_LOCATION_HH
...
#endif // !BISON_LOCATION_HH
The inclusion guard is now computed from "PREFIX/FILE-NAME", where lower
case characters are converted to upper case, and series of
non-alphanumerical characters are converted to an underscore.
With "bison -o lang++/parser.cc", "location.hh" would now include:
#ifndef YY_LANG_LOCATION_HH
# define YY_LANG_LOCATION_HH
...
#endif // !YY_LANG_LOCATION_HH
*** C++ locations:
The position and location constructors (and their initialize methods)
accept new arguments for line and column. Several issues in the