Next: Frozen state, Previous: Preprocessor features, Up: Invoking m4 [Contents][Index]
There are some limits within m4
that can be tuned. For
compatibility, m4
also accepts some options that control limits
in other implementations, but which are automatically unbounded (limited
only by your hardware and operating system constraints) in GNU
m4
.
-g
--gnu
Enable all the extensions in this implementation. In this release of
M4, this option is always on by default; it is currently only useful
when overriding a prior use of --traditional. However, having
GNU behavior as default makes it impossible to write a
strictly POSIX-compliant client that avoids all incompatible
GNU M4 extensions, since such a client would have to use the
non-POSIX command-line option to force full POSIX
behavior. Thus, a future version of M4 will be changed to implicitly
use the option --traditional if the environment variable
POSIXLY_CORRECT
is set. Projects that intentionally use
GNU extensions should consider using --gnu to state
their intentions, so that the project will not mysteriously break if the
user upgrades to a newer M4 and has POSIXLY_CORRECT
set in their
environment.
-G
--traditional
Suppress all the extensions made in this implementation, compared to the System V version. See Compatibility, for a list of these.
-H num
--hashsize=num
Make the internal hash table for symbol lookup be num entries big. For better performance, the number should be prime, but this is not checked. The default is 65537 entries. It should not be necessary to increase this value, unless you define an excessive number of macros.
-L num
--nesting-limit=num
Artificially limit the nesting of macro calls to num levels, stopping program execution if this limit is ever exceeded. When not specified, nesting defaults to unlimited on platforms that can detect stack overflow, and to 1024 levels otherwise. A value of zero means unlimited; but then heavily nested code could potentially cause a stack overflow.
The precise effect of this option is more correctly associated
with textual nesting than dynamic recursion. It has been useful
when some complex m4
input was generated by mechanical means, and
also in diagnosing recursive algorithms that do not scale well.
Most users never need to change this option from its default.
This option does not have the ability to break endless
rescanning loops, since these do not necessarily consume much memory
or stack space. Through clever usage of rescanning loops, one can
request complex, time-consuming computations from m4
with useful
results. Putting limitations in this area would break m4
power.
There are many pathological cases: ‘define(`a', `a')a’ is
only the simplest example (but see Compatibility). Expecting GNU
m4
to detect these would be a little like expecting a compiler
system to detect and diagnose endless loops: it is a quite hard
problem in general, if not undecidable!
-B num
-S num
-T num
These options are present for compatibility with System V m4
, but
do nothing in this implementation. They may disappear in future
releases, and issue a warning to that effect.
-N num
--diversions=num
These options are present only for compatibility with previous
versions of GNU m4
, and were controlling the number of
possible diversions which could be used at the same time. They do nothing,
because there is no fixed limit anymore. They may disappear in future
releases, and issue a warning to that effect.
Next: Frozen state, Previous: Preprocessor features, Up: Invoking m4 [Contents][Index]