]> git.saurik.com Git - bison.git/blobdiff - data/bison.m4
yacc.c: do not use __attribute__ unprotected
[bison.git] / data / bison.m4
index 9a66d884961ec26a56e98874e0f59e33d3044b89..a24b162c8177796415cfd297f0a8ec5a951e96e0 100644 (file)
@@ -58,6 +58,30 @@ This special exception was added by the Free Software Foundation in
 version 2.2 of Bison.])])
 
 
+## -------- ##
+## Output.  ##
+## -------- ##
+
+# b4_output_begin(FILE)
+# ---------------------
+# Enable output, i.e., send to diversion 0, expand after "#", and
+# generate the tag to output into FILE.  Must be followed by EOL.
+m4_define([b4_output_begin],
+[m4_changecom()
+m4_divert_push(0)dnl
+@output(m4_unquote([$1])@)@dnl
+])
+
+
+# b4_output_end()
+# ---------------
+# Output nothing, restore # as comment character (no expansions after #).
+m4_define([b4_output_end],
+[m4_divert_pop(0)
+m4_changecom([#])
+])
+
+
 ## ---------------- ##
 ## Error handling.  ##
 ## ---------------- ##
@@ -259,8 +283,8 @@ m4_define([b4_basename],
 # b4_syncline(LINE, FILE)
 # -----------------------
 m4_define([b4_syncline],
-[b4_flag_if([synclines], [
-b4_sync_end([__line__], [b4_basename(m4_quote(__file__))])
+[b4_flag_if([synclines],
+[b4_sync_end([__line__], [b4_basename(m4_quote(__file__))])
 b4_sync_start([$1], [$2])])])
 
 m4_define([b4_sync_end], [b4_comment([Line $1 of $2])])
@@ -576,3 +600,11 @@ m4_define_default([b4_parse_param], [])
 # The initial column and line.
 m4_define_default([b4_location_initial_column], [1])
 m4_define_default([b4_location_initial_line],   [1])
+
+# Sanity checks.
+b4_percent_define_ifdef([api.prefix],
+[m4_ifdef([b4_prefix],
+[b4_complain_at(b4_percent_define_get_loc([api.prefix]),
+                [['%s' and '%s' cannot be used together]],
+                [%name-prefix],
+                [%define api.prefix])])])