all: avoid useless comments and #lines

Currently we emit useless code for places where we might issue user
content, but there is none.  This commit avoids this.  Besides, some
of the comments looked like implementation details ("Copy the first
part of user declarations"), rather than made for the reader of the
result ("First part of user prologue").

On Bison's parse-gram.c we get:

    @@ -76,10 +76,6 @@
     #define yynerrs         gram_nerrs

    -/* Copy the first part of user declarations.  */
    -
    -#line 82 "src/parse-gram.c" /* yacc.c:339  */
    -

* data/bison.m4 (b4_define_user_code): Accept a comment to document
the section.
Do not emit any code if the content is empty.
Adjust callers to not emit the comment.
Do not
* data/glr.c, data/glr.cc, data/lalr1.cc, data/lalr1.java, data/yacc.c:
Adjust.
This commit is contained in:
Akim Demaille
2018-10-21 09:40:16 +02:00
parent 85f7c08036
commit 81a9580622
6 changed files with 21 additions and 33 deletions

View File

@@ -87,10 +87,10 @@ b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
[2007-2015, 2018])
b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
])[/* First part of user declarations. */
]b4_user_pre_prologue
b4_user_post_prologue
b4_percent_code_get([[imports]])
])[
]b4_user_pre_prologue[
]b4_user_post_prologue[
]b4_percent_code_get([[imports]])
[/**
* A Bison parser, automatically generated from <tt>]m4_bpatsubst(b4_file_name, [^"\(.*\)"$], [\1])[</tt>.
*
@@ -586,7 +586,6 @@ b4_define_state])[
yystack.push (yystate, yylval ]b4_locations_if([, yylloc])[);
]m4_ifdef([b4_initial_action], [
b4_dollar_pushdef([yylval], [], [yylloc])dnl
/* User initialization code. */
b4_user_initial_action
b4_dollar_popdef[]dnl
])[
@@ -597,7 +596,6 @@ b4_dollar_popdef[]dnl
push_parse_initialize ();
]m4_ifdef([b4_initial_action], [
b4_dollar_pushdef([yylval], [], [yylloc])dnl
/* User initialization code. */
b4_user_initial_action
b4_dollar_popdef[]dnl
])[