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.
This commit is contained in:
Akim Demaille
2012-12-22 09:14:05 +01:00
parent bd04adb4c8
commit 38de4e570f
2 changed files with 11 additions and 7 deletions

View File

@@ -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. ##
## ---------------- ##

View File

@@ -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