Add a New Comment (Rich Markup)
> So, M4-level `dnl` comments are one thing, but how about shell-level `#` comments?
Fun fact: `dnl ...` is not a comment as far as M4 is concerned, but `# ...` is ! See https://www.gnu.org/savannah-checkouts/gnu/m4/manual/html_node/Comments.html and https://www.gnu.org/savannah-checkouts/gnu/m4/manual/html_node/Dnl.html . We don't usually think of `# ...` as a M4 comment because it's included in the output, but the thing is, it's included in the output verbatim. An unquoted `#` (or more precisely, whatever the current "begin-comment delimiter" string is, see https://www.gnu.org/savannah-checkouts/gnu/m4/manual/html_node/Changecom.html ) tells M4 to copy text to the output (or current diversion) without macro expansion from that point until the end of the line (current "end-comment delimiter"). `dnl`, by contrast, is a built-in macro with abnormal argument syntax, and it can be disabled just like any other built-in macro. People use it for comments that they want stripped from the M4 output, but that's not what it was included in M4 for originally -- its actual design purpose is to join input lines (hence the acronym, "delete [the following] new line"). The bug here is precisely that autoupdate wants to preserve `dnl ...` comments in its output, but has no way to do so without also subjecting the `...` to macro expansion. This is what I meant by "a new feature in M4 itself -- allowing more than one comment starter to be active at once": if
undefine([dnl]) changecom([#],[ ],[dnl],[ ])
meant that either `#` or `dnl` began an M4-style comment -- copied verbatim to the output -- running until the end of the line, then autoupdate could use that to DTRT with the original test case.
> my style decision to combine the two into `dnl#` comments
I believe this stylistic change will also work around this particular bug in autoupdate, yes, except that you might want to double-check that it doesn't cause this
dnl# Check for the headers we need AC_CHECK_HEADERS_ONCE([foo.h bar.h])
to turn into nothing at all (i.e. the AC_CHECK_HEADERS_ONCE line is lost) when processed by either normal autoconf or autoupdate.
comment #1:
> Regrettably, I do not think it will be possible to make any improvements to autoupdate for 2.70. The algorithm it uses is already extremely brittle and I'm buried in regressions in automake itself. > > (What's going on here is, autoupdate runs M4 with an unusual set of macro definitions active: `AC_OUTPUT` is recognized as a macro, but `dnl` isn't. It's just another word. It might not be possible to improve the handling of this case without a new feature in M4 itself -- allowing more than one comment starter to be active at once.)
So, M4-level `dnl` comments are one thing, but how about shell-level `#` comments? Does "allowing more than one comment starter to be active at once" mean that my style decision to combine the two into `dnl#` comments (because I find that more readable) will actually start doing something?
Regrettably, I do not think it will be possible to make any improvements to autoupdate for 2.70. The algorithm it uses is already extremely brittle and I'm buried in regressions in automake itself. (What's going on here is, autoupdate runs M4 with an unusual set of macro definitions active: `AC_OUTPUT` is recognized as a macro, but `dnl` isn't. It's just another word. It might not be possible to improve the handling of this case without a new feature in M4 itself -- allowing more than one comment starter to be active at once.)
In the attached example configure.ac, there is a line
dnl AC_OUTPUT([Makefile])
and autoupdate 2.69c transforms it to
dnl AC_CONFIG_FILES([Makefile]) AC_OUTPUT
Since there is already an AC_OUTPUT invocation in the configure.ac file, now there are two AC_OUTPUT invocations! IMO, either autoupdate should leave comment lines untouched, or should add a 'dnl ' prefix to all continuation lines of the expansion.
(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)
Attach Files: Comment:
Depends on the following items: None found
Items that depend on this one: None found
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Only logged-in users can vote.
Please enter the title of George Orwell's famous dystopian book (it's a date):
Follow 3 latest changes.
Copyright © 2023 Free Software Foundation, Inc. Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. The Levitating, Meditating, Flute-playing Gnu logo is a GNU GPL'ed image provided by the Nevrax Design Team. Source Code
Powered by Savane 3.12