]> git.saurik.com Git - bison.git/commitdiff
yacc: fix handling of CPP guards when no header is generated
authorAkim Demaille <akim@lrde.epita.fr>
Fri, 21 Sep 2012 09:10:37 +0000 (11:10 +0200)
committerAkim Demaille <akim@lrde.epita.fr>
Tue, 25 Sep 2012 08:24:37 +0000 (10:24 +0200)
When no header was to be generated, Bison would issue:

  /* In a future release of Bison, this section will be replaced
     by #include "".  */
  #ifndef YY_
  # define YY_

It now properly generates nothing.

* data/c.m4 (b4_cpp_guard_open, b4_cpp_guard_close): Issue nothing when
the file name is empty.
* data/yacc.c: Do not generate the above comment when there is no header
to generate.
* NEWS: Update.

NEWS
data/c.m4
data/yacc.c

diff --git a/NEWS b/NEWS
index 7fdbc037a834d5baad1c11782d03e48b039dab78..75a11bf082292a4f2617ffa8110377719cbe980c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,17 @@ GNU Bison NEWS
 
 * Noteworthy changes in release ?.? (????-??-??) [?]
 
+** Bug fixes
+
+  Bugs in the test suite have been fixed.
+
+  Some errors in translations have been addressed, and --help now directs
+  users to the appropriate place to report them.
+
+  Stray Info files shipped by accident are removed.
+
+  Incorrect definitions of YY_, issued by yacc.c when no parser header is
+  generated, are removed.
 
 * Noteworthy changes in release 2.6.2 (2012-08-03) [stable]
 
index 45468e3cac1305dbd5f398f8467978745c13e2d8..ccb4969ecd4ac8c28fd638bdb373aa4b2b0ca760 100644 (file)
--- a/data/c.m4
+++ b/data/c.m4
@@ -36,13 +36,15 @@ m4_define([b4_cpp_guard],
 # b4_cpp_guard_open(FILE)
 # b4_cpp_guard_close(FILE)
 # ------------------------
-# Open/close CPP inclusion guards for FILE.
+# If FILE does not expand to nothing, open/close CPP inclusion guards for FILE.
 m4_define([b4_cpp_guard_open],
+[m4_ifval(m4_quote($1),
 [#ifndef b4_cpp_guard([$1])
-# define b4_cpp_guard([$1])])
+# define b4_cpp_guard([$1])])])
 
 m4_define([b4_cpp_guard_close],
-[#endif b4_comment([!b4_cpp_guard([$1])])])
+[m4_ifval(m4_quote($1),
+[#endif b4_comment([!b4_cpp_guard([$1])])])])
 
 
 ## ---------------- ##
index 2c57f01dd831bcf694fb176c2c99dc2f3518803c..7bcbd7ca54c84089a9d25f070a753e51dd11108b 100644 (file)
@@ -345,9 +345,11 @@ m4_if(b4_api_prefix, [yy], [],
 # define YYERROR_VERBOSE ]b4_error_verbose_flag[
 #endif
 
-/* In a future release of Bison, this section will be replaced
+]m4_ifval(m4_quote(b4_spec_defines_file),
+[[/* In a future release of Bison, this section will be replaced
    by #include "@basename(]b4_spec_defines_file[@)".  */
-]b4_shared_declarations[
+]])dnl
+b4_shared_declarations[
 
 /* Copy the second part of user declarations.  */
 ]b4_user_post_prologue