Previous: Indir, Up: Definitions
Builtin macros can be called indirectly with builtin:
Results in a call to the builtin name, which is passed the rest of the arguments. If name does not name a builtin, an error message is printed, and the expansion is void.
The macro
builtinis recognized only with parameters.
This can be used even if name has been given another definition that has covered the original, or been undefined so that no macro maps to the builtin.
pushdef(`define', `hidden')
=>
undefine(`undefine')
=>
define(`foo', `bar')
=>hidden
foo
=>foo
builtin(`define', `foo', `BAR')
=>
foo
=>BAR
undefine(`foo')
=>undefine(foo)
foo
=>BAR
builtin(`undefine', `foo')
=>
foo
=>foo
The name argument only matches the original name of the builtin,
even when the --prefix-builtins option (or -P,
see Invoking m4) is in effect. This is different from indir,
which only tracks current macro names.
Note that indir and builtin can be used to invoke builtins
without arguments, even when they normally require parameters to be
recognized; but it will provoke a warning, and result in a void expansion.
builtin
=>builtin
builtin()
error-->m4:stdin:2: undefined builtin `'
=>
builtin(`builtin')
error-->m4:stdin:3: Warning: too few arguments to builtin `builtin'
=>
builtin(`builtin',)
error-->m4:stdin:4: undefined builtin `'
=>