From: Akim Demaille Date: Sat, 22 Dec 2012 08:14:05 +0000 (+0100) Subject: c++: use // comments in the output X-Git-Tag: v2.7.90~234 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/38de4e570fdc7c8db9633c3b2054e565d8c1c6b9 c++: use // comments in the output This is mostly used for the license header, the synclines, and the generated tables: - /* STOS_[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ + // STOS_[STATE-NUM] -- The (internal number of the) accessing + // symbol of state STATE-NUM. static const unsigned char yystos_[]; * data/c.m4: Comment changes. (b4_comment_): Expand the text argument. Before this change, we were actually formatting M4 code as a C comment, and then expand it. (b4_comment): Fix the closing of comments: there is no reason to add the (line) prefix before the closing "*/". * data/c++.m4 (b4_comment): New. --- diff --git a/data/c++.m4 b/data/c++.m4 index 66982de4..76de6968 100644 --- a/data/c++.m4 +++ b/data/c++.m4 @@ -19,6 +19,13 @@ m4_include(b4_pkgdatadir/[c.m4]) +# b4_comment(TEXT, [PREFIX]) +# -------------------------- +# Put TEXT in comment. Prefix all the output lines with PREFIX. +m4_define([b4_comment], +[b4_comment_([$1], [$2// ], [$2// ])]) + + ## ---------------- ## ## Default values. ## ## ---------------- ## diff --git a/data/c.m4 b/data/c.m4 index 6c2f5525..b6f77d8f 100644 --- a/data/c.m4 +++ b/data/c.m4 @@ -58,20 +58,17 @@ m4_define([b4_cpp_guard_close], # from OPEN. That's why we don't patsubst([$1], [^\(.\)], [ \1]). # # Prefix all the output lines with PREFIX. -m4_define([b4_comment_], [$2[]m4_bpatsubst([$1], [ +m4_define([b4_comment_], +[$2[]m4_bpatsubst(m4_expand([$1]), [ \(.\)], [ $3\1])$4]) # b4_comment(TEXT, [PREFIX]) # -------------------------- -# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines. -# Avoid adding indentation to the first line, as the indentation comes -# from "/*". That's why we don't patsubst([$1], [^\(.\)], [ \1]). -# -# Prefix all the output lines with PREFIX. +# Put TEXT in comment. Prefix all the output lines with PREFIX. m4_define([b4_comment], -[b4_comment_([$1], [$2/* ], [$2 ], [$2 */])]) +[b4_comment_([$1], [$2/* ], [$2 ], [ */])]) # b4_identification