Hello Karsten, Thanks for the bug report.
* Karsten Hopp wrote on Wed, Jun 04, 2008 at 05:00:49PM CEST: > (second attempt, first one got stuck in the maintainer queue) Usually there is some latency due to the human involved in the first-time moderation, and/or the system involved in spam filtering. > https://bugzilla.redhat.com/show_bug.cgi?id=449245 lists two issues > after updating autoconf in Fedora to 2.62. > > - same line comments are now really broken where they worked before > even though this was discouraged. The documentation should probably > reflect this new behaviour if this breakage was intentionally. Either that, or the behaviour should be fixed. I prefer at least a simple fix. > - autoconf shouldn't temper with symbols it hasn't been told to > substitute. Well, that, however, is done intentionally; see this comment in lib/autoconf/status.m4: # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. (maybe we should document that?) Let's have a test case to see what happens: cat >configure.in <<\EOF AC_INIT AC_CONFIG_HEADER(config.h) AC_DEFINE([DEFINED_SYMBOL], [1]) if false; then AC_DEFINE([UNDEFINED_SYMBOL], [1]) fi AC_OUTPUT EOF cat >config.h.in <<\EOF #undef DEFINED_SYMBOL /* some comment */ #undef UNDEFINED_SYMBOL /* some other comment */ #undef DEFINED_SYMBOL #undef UNDEFINED_SYMBOL EOF Then, with Autoconf 2.13, 2.59, 2.61, 2.62, let's run autoconf ./configure to get the following config.h files, respectively: --- 2.13 --- /* config.h. Generated automatically by configure. */ #define DEFINED_SYMBOL 1 /* some comment */ /* #undef UNDEFINED_SYMBOL */ /* some other comment */ #define DEFINED_SYMBOL 1 /* #undef UNDEFINED_SYMBOL */ --- 2.59 --- /* config.h. Generated by configure. */ /* #undef DEFINED_SYMBOL */ /* some comment */ /* #undef UNDEFINED_SYMBOL */ /* some other comment */ #define DEFINED_SYMBOL 1 /* #undef UNDEFINED_SYMBOL */ --- 2.61 --- /* config.h. Generated from config.h.in by configure. */ #undef DEFINED_SYMBOL /* some comment */ #undef UNDEFINED_SYMBOL /* some other comment */ #define DEFINED_SYMBOL 1 /* #undef UNDEFINED_SYMBOL */ --- 2.62 --- /* config.h. Generated from config.h.in by configure. */ #define DEFINED_SYMBOL 1 /* #undef UNDEFINED_SYMBOL /* some other comment */ */ #define DEFINED_SYMBOL 1 /* #undef UNDEFINED_SYMBOL */ The commenting out of line 2 with 2.59 looks like a bug to me. Likewise, the first two #undef line with 2.61 look buggy to me. The fact that 2.62 removes the comment after the defined symbol looks like a QoI issue (i.e., would be nice to fix, but no error if not). The nested comment, however, is clearly undesirable. So here's a patch for a simple fix, to generates this instead: --- /* config.h. Generated from config.h.in by configure. */ #define DEFINED_SYMBOL 1 /* undef UNDEFINED_SYMBOL */ #define DEFINED_SYMBOL 1 /* undef UNDEFINED_SYMBOL */ --- Question is if that's good enough. Judging from autoconf history as seen above, comments have been problematic ever since 2.59. I haven't tried incomplete (multi-line) comments, or C++ style comments. I'm willing to add a test case after we've decided what to be desirable. Cheers, Ralf 2008-06-04 Ralf Wildenhues <[EMAIL PROTECTED]> * 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. * NEWS: Update. Report by Karsten Hopp <[EMAIL PROTECTED]>. diff --git a/NEWS b/NEWS index ccf4418..467c7b8 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,9 @@ GNU Autoconf NEWS - User visible changes. ** Autotest testsuites accept an option --jobs[=N] for parallel testing. Alternatively, testsuites can act as GNU make jobserver client. +** Config header templates `#undef UNDEFINED /* comment */' do not lead to + nested comments any more; regression introduced in 2.62. + * Major changes in Autoconf 2.62 (2008-04-05) [stable] Released by Eric Blake, based on git versions 2.61a.*. diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4 index 50be77b..d5ed323 100644 --- a/lib/autoconf/status.m4 +++ b/lib/autoconf/status.m4 @@ -832,9 +832,9 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 } 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 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # 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 } }
