Previous: Set manipulation Macros, Up: Programming in M4sugar


8.3.10 Forbidden Patterns

M4sugar provides a means to define suspicious patterns, patterns describing tokens which should not be found in the output. For instance, if an Autoconf configure script includes tokens such as `AC_DEFINE', or `dnl', then most probably something went wrong (typically a macro was not evaluated because of overquotation).

M4sugar forbids all the tokens matching `^_?m4_' and `^dnl$'. Additional layers, such as M4sh and Autoconf, add additional forbidden patterns to the list.

— Macro: m4_pattern_forbid (pattern)

Declare that no token matching pattern must be found in the output. Comments are not checked; this can be a problem if, for instance, you have some macro left unexpanded after an `#include'. No consensus is currently found in the Autoconf community, as some people consider it should be valid to name macros in comments (which doesn't make sense to the authors of this documentation: input, such as macros, should be documented by `dnl' comments; reserving `#'-comments to document the output).

Of course, you might encounter exceptions to these generic rules, for instance you might have to refer to `$m4_flags'.

— Macro: m4_pattern_allow (pattern)

Any token matching pattern is allowed, including if it matches an m4_pattern_forbid pattern.