Blob Blame History Raw
diff -urN autoconf-2.62/ChangeLog autoconf-2.62_new/ChangeLog
--- autoconf-2.62/ChangeLog	2008-06-24 15:18:34.000000000 +0200
+++ autoconf-2.62_new/ChangeLog	2008-06-24 15:24:35.000000000 +0200
@@ -1,3 +1,14 @@
+2008-06-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+	Fix '#undef variable /* comment */' transform in config headers.
+	* lib/autoconf/status.m4 (_AC_OUTPUT_HEADERS_PREPARE): For
+	undefined preprocessor macros that are followed by a comment
+	in the header template, do not create nested comments in the
+	output.
+	* tests/torture.at (@%:@define header templates): Extend test.
+	* NEWS: Update.
+	Report by Karsten Hopp <karsten@redhat.com>.
+
 2008-06-05  Eric Blake  <ebb9@byu.net>
 
 	Fix regression in AT_KEYWORDS([Macro]), from 2007-10-18.
diff -urN autoconf-2.62/lib/autoconf/status.m4 autoconf-2.62_new/lib/autoconf/status.m4
--- autoconf-2.62/lib/autoconf/status.m4	2008-04-06 01:04:48.000000000 +0200
+++ autoconf-2.62_new/lib/autoconf/status.m4	2008-06-24 15:21:54.000000000 +0200
@@ -832,9 +832,9 @@
   }
   split(mac1, mac2, "(") #)
   macro = mac2[1]
+  prefix = substr(line, 1, index(line, defundef) - 1)
   if (D_is_set[macro]) {
     # Preserve the white space surrounding the "#".
-    prefix = substr(line, 1, index(line, defundef) - 1)
     print prefix "define", macro P[macro] D[macro]
     next
   } else {
@@ -842,7 +842,7 @@
     # in the case of _POSIX_SOURCE, which is predefined and required
     # on some systems where configure will not decide to define it.
     if (defundef == "undef") {
-      print "/*", line, "*/"
+      print "/*", prefix defundef, macro, "*/"
       next
     }
   }
diff -urN autoconf-2.62/NEWS autoconf-2.62_new/NEWS
--- autoconf-2.62/NEWS	2008-06-24 15:18:34.000000000 +0200
+++ autoconf-2.62_new/NEWS	2008-06-24 15:25:28.000000000 +0200
@@ -25,6 +25,9 @@
    like '__restrict' if the variant spelling is available, as this is
    more likely to work when mixing C and C++ code.
 
+** Config header templates `#undef UNDEFINED /* comment */' do not lead to
+   nested comments any more; regression introduced in 2.62.
+
 ** AC_CHECK_ALIGNOF's type argument T is now documented better: it must
    be a string of tokens such that "T y;" is a valid member declaration
    in a struct.
diff -urN autoconf-2.62/tests/torture.at autoconf-2.62_new/tests/torture.at
--- autoconf-2.62/tests/torture.at	2008-04-06 01:04:48.000000000 +0200
+++ autoconf-2.62_new/tests/torture.at	2008-06-24 15:23:21.000000000 +0200
@@ -497,6 +497,8 @@
 #define str(define) \
 #define
 #define stringify(arg) str(arg)
+#undef aaa /* with comments */
+#undef not_substed /* with comments */
 ]])
 
 AT_CHECK_AUTOCONF
@@ -527,6 +529,8 @@
 #define str(define) \
 #define
 #define stringify(arg) str(arg)
+#define aaa AAA
+/* #undef not_substed */
 ]])
 AT_CHECK([cat config.h], 0, expout)