autoconf-patches
[Top][All Lists]
Advanced

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

[PATCH] fix regex in AC_DEFINE_UNQUOTED


From: Paolo Bonzini
Subject: [PATCH] fix regex in AC_DEFINE_UNQUOTED
Date: Tue, 15 Aug 2017 02:44:09 +0200

From: Paolo Bonzini <address@hidden>

In commit 527f183f I mistakenly used "|" for alternation
instead of "\|".  Fix this.

* lib/autoconf/general.m4 (_AC_DEFINE_UNQUOTED): Use "|" for
basic regex alteration.
* tests/torture.at (Substitute and define special characters):
Add test case.

Signed-off-by: Paolo Bonzini <address@hidden>
---
 lib/autoconf/general.m4 | 2 +-
 tests/torture.at        | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index f7834046..a72dad9e 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -2171,7 +2171,7 @@ m4_define([AC_DEFINE_UNQUOTED], [_AC_DEFINE_Q([_$0], $@)])
 # avoid AS_ECHO if "#" is present to avoid confusing m4 with comments,
 # but quadrigraphs are fine in that case.
 m4_define([_AC_DEFINE_UNQUOTED],
-[m4_if(m4_bregexp([$1], [#\|\\\|`\|\(\$\|@S|@\)\((|{|@{:@\)]), [-1],
+[m4_if(m4_bregexp([$1], [#\|\\\|`\|\(\$\|@S|@\)\((\|{\|@{:@\)]), [-1],
        [AS_ECHO(["AS_ESCAPE([$1], [""])"]) >>confdefs.h],
        [cat >>confdefs.h <<_ACEOF
 [$1]
diff --git a/tests/torture.at b/tests/torture.at
index 683d74af..0306b8ef 100644
--- a/tests/torture.at
+++ b/tests/torture.at
@@ -942,6 +942,7 @@ AC_DEFINE_UNQUOTED([unq4], [${baz+set}], [unquoted, test 4])
 AC_DEFINE_UNQUOTED([unq5], ["${baz+`echo "a "' b'`}"], [unquoted, test 5])
 AC_DEFINE_UNQUOTED([unq6], [`echo hi`], [unquoted, test 6])
 AC_DEFINE_UNQUOTED([unq7], ['\\"'], [unquoted, test 7])
+AC_DEFINE_UNQUOTED([unq8], ["@S|@@{:@echo "a "' b'@:}@"], [unquoted, test 8])
 AC_PROG_AWK
 AC_CONFIG_FILES([Foo Zardoz])]])
 
@@ -976,6 +977,7 @@ address@hidden@
 #define unq5 "a  b"
 #define unq6 hi
 #define unq7 '\"'
+#define unq8 "a  b"
 ]])
 done
 AT_CLEANUP
-- 
2.13.5




reply via email to

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