[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/6] c++: use // comments in the output
From: |
Akim Demaille |
Subject: |
[PATCH 1/6] c++: use // comments in the output |
Date: |
Sun, 23 Dec 2012 10:27:01 +0100 |
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.
---
data/c++.m4 | 7 +++++++
data/c.m4 | 11 ++++-------
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/data/c++.m4 b/data/c++.m4
index 66982de..76de696 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 6c2f552..b6f77d8 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
--
1.8.0.2
- [PATCH 0/6] {master} minor improvements, Akim Demaille, 2012/12/26
- [PATCH 1/6] c++: use // comments in the output,
Akim Demaille <=
- [PATCH 4/6] skeletons: fix an error message, Akim Demaille, 2012/12/26
- [PATCH 2/6] c++: comment changes, Akim Demaille, 2012/12/26
- [PATCH 5/6] uniqstr: formatting changes, Akim Demaille, 2012/12/26
- [PATCH 3/6] tests: improve titles, Akim Demaille, 2012/12/26
- [PATCH 6/6] variant: produce stable results, Akim Demaille, 2012/12/26