bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/3] m4: allow the definition of side-effect only macros


From: Akim Demaille
Subject: [PATCH 3/3] m4: allow the definition of side-effect only macros
Date: Tue, 9 Apr 2013 14:29:09 +0200

* data/bison.m4 (b4_divert_kill, b4_define_silent): New.
* data/c.m4: Comment change.
---
 data/bison.m4 | 14 ++++++++++++++
 data/c.m4     |  2 +-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/data/bison.m4 b/data/bison.m4
index bb53970..a52e65a 100644
--- a/data/bison.m4
+++ b/data/bison.m4
@@ -85,6 +85,20 @@ m4_changecom([#])
 ])
 
 
+# b4_divert_kill(CODE)
+# --------------------
+# Expand CODE for its side effects, discard its output.
+m4_define([b4_divert_kill],
+[m4_divert_text([KILL], [$1])])
+
+
+# b4_define_silent(MACRO, CODE)
+# -----------------------------
+# Same as m4_define, but throw away the expansion of CODE.
+m4_define([b4_define_silent],
+[m4_define([$1], [b4_divert_kill([$2])])])
+
+
 ## ---------------- ##
 ## Error handling.  ##
 ## ---------------- ##
diff --git a/data/c.m4 b/data/c.m4
index 9405ae3..185cc06 100644
--- a/data/c.m4
+++ b/data/c.m4
@@ -549,7 +549,7 @@ b4_pure_if([], [[extern ]b4_api_PREFIX[STYPE 
]b4_prefix[lval;
 
 
 # b4_YYDEBUG_define
-# ------------------
+# -----------------
 m4_define([b4_YYDEBUG_define],
 [[/* Debug traces.  */
 ]m4_if(b4_api_prefix, [yy],
-- 
1.8.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]