mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-23 11:13:03 +00:00
style: c: fix a few minor issues about indentation of cpp directives
* README-hacking.md: More about cpp. * data/skeletons/c.m4, data/skeletons/yacc.c: Style changes.
This commit is contained in:
6
NEWS
6
NEWS
@@ -17,6 +17,12 @@ GNU Bison NEWS
|
|||||||
(2013-07-25), "%error-verbose" is deprecated in favor of "%define
|
(2013-07-25), "%error-verbose" is deprecated in favor of "%define
|
||||||
parse.error verbose".
|
parse.error verbose".
|
||||||
|
|
||||||
|
** Deprecated features
|
||||||
|
|
||||||
|
The YYPRINT macro, which works only with yacc.c and only for tokens, was
|
||||||
|
obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
|
||||||
|
It is deprecated and its support will be removed eventually.
|
||||||
|
|
||||||
** New features
|
** New features
|
||||||
|
|
||||||
*** Improved syntax error messages
|
*** Improved syntax error messages
|
||||||
|
|||||||
@@ -57,6 +57,31 @@ Actually, Bison has legacy code that we should replace with gnulib modules
|
|||||||
### Skeletons
|
### Skeletons
|
||||||
We try to use the "typical" coding style for each language.
|
We try to use the "typical" coding style for each language.
|
||||||
|
|
||||||
|
#### CPP
|
||||||
|
We indent the CPP directives this way:
|
||||||
|
|
||||||
|
```
|
||||||
|
#if FOO
|
||||||
|
# if BAR
|
||||||
|
# define BAZ
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
```
|
||||||
|
|
||||||
|
Don't indent with leading spaces in the skeletons (it's ok in the grammar
|
||||||
|
files though, e.g., in `%code {...}` blocks).
|
||||||
|
|
||||||
|
On occasions, use `cppi -c` to see where we stand. We don't aim at full
|
||||||
|
correctness: depending `-d`, some bits can be in the *.c file, or the *.h
|
||||||
|
file within the double-inclusion cpp-guards. In that case, favor the case
|
||||||
|
of the *.h file, but don't waste time on this.
|
||||||
|
|
||||||
|
Don't hesitate to leave a comment on the `#endif` (e.g., `#endif /* FOO
|
||||||
|
*/`), especially for long blocks.
|
||||||
|
|
||||||
|
There is no conistency on `! defined` vs. `!defined`. The day gnulib
|
||||||
|
decides, we'll follow them.
|
||||||
|
|
||||||
#### C/C++
|
#### C/C++
|
||||||
Follow the GNU Coding Standards.
|
Follow the GNU Coding Standards.
|
||||||
|
|
||||||
|
|||||||
@@ -1002,7 +1002,7 @@ yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
|
|||||||
# else
|
# else
|
||||||
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
||||||
# endif
|
# endif
|
||||||
#endif]],
|
# endif /* !defined YY_LOCATION_PRINT */]],
|
||||||
[[/* This macro is provided for backward compatibility. */
|
[[/* This macro is provided for backward compatibility. */
|
||||||
# ifndef YY_LOCATION_PRINT
|
# ifndef YY_LOCATION_PRINT
|
||||||
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
||||||
|
|||||||
@@ -1014,7 +1014,7 @@ yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
|
|||||||
# else
|
# else
|
||||||
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
||||||
# endif
|
# endif
|
||||||
#endif
|
# endif /* !defined YY_LOCATION_PRINT */
|
||||||
|
|
||||||
|
|
||||||
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
|
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
|
||||||
|
|||||||
Reference in New Issue
Block a user