m4: Dnl
1
1 8.1 Deleting whitespace in input
1 ================================
1
1 The builtin 'dnl' stands for "Discard to Next Line":
1
1 -- Builtin: dnl
1 All characters, up to and including the next newline, are discarded
1 without performing any macro expansion. A warning is issued if the
1 end of the file is encountered without a newline.
1
1 The expansion of 'dnl' is void.
1
1 It is often used in connection with 'define', to remove the newline
1 that follows the call to 'define'. Thus
1
1 define(`foo', `Macro `foo'.')dnl A very simple macro, indeed.
1 foo
1 =>Macro foo.
1
1 The input up to and including the next newline is discarded, as
1 opposed to the way comments are treated (⇒Comments).
1
1 Usually, 'dnl' is immediately followed by an end of line or some
1 other whitespace. GNU 'm4' will produce a warning diagnostic if 'dnl'
1 is followed by an open parenthesis. In this case, 'dnl' will collect
1 and process all arguments, looking for a matching close parenthesis.
1 All predictable side effects resulting from this collection will take
1 place. 'dnl' will return no output. The input following the matching
1 close parenthesis up to and including the next newline, on whatever line
1 containing it, will still be discarded.
1
1 dnl(`args are ignored, but side effects occur',
1 define(`foo', `like this')) while this text is ignored: undefine(`foo')
1 error->m4:stdin:1: Warning: excess arguments to builtin `dnl' ignored
1 See how `foo' was defined, foo?
1 =>See how foo was defined, like this?
1
1 If the end of file is encountered without a newline character, a
1 warning is issued and dnl stops consuming input.
1
1 m4wrap(`m4wrap(`2 hi
1 ')0 hi dnl 1 hi')
1 =>
1 define(`hi', `HI')
1 =>
1 ^D
1 error->m4:stdin:1: Warning: end of file treated as newline
1 =>0 HI 2 HI
1