From: Akim Demaille Date: Mon, 8 Apr 2013 18:37:09 +0000 (+0200) Subject: m4: allow the definition of side-effect only macros X-Git-Tag: v2.7.90~48 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/dde95ca432b2b54c8bc8d2dea3e0c9069862321d?ds=sidebyside m4: allow the definition of side-effect only macros * data/bison.m4 (b4_divert_kill, b4_define_silent): New. * data/c.m4: Comment change. --- diff --git a/data/bison.m4 b/data/bison.m4 index bb539708..a52e65a5 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 9405ae34..185cc064 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],