]> git.saurik.com Git - bison.git/blobdiff - data/c.m4
misc: document TESTSUITEFLAGS in README-hacking
[bison.git] / data / c.m4
index 745260dc8f632a3b2806cc76399599104e66c0d5..179743c9f012e674d42bc11c64d822c02831cda8 100644 (file)
--- a/data/c.m4
+++ b/data/c.m4
@@ -30,19 +30,21 @@ m4_define([b4_tocpp],
 # ------------------
 # A valid C macro name to use as a CPP header guard for FILE.
 m4_define([b4_cpp_guard],
-[b4_tocpp(m4_defn([b4_prefix])/[$1])])
+[[YY_]b4_tocpp(m4_defn([b4_prefix])/[$1])[_INCLUDED]])
 
 
 # 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])])])])
 
 
 ## ---------------- ##
@@ -195,13 +197,12 @@ m4_define([b4_int_type_for],
 # --------------------------------------------
 # Without inducing a comparison warning from the compiler, check if the
 # literal value LITERAL equals VALUE from table TABLE, which must have
-# TABLE_min and TABLE_max defined.  YYID must be defined as an identity
-# function that suppresses warnings about constant conditions.
+# TABLE_min and TABLE_max defined.
 m4_define([b4_table_value_equals],
 [m4_if(m4_eval($3 < m4_indir([b4_]$1[_min])
                || m4_indir([b4_]$1[_max]) < $3), [1],
-       [[YYID (0)]],
-       [[((]$2[) == (]$3[))]])])
+       [[0]],
+       [(!!(($2) == ($3)))])])
 
 
 ## ---------##
@@ -407,17 +408,15 @@ b4_syncline([@oline@], [@ofile@])
     break;])
 
 
-# b4_yydestruct_generate(FUNCTION-DECLARATOR)
-# -------------------------------------------
-# Generate the "yydestruct" function, which declaration is issued using
-# FUNCTION-DECLARATOR, which may be "b4_function_define".
-m4_define_default([b4_yydestruct_generate],
+# b4_yydestruct_define
+# --------------------
+# Define the "yydestruct" function.
+m4_define_default([b4_yydestruct_define],
 [[/*-----------------------------------------------.
 | Release the memory associated to this symbol.  |
 `-----------------------------------------------*/
 
-/*ARGSUSED*/
-]$1([yydestruct],
+]b4_function_define([yydestruct],
     [static void],
     [[const char *yymsg],    [yymsg]],
     [[int yytype],           [yytype]],
@@ -440,18 +439,16 @@ m4_ifset([b4_parse_param], [, b4_parse_param]))[
 ])
 
 
-# b4_yy_symbol_print_generate(FUNCTION-DECLARATOR)
-# ------------------------------------------------
-# Generate the "yy_symbol_print" function, which declaration is issued using
-# FUNCTION-DECLARATOR, which may be "b4_function_define".
-m4_define_default([b4_yy_symbol_print_generate],
+# b4_yy_symbol_print_define
+# -------------------------
+# Define the "yy_symbol_print" function.
+m4_define_default([b4_yy_symbol_print_define],
 [[
 /*--------------------------------.
 | Print this symbol on YYOUTPUT.  |
 `--------------------------------*/
 
-/*ARGSUSED*/
-]$1([yy_symbol_value_print],
+]b4_function_define([yy_symbol_value_print],
     [static void],
                [[FILE *yyoutput],                       [yyoutput]],
                [[int yytype],                           [yytype]],
@@ -483,7 +480,7 @@ m4_if(b4_skeleton, ["yacc.c"],
 | Print this symbol on YYOUTPUT.  |
 `--------------------------------*/
 
-]$1([yy_symbol_print],
+]b4_function_define([yy_symbol_print],
     [static void],
                [[FILE *yyoutput],                       [yyoutput]],
                [[int yytype],                           [yytype]],
@@ -584,7 +581,7 @@ m4_define([b4_yylloc_default_define],
 #ifndef YYLLOC_DEFAULT
 # define YYLLOC_DEFAULT(Current, Rhs, N)                                \
     do                                                                  \
-      if (YYID (N))                                                     \
+      if (N)                                                            \
         {                                                               \
           (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
           (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
@@ -598,6 +595,6 @@ m4_define([b4_yylloc_default_define],
           (Current).first_column = (Current).last_column =              \
             YYRHSLOC (Rhs, 0).last_column;                              \
         }                                                               \
-    while (YYID (0))
+    while (0)
 #endif
 ]])