muscle: minor simplification which uncovers a missing warning
authorAkim Demaille <akim@lrde.epita.fr>
Sun, 14 Apr 2013 08:28:26 +0000 (10:28 +0200)
committerAkim Demaille <akim@lrde.epita.fr>
Mon, 15 Apr 2013 08:50:30 +0000 (10:50 +0200)
* src/muscle-tab.c (muscle_percent_define_ensure): Discover the virtues
of || to factor conditionals.
* NEWS: As api.pure is no longer flagged as "used" by accident,
we now have warnings for useless definitions.
* tests/calc.at: So remove api.pure settings when running C++ tests,
since C++ skeletons use a pure interface.

NEWS
src/muscle-tab.c
tests/calc.at

diff --git a/NEWS b/NEWS
index 5bc4d31e893ef6476b965f38a990fc754bcdea41..e06cb77afe83a7b1deb6279082d4b73f791f99dc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -62,6 +62,8 @@ GNU Bison NEWS
   Changes in Bison 2.7 introduced a dependency on FILE and fprintf when
   locations are enabled.  This is fixed.
 
+*** Warnings about useless %pure-parser/%define api.pure are restored
+
 ** Diagnostics reported by Bison
 
   Most of these features were contributed by Théophile Ranquet and Victor
index 5e2275e6686f837aeb00a1fd413749d754c3ebac..3f2793c5ed68ead68405fe078ad6c4818c4d57fb 100644 (file)
@@ -541,10 +541,8 @@ muscle_percent_define_ensure (char const *variable, location loc,
 
   /* Don't complain is VARIABLE is already defined, but be sure to set
      its value to VAL.  */
-  if (!muscle_find_const (name))
-    muscle_percent_define_insert (variable, loc, muscle_keyword, val,
-                                  MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE);
-  if (muscle_percent_define_flag_if (variable) != value)
+  if (!muscle_find_const (name)
+      || muscle_percent_define_flag_if (variable) != value)
     muscle_percent_define_insert (variable, loc, muscle_keyword, val,
                                   MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE);
 }
index eedfc897901f7c516f6efff9d484859ca4631852..00741f8e2f886b72790bf92fafa5521f51515974 100644 (file)
@@ -683,13 +683,13 @@ AT_CHECK_CALC_LALR1_CC([%defines %locations %define parse.error verbose %name-pr
 AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %define api.prefix "calc" %verbose %yacc])
 AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc])
 
-AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error verbose %debug %define api.prefix "calc" %verbose %yacc])
-AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error verbose %debug %define api.prefix "calc" %define api.token.prefix {TOK_} %verbose %yacc])
+AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %debug %define api.prefix "calc" %verbose %yacc])
+AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %debug %define api.prefix "calc" %define api.token.prefix {TOK_} %verbose %yacc])
 
-AT_CHECK_CALC_LALR1_CC([%defines %locations %pure-parser %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
+AT_CHECK_CALC_LALR1_CC([%defines %locations %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
 
-AT_CHECK_CALC_LALR1_CC([%pure-parser %define parse.error verbose %debug %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
-AT_CHECK_CALC_LALR1_CC([%defines %locations %pure-parser %define parse.error verbose %debug %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
+AT_CHECK_CALC_LALR1_CC([%define parse.error verbose %debug %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
+AT_CHECK_CALC_LALR1_CC([%defines %locations %define parse.error verbose %debug %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
 
 
 
@@ -716,10 +716,9 @@ AT_CHECK_CALC_GLR_CC([%defines %define parse.error verbose %name-prefix "calc" %
 AT_CHECK_CALC_GLR_CC([%define parse.error verbose %define api.prefix "calc" %verbose %yacc])
 
 AT_CHECK_CALC_GLR_CC([%debug])
-AT_CHECK_CALC_GLR_CC([%define parse.error verbose %debug %name-prefix "calc" %verbose %yacc])
 
-AT_CHECK_CALC_GLR_CC([%pure-parser %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc])
-AT_CHECK_CALC_GLR_CC([%pure-parser %define parse.error verbose %debug %name-prefix "calc" %define api.token.prefix {TOK_} %verbose %yacc])
+AT_CHECK_CALC_GLR_CC([%define parse.error verbose %debug %name-prefix "calc" %verbose %yacc])
+AT_CHECK_CALC_GLR_CC([%define parse.error verbose %debug %name-prefix "calc" %define api.token.prefix {TOK_} %verbose %yacc])
 
-AT_CHECK_CALC_GLR_CC([%locations %defines %pure-parser %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
-AT_CHECK_CALC_GLR_CC([%locations %defines %pure-parser %define parse.error verbose %debug %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
+AT_CHECK_CALC_GLR_CC([%locations %defines %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
+AT_CHECK_CALC_GLR_CC([%locations %defines %define parse.error verbose %debug %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])