[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
head command line options
From: |
Eric Blake |
Subject: |
head command line options |
Date: |
Tue, 14 Nov 2006 05:57:47 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
I've been working on this long enough that it is ready to checkpoint. There
may still be minor issues that turn up in further testing.
2006-11-13 Eric Blake <address@hidden>
Add several new command line options.
* src/main.c (usage): Update.
(OPTSTRING, long_options): Add --pushdef, --popdef, --gnu,
--traceon, --traceoff, --syncoutput, --warnings, --unload-module.
Make --regexp-syntax argument optional.
(main): Support new options. Fix regression in interactive
behavior from Nov 8.
* m4/m4private.h (M4_OPT_SYNCOUTPUT_BIT): Rename from
M4_OPT_SYNC_OUTPUT_BIT.
* m4/m4module.h (m4_context_opt_bit_table): Rename sync_output to
syncoutput, to match option.
(m4_parse_truth_arg): New prototype.
* m4/utility.c (m4_parse_truth_arg): Implement it.
* m4/output.c (m4_shipout_text): Adjust sync_output caller.
* modules/gnu.c (syncoutput): Adjust sync_output caller, and use
m4_parse_truth_arg.
* doc/m4.texinfo (Operation modes, Dynamic loading features)
(Preprocessor features, Limits control, Debugging options)
(Command line files): Update documentation.
* tests/builtins.at (mkstemp): Simplify.
* tests/macros.at (Command line pushdef): New test.
(Command line define): Improve.
* tests/options.at (--traceon and --traceoff, --syncoutput): New
tests.
(POSIXLY_CORRECT): Likewise.
(deprecated options): Augment.
(--regexp-syntax): Update, now that -r takes optional arg.
* NEWS: Reformat. Document new options.
Index: NEWS
===================================================================
RCS file: /sources/m4/m4/NEWS,v
retrieving revision 1.31
diff -u -r1.31 NEWS
--- NEWS 27 Oct 2006 17:03:51 -0000 1.31
+++ NEWS 14 Nov 2006 05:57:01 -0000
@@ -2,500 +2,540 @@
Copyright (C) 1992, 1993, 1994, 1998, 2000, 2001, 2006 Free Software
Foundation, Inc.
-Version beta 1.9b - ???, by ??? (CVS version 1.9a)
+* Version beta 1.9b - ???, by ??? (CVS version 1.9a)
NOTE - there are still a number of FIXMEs to resolve before this can be
promoted to 2.0.
-* The build environment has been updated to modern GNU practices,
- depending on newer features of Autoconf, Automake, Libtool, Gettext,
- and Gnulib to be more portable to a wide variety of platforms.
-
-* If the POSIXLY_CORRECT environment variable is set, m4 now disables
- GNU extensions that are incompatible with POSIX.
- - FIXME: POSIXLY_CORRECT should imply -G, rather than being a separate
- conditional in the code. And we should have -g to override the
- environment. Also, the list of features incompatible with POSIX is
- still larger than what either flag currently affects.
+** Building M4
-* POSIXLY_CORRECT and `m4 --traditional' now makes the `define' builtin
+*** The build environment has been updated to modern GNU practices,
+ depending on newer features of Autoconf, Automake, Libtool, Gettext,
+ and Gnulib to be more portable to a wide variety of platforms.
+
+** New command line behavior
+
+*** If the POSIXLY_CORRECT environment variable is set, it implies the
+ `-G' and `-Q' options, effectively giving a more fully POSIX-compliant
+ implementation with only compatible GNU extensions.
+
+*** New `-b'/`--batch' command-line option to force non-interactive mode.
+ Also, in addition to `-e'/`--interactive' requesting interactive mode,
+ m4 now follows the lead of sh, and automatically enters interactive
+ mode when there are no files specified, and when both standard input
+ and standard error are terminals.
+
+*** New `-B'/`--prepend-include' command-line option allows prepending to
+ the include path, rather than always searching `.' first.
+
+*** The `-d'/`--debug' command-line option now understands `-' and `+'
+ modifiers, the way `debugmode' has always done. The option
+ `--debugmode' is added as an alias for `-d'.
+
+*** New `--debuglen' command-line option matches the spelling of a new
+ macro, and the old spelling `--arglength' now issues a warning that it
+ might be withdrawn in the future.
+
+*** New `-g'/`--gnu' command-line option overrides `-G'/`--traditional',
+ allowing the GNU module to be selected even when POSIXLY_CORRECT.
+
+*** The `-H'/`--hashsize' options, which were made no-ops in a previous
+ beta, now issue a deprecation warning.
+
+*** The `-L'/`--nesting-limit' command-line option now performs argument
+ validation and accepts an optional multiplier suffix.
+
+*** The `-o'/`--error-output' options, which were replaced by
+ `--debugfile' in M4 1.4.7, now issue a deprecation warning. This
+ warning interferes with all versions of Autoconf prior to 2.61, so plan
+ on installing an updated Autoconf when installing M4 2.0.
+
+*** New `-p'/`--pushdef' and `--popdef' command-line options allow more
+ control over macro definitions from the command line between input
+ files.
+
+*** New `-r'/`--regexp-syntax' command-line option changes the default
+ regular expression syntax used by M4. Without this option, M4
+ continues to use EMACS style expressions. A new section in the info
+ docs explains the differences between them, and what builtins are
+ affected.
+
+*** New `--safer' command-line option cripples the potentially unsafe
+ builtins `debugfile', `esyscmd', `maketemp', `mkdtemp', `mkstemp', and
+ `syscmd'.
+
+*** New `--syncoutput' command-line option matches the builtin added in a
+ previous beta, and provides more control over sync line generation
+ from the command line between input files. The previous options
+ `-s'/`--synclines' remain as aliases for `--syncoutput=1'.
+
+*** New `--traceoff' command-line option, and new spelling `--traceon' for
+ `--trace', allow more control over macro tracing from the command line
+ between input files.
+
+*** New `--unload-module' command-line option allows more control over
+ dynamic modules from the command line. Also, `-m'/`--load-module' now
+ acts between input files.
+
+*** New `--warnings' command-line option re-enables warnings, overriding
+ `-Q'/`--quiet'/`--silent', allowing warnings even when POSIXLY_CORRECT.
+
+** POSIX conformance
+
+*** POSIXLY_CORRECT and `m4 --traditional' now makes the `define' builtin
replace all `pushdef'ed values of a macro.
- FIXME: The Austin group clarified that this was never a POSIX
requirement; consider reverting this change.
-* The `defn' builtin now allows any number of arguments, as POSIX requires.
+*** The `defn' builtin now allows any number of arguments, as POSIX requires.
- FIXME: This still doesn't work with concatenating builtins with text.
-* The '$' syntax class is now enabled. See the manual for examples.
- FIXME: POSIX recommends using ${10} instead of $10 for the tenth
positional argument. We should deprecate $10.
-* New builtin `renamesyms' allows programmatic renaming of all symbols
- according to a regular expression.
+ - FIXME: `m4wrap' semantics need an update to FIFO.
+
+** Removed builtins
+
+*** The experimental `epatsubst' and `eregexp' builtins have been removed
+ in favor of a new `changeresyntax' builtin.
+
+** New builtins
+
+*** New `changeresyntax' builtin allows programmtic setting of the default
+ regular expression flavor, to match `-r'/`--regexp-syntax' command-line
+ option.
+
+*** A new builtin `debuglen' is introduced which allows runtime setting
+ of debug output length, previously controlled only by the `-l' command
+ line argument. Additionally, whether using the new macro or the
+ command line argument, the length limitation now affects dumpdef output
+ as well as trace output, undergoes argument validation, and accepts an
+ optional multiplier suffix.
+ - FIXME the multiplier suffix isn't reliable yet
+
+*** New builtin `mkdtemp' parallels `mkstemp', but allows the creation of
+ temporary directories instead of files.
+
+*** New `renamesyms' builtin allows programmatic renaming of all symbols
+ according to a regular expression.
- FIXME: This feature can cause core dumps when renaming multiple
symbols to the same name.
-* The `builtin' macro now has a special form, where if the first argument
- is exactly the special token representing defn(`builtin'), the expansion
- is the special token representing the builtin named in the second
- argument. This allows regenerating a macro with a more efficient
- mapping directly to a builtin function, rather than through textual
- indirection through further expansions of `builtin'.
-
-* New `-r'/`--regexp-syntax' command-line option changes the default
- regular expression syntax used by M4. Without this option, M4 continues
- to use EMACS style expressions. A new section in the info docs
- explains the differences between them, and what builtins are affected.
-
-* The experimental `epatsubst' and `eregexp' have been removed in favor
- of a new `changeresyntax' builtin.
-
-* `patsubst' and `regexp' have a new optional 4th argument to use a
- different regular expression syntax for the duration of that invocation.
-
-* New `-B'/`--prepend-include' command-line option allows prepending to
- the include path, rather than always searching `.' first.
-
-* New `--safer' command-line option cripples the potentially unsafe
- macros `debugfile', `esyscmd', `maketemp', `mkdtemp', `mkstemp', and
- `syscmd'.
-
-* The `maketemp' builtin now always warns that it is obsolete, even in GNU
- mode where it uses the same secure algorithm as `mkstemp', because of
- the recommendation of POSIX to obsolete `maketemp' as inherently
- insecure when obeying POSIX.
-
-* New builtin `mkdtemp' parallels `mkstemp', but allows the creation of
- temporary directories instead of files.
-
-* New `-b'/`--batch' command line option to force non-interactive mode.
- Also, in addition to `-e'/`--interactive' requesting interactive mode, m4
- now follows the lead of sh, and automatically enters interactive mode
- when there are no files specified, and when both standard input and
- standard error are terminals.
-
-* New `m' flag to `-d'/`--debug' option or `debugmode' macro traces
- actions related to module loading and unloading, and affects `dumpdef'
- and trace output to show where builtins come from. New `s' flag shows
- the entire stack of `pushdef' definitions during `dumpdef'. The `c' flag
- has been updated to output two lines instead of three (since the last two
- had always been paired), and to add information to the first line to show
- the definition of the macro being expanded. The 'e' flag has been
- updated to output non-text expansions. Also, the `--debug' option now
- understands `-' and `+' modifiers, the way `debugmode' has always done.
- The option `--debugmode' is added as an alias for `-d'.
-
-* The semantics of `traceon' and `traceoff' now match traditional
- implementations: when called without arguments, they affect global state
- rather than affecting only the macros defined at that moment. The
- manual includes an example of how to recover 1.4.x semantics.
+*** The `modules' and `symbols' builtins, introduced in previous betas,
+ have been renamed `m4modules' and `m4symbols', in order to minimize
+ problems when upgrading from 1.4.x and processing English text. To
+ prevent future problems, any future macro added as a GNU extension will
+ either be blind (ie. be unrecognized without arguments), or begin with
+ the prefix `m4' or `__'.
+
+** Changed behavior of builtins
+
+*** The '$' syntax class to the `changeresyntax' builtin is now enabled.
+ See the manual for examples.
+
+*** The `builtin' builtin now has a special form, where if the first
+ argument is exactly the special token representing defn(`builtin'), the
+ expansion is the special token representing the builtin named in the
+ second argument. This allows regenerating a macro with a more
+ efficient mapping directly to a builtin function, rather than through
+ textual indirection through further expansions of `builtin'.
+
+*** New `m' flag to `-d'/`--debug' option or `debugmode' macro traces
+ actions related to module loading and unloading, and affects `dumpdef'
+ and trace output to show where builtins come from. New `s' flag shows
+ the entire stack of `pushdef' definitions during `dumpdef'. The `c'
+ flag has been updated to output two lines instead of three (since the
+ last two had always been paired), and to add information to the first
+ line to show the definition of the macro being expanded. The 'e' flag
+ has been updated to output non-text expansions.
+
+*** The `dumpdef' macro now always outputs to standard error, rather than
+ the debug file specified by the `--debugfile' option or `debugfile'
+ macro.
+
+*** The `maketemp' builtin now always warns that it is obsolete, even in GNU
+ mode where it uses the same secure algorithm as `mkstemp', because of
+ the recommendation of POSIX to obsolete `maketemp' as inherently
+ insecure when obeying POSIX.
+
+*** The `patsubst' and `regexp' builtins have a new optional 4th argument
+ to use a different regular expression syntax for the duration of that
+ invocation.
+
+*** The semantics of `traceon' and `traceoff' now match traditional
+ implementations: when called without arguments, they affect global
+ state rather than affecting only the macros defined at that moment.
+ The manual includes an example of how to recover 1.4.x semantics.
+
+** Other changes
-* The syntax of frozen files format V2 has been improved to save
- additional state.
+*** The syntax of frozen files format V2 has been improved to save
+ additional state.
- FIXME: format 2 still needs to be tweaked to allow complete ASCII
representation and to catch any more missing state; once 2.0 is released,
any further changes would introduce format 3.
-* The `-o'/`--error-output' options, which were replaced by
- `--debugfile' in M4 1.4.7, now issue a deprecation warning. This warning
- interferes with all versions of Autoconf prior to 2.61, so plan on
- installing an updated Autoconf when installing M4 2.0.
-
-* The `-H'/`--hashsize' options, which were made no-ops in a previous
- beta, now issue a deprecation warning.
-
-* The `dumpdef' macro now always outputs to standard error, rather than
- the debug file specified by the `--debugfile' option or `debugfile'
- macro.
-
-* The builtins `modules' and `symbols', introduced in previous betas,
- have been renamed `m4modules' and `m4symbols', in order to minimize
- problems when upgrading from 1.4.x and processing English text. To
- prevent future problems, any future macro added as a GNU extension will
- either be blind (ie. be unrecognized without arguments), or begin with
- the prefix `m4' or `__'.
-
-* A new builtin `debuglen' is introduced which allows runtime setting
- of debug output length, previously controlled only by the `-l' command
- line argument. A new command line argument `--debuglen' matches the
- spelling of the new macro, and the old spelling `--arglength' now issues
- a warning that it might be withdrawn in the future. Additionally,
- whether using the new macro or the command line argument, the length
- limitation now affects dumpdef output as well as trace output, undergoes
- argument validation, and accepts an optional multiplier suffix.
-
-* The `-L'/`--nesting-limit' command line option can now be set to 0
- to remove the default limit. However, it is still possible that heavily
- nested input can cause abrupt program termination due to stack
- overflow. Also, the option now performs argument validation and accepts
- an optional multiplier suffix.
-
-* The `--help' and `--version' command line options now consistently
- override all earlier options. For example, `m4 -otrace --help' now no
- longer accidentally creates an empty file `trace'.
-
-* The builtin `divert' now uses memory proportional to the number of
- diversions created, rather than to the maximum diversion number
- encountered, allowing larger diversion numbers without exhausting system
- memory.
+FIXME: include the (long) list of changes in 1.4.x that were not already
+ in earlier betas.
+* Version 1.4.8
+* Version 1.4.7
+* Version 1.4.6
+* Version 1.4.5
-* FIXME: `m4wrap' semantics need an update to FIFO.
+* Version beta 1.4q - August 2001, by Gary V. Vaughan
-* FIXME: include the (long) list of changes in 1.4.x that were not already
- in earlier betas.
+** Support for the experimental `changeword' has been dropped.
-Version beta 1.4q - August 2001, by Gary V. Vaughan
+** `m4 --hashsize' and `-H' are still accepted, but have no effect. M4
+ will grow its internal symbol table if the symbol density is having an
+ effect on performance.
-* Support for the experimental `changeword' has been dropped.
+** `configure --without-modules' will build an m4 binary with no preloaded
+ modules. At startup it will search for and load modules `m4' and either
+ `gnu' or `traditional'. This mode of operation can be used for
+ development and debugging of the base modules without the need to
+ recompile all of m4 with each modification.
-* `m4 --hashsize' and `-H' are still accepted, but have no effect. M4
- will grow its internal symbol table if the symbol density is having
- an effect on performance.
+** `configure --with-modules="gnu m4 traditional load"', for example,
+ will build an m4 binary with the named modules preloaded, ready to be
+ activated (even on static lib only machines) with the `-m' option or
+ using the `load' builtin.
-* `configure --without-modules' will build an m4 binary with no preloaded
- modules. At startup it will search for and load modules `m4' and either
- `gnu' or `traditional'. This mode of operation can be used for
- development and debugging of the base modules without the need to
- recompile all of m4 with each modification.
+** M4 has no builtins or macros in core, they are all loaded from modules
+ at startup. This means that modules are no longer optional, though the
+ standard build will statically link the modules `m4', `gnu' and
+ `traditional', so even on machines with no ltdl support, all of the
+ functionality from previous releases is available.
-* `configure --with-modules="gnu m4 traditional load"', for example,
- will build an m4 binary with the named modules preloaded, ready to
- be activated (even on static lib only machines) with the `-m' option
- or using the `load' builtin.
+** New builtin `load' to dynamically load modules which can define new
+ builtins and user macros.
-* M4 has no builtins or macros in core, they are all loaded from modules
- at startup. This means that modules are no longer optional, though
- the standard build will statically link the modules `m4', `gnu' and
- `traditional', so even on machines with no ltdl support, all of the
- functionality from previous releases is available.
+** New builtin `unload' to remove loaded modules (and the builtins and user
+ macros they define) from the running m4 interpreter.
-* New builtin `load' to dynamically load modules which can define new
- builtins and user macros.
+** New builtins `eregexp' and `epatsubst' to use Extended Regular
+ Expressions syntax in lieu of Basic Regular Expressions as used by
+ `regexp' and `patsubst'.
-* New builtin `unload' to remove loaded modules (and the builtins and user
- macros they define) from the running m4 interpreter.
+** The names of all currently loaded modules are returned by the new
+ builtin, ``modules''.
-* New builtins `eregexp' and `epatsubst' to use Extended Regular Expressions
- syntax in lieu of Basic Regular Expressions as used by `regexp' and
- `patsubst'.
+** Loadable modules can define new builtin functions or text expansion
+ macros.
-* The names of all currently loaded modules are returned by the new
- builtin, ``modules''.
+** The module code has been rewritten to use libltdl, the libtool dynamic
+ loader, which means GNU m4 can now load (and unload) modules just about
+ anywhere which it can be built. This includes obscure hosts such as
+ cygwin and BeOS, and also on hosts which do not have shared libraries,
+ through preloading (see libtool manual) and GNU dld.
-* Loadable modules can define new builtin functions or text expansion
- macros.
+** Modules can now be built without the m4 source being available using the
+ installed m4module.h header file (and some other headers that it
+ includes for you), and the installed libm4.la libtool library. All
+ symbols exported from libm4.la have a prefix of `m4_' or `M4_'. See the
+ modules directory for examples of usage.
-* The module code has been rewritten to use libltdl, the libtool dynamic
- loader, which means GNU m4 can now load (and unload) modules just about
- anywhere which it can be built. This includes obscure hosts such as
- cygwin and BeOS, and also on hosts which do not have shared libraries,
- through preloading (see libtool manual) and GNU dld.
+** A new V2 format for frozen files that saves module and syntax information.
-* Modules can now be built without the m4 source being available using the
- installed m4module.h header file (and some other headers that it includes
- for you), and the installed libm4.la libtool library. All symbols
- exported from libm4.la have a prefix of `m4_' or `M4_'. See the modules
- directory for examples of usage.
+* Version beta 1.4o - January 2000, by Rene' Seindal
-* A new V2 format for frozen files that saves module and syntax information.
+** Modules can be loaded from the command line with --load-module
-Version beta 1.4o - January 2000, by Rene' Seindal
+** Modules now use libtool's wrapper libltdl.
-* Modules can be loaded from the command line with --load-module
+** New builtin `symbols' allows dynamic queries of all currently defined
+ macros.
-* Modules now use libtool's wrapper libltdl.
+** Various Bug fixes.
-* New builtin `symbols' allows dynamic queries of all currently defined
- macros.
+* Version beta 1.4n - November 1998, by Rene' Seindal
-* Bug fixes.
+** The module code has been reorganised yet again, and now compiles
+ correctly on GNU/Linux, HPUX 9 and 10, SunOS 5 and Solaris 5.
-Version beta 1.4n - November 1998, by Rene' Seindal
+** When configured --with-gmp a new builtin `mpeval' is now defined. The
+ builtin `eval' retains its normal behaviour.
-* The module code has been reorganised yet again, and now compiles
- correctly on GNU/Linux, HPUX 9 and 10, SunOS 5 and Solaris 5.
+** m4 --version also shows which options were used for compilation, such as:
+ "GNU m4 1.4n (options: modules gmp changeword)"
-* When configured --with-gmp a new builtin `mpeval' is now defined. The
- builtin `eval' retains its normal behaviour.
+** New option --import-environment defines all environment variables as
+ macros. This is done before -D and -U are handled, so the macros can be
+ changed through these options.
-* m4 --version also shows which options were used for compilation, such as:
- "GNU m4 1.4n (options: modules gmp changeword)"
+** Error messages now always print program name before input file name as
+ specified by GNU coding standards. Reported by Akim Demaille.
-* New option --import-environment defines all environment variables as
- macros. This is done before -D and -U are handled, so the macros can be
- changed through these options.
+** Bug fixed: "undivert(0)" could cause m4 to read standard output. A call
+ of "undivert(0)" is now silently ignored.
-* Error messages now always print program name before input file name as
- specified by GNU coding standards. Reported by Akim Demaille
- <address@hidden>.
+** Bug fixed: when compiling --with-included-gettext, <libintl.h> wasn't
+ found in intl/ directory. Reported by Andrew Bettison.
-* Bug fixed: "undivert(0)" could cause m4 to read standard output. A call
- of "undivert(0)" is now silently ignored.
+* Version beta 1.4m - November 1998, by Rene' Seindal
-* Bug fixed: when compiling --with-included-gettext, <libintl.h> wasn't
- found in intl/ directory. Reported by Andrew Bettison
- <address@hidden>.
+** Using libtool for compiling modules and for linking main app.
-Version beta 1.4m - November 1998, by Rene' Seindal
+** Reorganised the dynamic module code to encapsulate system dependencies
+ better. The code for HPUX shl_load() still needs testing and debugging.
+ A dld interface is also missing. Any volunteers?
-* Using libtool for compiling modules and for linking main app.
+** The files from the GNU m4 web-site is now in examples/WWW as a more
+ complete example of what GNU m4 can do.
-* Reorganised the dynamic module code to encapsulate system dependencies
- better. The code for HPUX shl_load() still needs testing and debugging.
- A dld interface is also missing. Any volunteers?
+* Version beta 1.4l - November 1998, by Rene' Seindal
-* The files from the GNU m4 web-site is now in examples/WWW as a more
- complete example of what GNU m4 can do.
+** GNU m4 now has an escape syntax category. If a character is marked as
+ an escape, words are only recognised as macros if preceded by an escape
+ character. It is a bit like -P, but dynamic: it can be turned on and
+ off. The GNU m4 web-site on http://www.seindal.dk/rene/gnu/ is
+ maintained with this feature - the m4 source is available on the site.
-Version beta 1.4l - November 1998, by Rene' Seindal
+** The module interface is improved, thanks to "Brian J. Fox",
+ who has contributed some code from Meta-HTML. The modules now build
+ automatically and installs properly, by default in
+ /usr/local/libexec/m4. There is a preliminary, untested support for
+ shl_load().
-* GNU m4 now has an escape syntax category. If a character is marked as
- an escape, words are only recognised as macros if preceded by an escape
- character. It is a bit like -P, but dynamic: it can be turned on and
- off. The GNU m4 web-site on http://www.seindal.dk/rene/gnu/ is
- maintained with this feature - the m4 source is available on the site.
+** There is now a __m4_version__ macro that expands to the current version
+ number.
-* The module interface is improved, thanks to "Brian J. Fox"
- <address@hidden>, who have contributed some code from Meta-HTML. The
- modules now build automatically and installs properly, by default in
- /usr/local/libexec/m4. There is a preliminary, untested support for
- shl_load().
+* Version beta 1.4k - November 1998, by Erick Branderhorst and Rene' Seindal
-* There is now a __m4_version__ macro that expands to the current version
- number.
+** GNU m4 now uses gettext to support internationalization.
-Version beta 1.4k - November 1998, by Erick Branderhorst and Rene' Seindal
+** GNU m4 now uses automake to control Makefile.in generation. This
+ should make it more consistent with the GNU standards.
-* GNU m4 now uses gettext to support internationalization.
+** GNU m4 will use the gmp library for multiple precision integral and
+ rational arithmetic in `eval' if configured with `--with-gmp'. If
+ configured without `--with-gmp' or if gmp is not available, and the type
+ `long long int' is, GNU m4 will use that for `eval' arithmetic.
-* GNU m4 now uses automake to control Makefile.in generation. This
- should make it more consistent with the GNU standards.
+** GNU m4 now parses the input according to a syntax table, that can be
+ modified through the new builtin `changesyntax'. It is a generalisation
+ of the existing builtins `changecom' and `changequote'. The changes are
+ completely backwards compatible (except for the existence of
+ `changesyntax').
-* GNU m4 will use the gmp library for multiple precision integral and
- rational arithmetic in `eval' if configured with `--with-gmp'. If
- configured without `--with-gmp' or if gmp is not available, and the type
- `long long int' is, GNU m4 will use that for `eval' arithmetic.
+** Sync lines can be turned on and off with the `syncoutput' builtin. The
+ builtin `syncoutput' is a GNU extension.
-* GNU m4 now parses the input according to a syntax table, that can be
- modified through the new builtin `changesyntax'. It is a generalisation
- of the existing builtins `changecom' and `changequote'. The changes are
- completely backwards compatible (except for the existence of
- `changesyntax').
+** New experimental feature: dynamically loadable modules. New builtin
+ `loadmodules' loads shared libraries, that can define new builtin
+ macros, ie, new macros can be written in C. Depends on the dlopen()
+ interface, and is currently only tested on Linux. Enabled at configure
+ time with `--with-modules'. Documentation is in src/module.c and
+ module/README.
-* Sync lines can be turned on and off with the `syncoutput' builtin. The
- builtin `syncoutput' is a GNU extension.
+** Implement a GNU message catalog for French (Franc,ois Pinard).
-* New experimental feature: dynamically loadable modules. New builtin
- `loadmodules' loads shared libraries, that can define new builtin
- macros, ie, new macros can be written in C. Depends on the dlopen()
- interface, and is currently only tested on Linux. Enabled at configure
- time with `--with-modules'. Documentation is in src/module.c and
- module/README.
+** Filenames found through path searches are now correctly reflected in
+ error and debug messages and through the `__file__' macro.
-* Implement a GNU message catalog for French (Franc,ois Pinard).
+** Bugs fixed:
-* Filenames found through path searches are now correctly reflected in
- error and debug messages and through the `__file__' macro.
+*** All 8-bit characters can now be used for quotes.
-Bugs fixed
+FIXME: include the (long) list of changes in 1.4.x that were not already
+ in earlier betas.
+* Version 1.4.4
+* Version 1.4.3
+* Version 1.4.2
+* Version 1.4.1
-* All 8-bit characters can now be used for quotes.
+* Version 1.4 - October 1994, by Franc,ois Pinard
-
-Version 1.4 - October 1994, by Franc,ois Pinard
+** (No user visible changes)
-(No user visible changes)
+* Version 1.3 - September 1994, by Franc,ois Pinard
-
-Version 1.3 - September 1994, by Franc,ois Pinard
+** Diversions are created as needed. Option `-N' is still accepted, but
+ otherwise ignored. Users should use only negative diversion numbers,
+ instead of high positive numbers, for diverting to nowhere.
-* Diversions are created as needed. Option `-N' is still accepted, but
-otherwise ignored. Users should use only negative diversion numbers,
-instead of high positive numbers, for diverting to nowhere.
+** Diversions should also work faster. No temporary files will be needed
+ at all if all diversions taken altogether do not use more than 512K.
-* Diversions should also work faster. No temporary files will be needed
-at all if all diversions taken altogether do not use more than 512K.
+** Frozen state files may be produced with the `--freeze-state' (-F)
+ option and later brought back through the `--reload-state' (-R) option.
-* Frozen state files may be produced with the `--freeze-state' (-F)
-option and later brought back through the `--reload-state' (-R) option.
+* Version 1.2 - July 1994, by Franc,ois Pinard
-
-Version 1.2 - July 1994, by Franc,ois Pinard
+** In patsubst(STRING, REGEXP, REPLACEMENT), \& in REPLACEMENT has been
+ changed to represent this part of STRING matched by the whole REGEXP,
+ instead of the whole STRING as before. \0 does the same, but emits a
+ diagnostic saying it will disappear in some subsequent release.
-* In patsubst(STRING, REGEXP, REPLACEMENT), \& in REPLACEMENT has been
-changed to represent this part of STRING matched by the whole REGEXP,
-instead of the whole STRING as before. \0 does the same, but emits a
-diagnostic saying it will disappear in some subsequent release.
+** eval(EXPR) emits a diagnostic if EXPR has suffixed crumb. The same for
+ other numeric conversions in incr(), decr(), divert(), etc.
-* eval(EXPR) emits a diagnostic if EXPR has suffixed crumb. The same for
-other numeric conversions in incr(), decr(), divert(), etc.
+** `--fatal-warnings' (-E) stops execution at first warning.
-* `--fatal-warnings' (-E) stops execution at first warning.
+** `--nesting-limit=LEVEL' (-L LEVEL) sets a limit to macro nesting.
+ It is initially fixed at 250.
-* `--nesting-limit=LEVEL' (-L LEVEL) sets a limit to macro nesting.
-It is initially fixed at 250.
+** `--word-regexp=REGEXP' (-W REGEXP) modifies macro name syntax, like
+ does the new `changeword(REGEXP)' macro. This feature is experimental,
+ tell me your opinions about it. You do need --enable-changeword at
+ configure time to get these things. Do *not* depend on them yet.
-* `--word-regexp=REGEXP' (-W REGEXP) modifies macro name syntax, like
-does the new `changeword(REGEXP)' macro. This feature is experimental,
-tell me your opinions about it. You do need --enable-changeword at
-configure time to get these things. Do *not* depend on them yet.
+** Trace output format is scannable by GNU Emacs' next-error function.
-* Trace output format is scannable by GNU Emacs' next-error function.
+** Stack overflow is detected and diagnosed on some capable systems.
-* Stack overflow is detected and diagnosed on some capable systems.
+** Various bugs have been corrected, m4 should be more portable. See the
+ ChangeLog for details.
-* Various bugs have been corrected, m4 should be more portable. See the
-ChangeLog for details.
+* Version 1.1 - November 1993, by Franc,ois Pinard
-
-Version 1.1 - November 1993, by Franc,ois Pinard
+** Changes which might affect existing GNU m4 scripts:
-Changes which might affect existing GNU m4 scripts:
+*** Option `-V' has been removed, use `--version' instead. `--version'
+ writes on standard output instead of standard error, and inhibits any
+ script execution.
-* Option `-V' has been removed, use `--version' instead. `--version'
-writes on standard output instead of standard error, and inhibits any
-script execution.
+*** `--no-gnu-extensions' has been renamed `--traditional'.
-* `--no-gnu-extensions' has been renamed `--traditional'.
+*** In `eval', `^' used to indicate exponentiation, use `**' instead.
-* In `eval', `^' used to indicate exponentiation, use `**' instead.
+*** The automatic undiversion which takes place at end of all input is
+ forced into the main output stream.
-* The automatic undiversion which takes place at end of all input is
-forced into the main output stream.
+** Changes which are unlikely to affect existing scripts:
-Changes which are unlikely to affect existing scripts:
+*** `--help' prints an usage summary on standard output. Script execution
+ is then inhibited.
-* `--help' prints an usage summary on standard output. Script execution
-is then inhibited.
+*** `--prefix-builtins' (-P) prefixes all builtin macros by `m4_'.
-* `--prefix-builtins' (-P) prefixes all builtin macros by `m4_'.
+*** Most builtin macros for which arguments are mandatory, called without
+ any arguments, are no more recognized as builtin macros: they are
+ consequently copied verbatim to the output stream.
-* Most builtin macros for which arguments are mandatory, called without
-any arguments, are no more recognized as builtin macros: they are
-consequently copied verbatim to the output stream.
+*** `define' and `pushdef' are usable with only one argument, they give
+ this argument an empty definition.
-* `define' and `pushdef' are usable with only one argument, they give
-this argument an empty definition.
+*** `eval' new operators for binary representation handling: `^' for
+ exclusive-or, `~' for the bitwise negation, `<<' and `>>' for shifts.
-* `eval' new operators for binary representation handling: `^' for
-exclusive-or, `~' for the bitwise negation, `<<' and `>>' for shifts.
+*** `eval' recognizes the notation 0bDIGITS for binary numbers and the
+ notation 0rRADIX:DIGITS for numbers in any radix from 1 to 36.
-* `eval' recognizes the notation 0bDIGITS for binary numbers and the
-notation 0rRADIX:DIGITS for numbers in any radix from 1 to 36.
-
-Version 1.0.3 - December 1992, by Franc,ois Pinard
+* Version 1.0.3 - December 1992, by Franc,ois Pinard
-Changes for the user:
+** Changes for the user:
-* `dnl' outputs a diagnostic if immediately followed by `('. Usually,
-`dnl' is followed by newline or whitespace.
+*** `dnl' outputs a diagnostic if immediately followed by `('. Usually,
+ `dnl' is followed by newline or whitespace.
-* `ifelse' accepts without complaining the common idiom of having only
-one argument. This is useful for introducing long comments.
+*** `ifelse' accepts without complaining the common idiom of having only
+ one argument. This is useful for introducing long comments.
-* `eval' always expresses values as signed, whatever the radix.
+*** `eval' always expresses values as signed, whatever the radix.
-* M4OPTS environment variable is no longer obeyed.
+*** M4OPTS environment variable is no longer obeyed.
-* `--no-warnings' option is renamed `--silent'.
+*** `--no-warnings' option is renamed `--silent'.
-* Debug lines use a new format more compatible with GNU standards.
+*** Debug lines use a new format more compatible with GNU standards.
-* Various bugs have been corrected. See the ChangeLog for details.
+*** Various bugs have been corrected. See the ChangeLog for details.
-Changes for the installer:
+** Changes for the installer:
-* GNU m4 now uses an Autoconf-generated configure script, and should be
-more easily portable in many ways. (Cray is not supported yet).
+*** GNU m4 now uses an Autoconf-generated configure script, and should be
+ more easily portable in many ways. (Cray is not supported yet).
-* `make check' has been made more portable, expect no errors.
+*** `make check' has been made more portable, expect no errors.
-Changes for the programmer:
+** Changes for the programmer:
-* Sources have been fully reindented to comply with GNU standards, and
-cleaned up in many ways.
+*** Sources have been fully reindented to comply with GNU standards, and
+ cleaned up in many ways.
-* Sources have been protoized. Non-ANSI compilers are automatically
-detected, then sources are unprotoized on the fly before compilation.
+*** Sources have been protoized. Non-ANSI compilers are automatically
+ detected, then sources are unprotoized on the fly before compilation.
-* GNU m4 uses newer versions of obstack, regex, getopt, etc.
-
-Version 1.0 - October 1991, by Rene' Seindal
+*** GNU m4 uses newer versions of obstack, regex, getopt, etc.
-* Uses GNU configure, taken from the gdb distribution.
+* Version 1.0 - October 1991, by Rene' Seindal
-* Uses GNU getopt(), with long option names.
+** Uses GNU configure, taken from the gdb distribution.
-* The -Q/+quiet option is added, which suppresses warnings about missing
-or superflous arguments to builtin macros.
+** Uses GNU getopt(), with long option names.
-* Added default options via the M4OPTS environment variable.
+** The -Q/+quiet option is added, which suppresses warnings about missing
+ or superflous arguments to builtin macros.
-* Several minor bugs have been fixed.
-
-Version 0.99 - July 1991, by Rene' Seindal
+** Added default options via the M4OPTS environment variable.
-* The builtins `incr' and `decr' are now implemented without use of
-`eval'.
+** Several minor bugs have been fixed.
-* The builtin `indir' is added, to allow for indirect macro calls
-(allows use of "illegal" macro names).
+* Version 0.99 - July 1991, by Rene' Seindal
-* The debugging and tracing facilities has been enhanced considerably.
-See the manual for details.
+** The builtins `incr' and `decr' are now implemented without use of
+ `eval'.
-* The -tMACRO option is added, marks MACRO for tracing as soon as it
-is defined.
+** The builtin `indir' is added, to allow for indirect macro calls
+ (allows use of "illegal" macro names).
-* Builtins are traced after renaming iff they were before.
+** The debugging and tracing facilities has been enhanced considerably.
+ See the manual for details.
-* Named files can now be undiverted.
+** The -tMACRO option is added, marks MACRO for tracing as soon as it
+ is defined.
-* The -Nnum option can be used to increase the number of divertions
-available.
+** Builtins are traced after renaming iff they were before.
-* Calling changecom without arguments now disables all comment handling.
+** Named files can now be undiverted.
-* A bug in `dnl' is fixed.
+** The -Nnum option can be used to increase the number of divertions
+ available.
-* A bug in the multi-character quoting code is fixed.
+** Calling changecom without arguments now disables all comment handling.
-* Several typos in the manual has been corrected. More probably persist.
-
-Version 0.75 - November 1990, by Rene' Seindal
+** A bug in `dnl' is fixed.
-* Implemented search path for include files (-I option and M4PATH
-environment variable).
+** A bug in the multi-character quoting code is fixed.
-* Implemented builtin `format' for printf-like formatting.
+** Several typos in the manual has been corrected. More probably persist.
-* Implemented builtin `regexp' for searching for regular expressions.
+* Version 0.75 - November 1990, by Rene' Seindal
-* Implemented builtin `patsubst' for substitution with regular
-expressions.
+** Implemented search path for include files (-I option and M4PATH
+ environment variable).
-* Implemented builtin `esyscmd', which expands to a shell commands output.
+** Implemented builtin `format' for printf-like formatting.
-* Implemented `__file__' and `__line__' for use in error messages.
+** Implemented builtin `regexp' for searching for regular expressions.
-* Implemented character ranges in `translit'.
+** Implemented builtin `patsubst' for substitution with regular
+ expressions.
-* Implemented control over debugging output.
+** Implemented builtin `esyscmd', which expands to a shell commands output.
-* Implemented multi-character quotes.
+** Implemented `__file__' and `__line__' for use in error messages.
-* Implemented multi-character comment delimiters.
+** Implemented character ranges in `translit'.
-* Changed predefined macro `gnu' to `__gnu__'.
+** Implemented control over debugging output.
-* Changed predefined macro `unix' to `__unix__', when the -G option is
-not used. With -G, `unix' is still defined.
+** Implemented multi-character quotes.
-* Added program name to error messages.
+** Implemented multi-character comment delimiters.
-* Fixed two missing null bytes bugs.
-
-Version 0.50 - January 1990, by Rene' Seindal
+** Changed predefined macro `gnu' to `__gnu__'.
+
+** Changed predefined macro `unix' to `__unix__', when the -G option is
+ not used. With -G, `unix' is still defined.
+
+** Added program name to error messages.
+
+** Fixed two missing null bytes bugs.
+
+* Version 0.50 - January 1990, by Rene' Seindal
* Initial beta release.
Index: doc/m4.texinfo
===================================================================
RCS file: /sources/m4/m4/doc/m4.texinfo,v
retrieving revision 1.78
diff -u -r1.78 m4.texinfo
--- doc/m4.texinfo 11 Nov 2006 14:00:28 -0000 1.78
+++ doc/m4.texinfo 14 Nov 2006 05:57:01 -0000
@@ -607,8 +607,8 @@
@item -E
@itemx --fatal-warnings
-Stop execution and exit @code{m4} once the first warning has been
-issued, considering all of them to be fatal.
+Stop execution and exit @code{m4} once the first warning or error has
+been issued, considering all of them to be fatal.
@item -i
@itemx --interactive
@@ -639,15 +639,17 @@
calls, or treating the empty string as zero. Error messages are still
printed. The distinction between error and warning is fuzzy, and if
you encounter a situation where the message output did not match your
-expectations, please report that as a bug.
+expectations, please report that as a bug. This option is implied if
address@hidden is set in the environment.
address@hidden -r @var{RESYNTAX-SPEC}
address@hidden address@hidden
address@hidden address@hidden@address@hidden
address@hidden address@hidden@address@hidden
Set the regular expression syntax according to @var{RESYNTAX-SPEC}.
-When this option is not given, @acronym{GNU} M4 uses emacs compatible
-regular expressions. @xref{Changeresyntax}, for more details on the
-format and meaning of @var{RESYNTAX-SPEC}. This option may be given
-more than once, and order with respect to file names is significant.
+When this option is not given, @var{RESYNTAX-SPEC} is omitted,
address@hidden M4 uses emacs compatible regular expressions.
address@hidden, for more details on the format and meaning of
address@hidden This option may be given more than once, and order
+with respect to file names is significant.
@item --safer
Cripple the builtins @code{maketemp}, @code{mkstemp} (@pxref{Mkstemp}),
@@ -656,6 +658,14 @@
since they can perform potentially unsafe actions. An attempt to use
these macros will result in an error. This option is intended to make
it safer to preprocess an input file of unknown origin.
+
address@hidden -W
address@hidden --warnings
+Enable warnings. Warnings are on by default unless
address@hidden was set in the environment; this option exists to
+allow overriding @option{--silent}.
address@hidden FIXME should we accept -Wall, -Wnone, -Wcategory,
address@hidden -Wno-category...?
@end table
@node Dynamic loading features
@@ -673,14 +683,19 @@
@item -m @var{MODULE}
@itemx address@hidden
-Load @var{MODULE} before parsing input files. @var{MODULE} is searched
-for in each directory of the module search path, until the first match
-is found or the list is exhausted. @xref{Modules}, for more details.
-By default, the modules @samp{m4}, @samp{traditional}, and @samp{gnu}
-are preloaded, although this can be controlled during configuration
-with the @option{--with-modules} option to
+Load @var{MODULE} before parsing more input files. @var{MODULE} is
+searched for in each directory of the module search path, until the
+first match is found or the list is exhausted. @xref{Modules}, for more
+details. By default, the modules @samp{m4}, @samp{traditional}, and
address@hidden are preloaded, although this can be controlled during
+configuration with the @option{--with-modules} option to
@address@hidden/@/configure}. This option may be given more
than once, and order with respect to file names is significant.
+
address@hidden address@hidden
+Unload @var{MODULE} before parsing more input files. @xref{Modules},
+for more details. This option may be given more than once, and order
+with respect to file names is significant.
@end table
@node Preprocessor features
@@ -694,11 +709,6 @@
input came from. These features occur with the following options:
@table @code
address@hidden --import-environment
-Imports every variable in the environment as a macro. This is done
-before @option{-D} and @option{-U}, so they can override the
-environment.
-
@item -B @var{DIRECTORY}
@itemx address@hidden
Make @code{m4} search @var{DIRECTORY} for included files, prior to
@@ -722,15 +732,41 @@
file names is significant, and redefining the same @var{NAME} loses the
previous value.
address@hidden --import-environment
+Imports every variable in the environment as a macro. This is done
+before @option{-D} and @option{-U}, so they can override the
+environment.
+
@item -I @var{DIRECTORY}
@itemx address@hidden
Make @code{m4} search @var{DIRECTORY} for included files that are not
found in the current working directory. @xref{Search Path}, for more
details. This option may be given more than once.
address@hidden address@hidden
+This deletes the top-most meaning @var{NAME} might have. Obviously,
+only predefined macros can be deleted in this way. This option may be
+given more than once; popping a @var{NAME} that does not have a
+definition is silently ignored. Order is significant with respect to
+file names.
+
address@hidden -p @address@hidden@address@hidden
address@hidden address@hidden@address@hidden@r{]}
+This enters @var{NAME} into the symbol table, before any input files are
+read. If @address@hidden is missing, the value is taken to be the
+empty string. The @var{VALUE} can be any string, and the macro can be
+defined to take arguments, just as if it was defined from within the
+input. This option may be given more than once; order with respect to
+file names is significant, and redefining the same @var{NAME} adds
+another definition to its stack.
+
@item -s
@itemx --synclines
-Generate synchronization lines, for use by the C preprocessor or other
+Short for @option{--syncoutput=1}, turning synchronization lines on.
+
address@hidden address@hidden@r{]}
+Control the generation of synchronization lines from the command line.
+Synchronization lines are for use by the C preprocessor or other
similar tools. Order is significant with respect to file names. This
option is useful, for example, when @code{m4} is used as a
front end to a compiler. Source file name and line number information
@@ -745,7 +781,9 @@
themselves. When a synchronization discrepancy occurs in the middle of
an output line, the associated synchronization directive is delayed
until the beginning of the next generated line. @xref{Syncoutput}, for
-runtime control.
+runtime control. @var{TRUTH} is interpreted the same as the argument to
address@hidden; if @var{TRUTH} is omitted, or @option{--syncoutput}
+is not used, synchronization lines are disabled.
@item -U @var{NAME}
@itemx address@hidden
@@ -766,16 +804,18 @@
@code{m4}.
@table @code
address@hidden FIXME - clean this up. POSIXLY_CORRECT should imply -G (as
address@hidden well as -Q), such that POSIX and traditional are identical.
address@hidden We should also provide -g, to match BSD implementations, which
address@hidden enables GNU mode and overrides POSIXLY_CORRECT in the
address@hidden environment.
address@hidden -g
address@hidden --gnu
+Enable all the extensions in this implementation. This is on by
+default unless @env{POSIXLY_CORRECT} is set in the environment; it
+exists to allow overriding @option{--traditional}.
+
@item -G
@itemx --traditional
Suppress all the extensions made in this implementation, compared to the
System V version. @xref{Compatibility}, for a list of these. This
loads the @samp{traditional} module in place of the @samp{gnu} module.
+It is implied if @env{POSIXLY_CORRECT} is set in the environment.
@item -L @var{NUM}
@itemx address@hidden
@@ -808,14 +848,17 @@
@item -H @var{NUM}
@itemx address@hidden
address@hidden -N @var{NUM}
address@hidden -N @var{NUM}
@itemx address@hidden
-These options are present only for compatibility with previous
-versions of GNU @code{m4}. They do nothing except issue a warning,
-because the symbol table size and number of diversions are not fixed
-anymore. They will eventually disappear in future releases.
address@hidden address@hidden
+These options are present only for compatibility with previous versions
+of GNU @code{m4}. They do nothing except issue a warning, because the
+symbol table size and number of diversions are not fixed anymore, and
+because the new @code{changesyntax} feature is more efficient than the
+withdrawn experimental @code{changeword}. These options will eventually
+disappear in future releases.
address@hidden -S @var{NUM}
address@hidden -S @var{NUM}
@itemx -T @var{NUM}
These options are present for compatibility with System V @code{m4}, but
do nothing in this implementation. They may disappear in future
@@ -896,10 +939,17 @@
@item -t @var{NAME}
@itemx address@hidden
address@hidden address@hidden
This enables tracing for the macro @var{NAME}, at any point where it is
defined. @var{NAME} need not be defined when this option is given.
This option may be given more than once, and order is significant with
respect to file names. @xref{Trace}, for more details.
+
address@hidden address@hidden
+This disables tracing for the macro @var{NAME}, at any point where it is
+defined. @var{NAME} need not be defined when this option is given.
+This option may be given more than once, and order is significant with
+respect to file names. @xref{Trace}, for more details.
@end table
@node Command line files
@@ -923,10 +973,10 @@
@comment interactive use when switching to stdin in a non-default parse
@comment state.
-The options @option{--define} (@option{-D}), @option{--undefine}
+Various options, such as @option{--define} (@option{-D}), @option{--undefine}
(@option{-U}), @option{--synclines} (@option{-s}), @option{--trace}
(@option{-t}), @option{--regexp-syntax} (@option{-r}), and
address@hidden (@option{-m}) only take effect after processing
address@hidden (@option{-m}), only take effect after processing
input from any file names that occur earlier on the command line. For
example, assume the file @file{foo} contains:
Index: m4/m4module.h
===================================================================
RCS file: /sources/m4/m4/m4/m4module.h,v
retrieving revision 1.100
diff -u -r1.100 m4module.h
--- m4/m4module.h 11 Nov 2006 16:21:25 -0000 1.100
+++ m4/m4module.h 14 Nov 2006 05:57:01 -0000
@@ -103,13 +103,12 @@
#define M4ARG(i) (argc > (i) ? m4_get_symbol_value_text (argv[i]) : "")
-extern bool m4_bad_argc (m4 *, int, m4_symbol_value **,
- unsigned int, unsigned int, bool);
-extern bool m4_numeric_arg (m4 *, int, m4_symbol_value **,
- int, int *);
-extern void m4_dump_args (m4 *, m4_obstack *, int,
- m4_symbol_value **, const char *,
- bool);
+extern bool m4_bad_argc (m4 *, int, m4_symbol_value **,
+ unsigned int, unsigned int, bool);
+extern bool m4_numeric_arg (m4 *, int, m4_symbol_value **, int, int *);
+extern void m4_dump_args (m4 *, m4_obstack *, int,
+ m4_symbol_value **, const char *, bool);
+extern bool m4_parse_truth_arg (m4 *, const char *, const char *, bool);
/* Error handling. */
extern void m4_error (m4 *, int, int, const char *, ...) M4_GNUC_PRINTF (4, 5);
@@ -155,7 +154,7 @@
M4OPT_BIT(M4_OPT_SUPPRESS_WARN_BIT, suppress_warnings_opt) \
M4OPT_BIT(M4_OPT_DISCARD_COMMENTS_BIT, discard_comments_opt) \
M4OPT_BIT(M4_OPT_INTERACTIVE_BIT, interactive_opt) \
- M4OPT_BIT(M4_OPT_SYNC_OUTPUT_BIT, sync_output_opt) \
+ M4OPT_BIT(M4_OPT_SYNCOUTPUT_BIT, syncoutput_opt) \
M4OPT_BIT(M4_OPT_POSIXLY_CORRECT_BIT, posixly_correct_opt) \
M4OPT_BIT(M4_OPT_FATAL_WARN_BIT, fatal_warnings_opt) \
M4OPT_BIT(M4_OPT_SAFER_BIT, safer_opt) \
Index: m4/m4private.h
===================================================================
RCS file: /sources/m4/m4/m4/m4private.h,v
retrieving revision 1.72
diff -u -r1.72 m4private.h
--- m4/m4private.h 11 Nov 2006 16:21:25 -0000 1.72
+++ m4/m4private.h 14 Nov 2006 05:57:01 -0000
@@ -79,7 +79,7 @@
#define M4_OPT_SUPPRESS_WARN_BIT (1 << 1) /* -Q */
#define M4_OPT_DISCARD_COMMENTS_BIT (1 << 2) /* -c */
#define M4_OPT_INTERACTIVE_BIT (1 << 3) /* -e */
-#define M4_OPT_SYNC_OUTPUT_BIT (1 << 4) /* -s */
+#define M4_OPT_SYNCOUTPUT_BIT (1 << 4) /* -s */
#define M4_OPT_POSIXLY_CORRECT_BIT (1 << 5) /* POSIXLY_CORRECT */
#define M4_OPT_FATAL_WARN_BIT (1 << 6) /* -E */
#define M4_OPT_SAFER_BIT (1 << 7) /* --safer */
@@ -124,8 +124,8 @@
(BIT_TEST((C)->opt_flags, M4_OPT_DISCARD_COMMENTS_BIT))
# define m4_get_interactive_opt(C) \
(BIT_TEST((C)->opt_flags, M4_OPT_INTERACTIVE_BIT))
-# define m4_get_sync_output_opt(C) \
- (BIT_TEST((C)->opt_flags, M4_OPT_SYNC_OUTPUT_BIT))
+# define m4_get_syncoutput_opt(C) \
+ (BIT_TEST((C)->opt_flags, M4_OPT_SYNCOUTPUT_BIT))
# define m4_get_posixly_correct_opt(C)
\
(BIT_TEST((C)->opt_flags, M4_OPT_POSIXLY_CORRECT_BIT))
# define m4_get_fatal_warnings_opt(C) \
Index: m4/output.c
===================================================================
RCS file: /sources/m4/m4/m4/output.c,v
retrieving revision 1.38
diff -u -r1.38 output.c
--- m4/output.c 11 Nov 2006 14:00:28 -0000 1.38
+++ m4/output.c 14 Nov 2006 05:57:01 -0000
@@ -183,8 +183,8 @@
while (gl_list_iterator_next (&iter, &elt, NULL))
{
diversion = (m4_diversion *) elt;
- if (!diversion->size && diversion->u.file &&
- close_stream_temp (diversion->u.file) != 0)
+ if (!diversion->size && diversion->u.file
+ && close_stream_temp (diversion->u.file) != 0)
{
error (0, errno,
_("cannot clean temporary file for diversion"));
@@ -431,7 +431,7 @@
/* Output TEXT to a file, or in-memory diversion buffer. */
- if (!m4_get_sync_output_opt (context))
+ if (!m4_get_syncoutput_opt (context))
switch (length)
{
Index: m4/utility.c
===================================================================
RCS file: /sources/m4/m4/m4/utility.c,v
retrieving revision 1.55
diff -u -r1.55 utility.c
--- m4/utility.c 11 Nov 2006 14:00:28 -0000 1.55
+++ m4/utility.c 14 Nov 2006 05:57:01 -0000
@@ -115,6 +115,31 @@
}
}
+
+/* Parse ARG as a truth value. If unrecognized, issue a warning on
+ behalf of ME and return PREVIOUS; otherwise return the parsed
+ value. */
+bool
+m4_parse_truth_arg (m4 *context, const char *arg, const char *me,
+ bool previous)
+{
+ /* 0, no, off, blank... */
+ if (!arg || arg[0] == '\0'
+ || arg[0] == '0'
+ || arg[0] == 'n' || arg[0] == 'N'
+ || ((arg[0] == 'o' || arg[0] == 'O')
+ && (arg[1] == 'f' || arg[1] == 'F')))
+ return false;
+ /* 1, yes, on... */
+ if (arg[0] == '1'
+ || arg[0] == 'y' || arg[0] == 'Y'
+ || ((arg[0] == 'o' || arg[0] == 'O')
+ && (arg[1] == 'n' || arg[1] == 'N')))
+ return true;
+ m4_warn (context, 0, _("%s: unknown directive `%s'"), me, arg);
+ return previous;
+}
+
/* Issue an error. The message is printf-style, based on FORMAT and
any other arguments, and the program name and location (if we are
currently parsing an input file) are automatically prepended. If
Index: modules/gnu.c
===================================================================
RCS file: /sources/m4/m4/modules/gnu.c,v
retrieving revision 1.67
diff -u -r1.67 gnu.c
--- modules/gnu.c 11 Nov 2006 16:21:25 -0000 1.67
+++ modules/gnu.c 14 Nov 2006 05:57:01 -0000
@@ -825,29 +825,15 @@
/* This contains macro which implements syncoutput() which takes one arg
1, on, yes - turn on sync lines
- 0, off, no - turn off sync lines
+ 0, off, no, blank - turn off sync lines
everything else is silently ignored */
/**
- * syncoutput(SYNC?)
+ * syncoutput(TRUTH)
**/
M4BUILTIN_HANDLER (syncoutput)
{
- const char *arg = M4ARG (1);
-
- if (arg[0] == '\0'
- || arg[0] == '0'
- || arg[0] == 'n'
- || arg[0] == 'N'
- || ((arg[0] == 'o' || arg[0] == 'O')
- && (arg[1] == 'f' || arg[1] == 'F')))
- m4_set_sync_output_opt (context, false);
- else if (arg[0] == '1'
- || arg[0] == 'y'
- || arg[0] == 'Y'
- || ((arg[0] == 'o' || arg[0] == 'O')
- && (arg[1] == 'n' || arg[1] == 'N')))
- m4_set_sync_output_opt (context, true);
- else
- m4_warn (context, 0, _("%s: unknown directive `%s'"), M4ARG (0), arg);
+ bool value = m4_get_syncoutput_opt (context);
+ value = m4_parse_truth_arg (context, M4ARG (1), M4ARG (0), value);
+ m4_set_syncoutput_opt (context, value);
}
Index: src/main.c
===================================================================
RCS file: /sources/m4/m4/src/main.c,v
retrieving revision 1.102
diff -u -r1.102 main.c
--- src/main.c 11 Nov 2006 14:00:28 -0000 1.102
+++ src/main.c 14 Nov 2006 05:57:01 -0000
@@ -71,11 +71,11 @@
printf (_("Usage: %s [OPTION]... [FILE]...\n"), m4_get_program_name ());
fputs (_("\
Process macros in FILEs.\n\
-If no FILE or if FILE is `-', standard input is read. With no FILE and both\n\
-standard input and standard output are terminals, -e is implied.\n\
+If no FILE or if FILE is `-', standard input is read. If no FILE, and both\n\
+standard input and standard output are terminals, -i is implied.\n\
"), stdout);
+ puts ("");
fputs (_("\
-\n\
Mandatory or optional arguments to long options are mandatory or optional\n\
for short options too.\n\
\n\
@@ -86,59 +86,70 @@
fputs (_("\
-b, --batch buffer output, process interrupts\n\
-c, --discard-comments do not copy comments to the output\n\
- -E, --fatal-warnings stop execution after first warning\n\
+ -E, --fatal-warnings stop execution after first warning or error\n\
-i, --interactive unbuffer output, ignore interrupts\n\
-P, --prefix-builtins force a `m4_' prefix to all builtins\n\
-Q, --quiet, --silent suppress some warnings for builtins\n\
- -r, --regexp-syntax=SPEC change the default regexp syntax\n\
+ -r, --regexp-syntax[=SPEC] set default regexp syntax to SPEC [EMACS]\n\
--safer disable potentially unsafe builtins\n\
+ -W, --warnings enable all warnings\n\
"), stdout);
+ puts ("");
fputs (_("\
-\n\
SPEC is any one of:\n\
AWK, BASIC, BSD_M4, ED, EMACS, EXTENDED, GNU_AWK, GNU_EGREP, GNU_M4,\n\
GREP, POSIX_AWK, POSIX_EGREP, MINIMAL, MINIMAL_BASIC, SED.\n\
"), stdout);
+ puts ("");
printf (_("\
-\n\
Dynamic loading features:\n\
-M, --module-directory=DIR add DIR to module search path before\n\
`%s'\n\
-m, --load-module=MODULE load dynamic MODULE\n\
+ --unload-module=MODULE unload dynamic MODULE\n\
"), PKGLIBEXECDIR);
+ puts ("");
fputs (_("\
-\n\
Preprocessor features:\n\
- --import-environment import all environment variables as macros\n\
-B, --prepend-include=DIR add DIR to include path before `.'\n\
-D, --define=NAME[=VALUE] define NAME as having VALUE, or empty\n\
+ --import-environment import all environment variables as macros\n\
-I, --include=DIR add DIR to include path after `.'\n\
- -s, --synclines generate `#line NUM \"FILE\"' lines\n\
+"), stdout);
+ fputs (_("\
+ --popdef=NAME popdef NAME\n\
+ -p, --pushdef=NAME[=VALUE] pushdef NAME as having VALUE, or empty\n\
+ -s, --synclines short for --syncoutput=1\n\
+ --syncoutput[=STATE] set generation of `#line NUM \"FILE\"' lines\n\
+ to STATE (0=off, 1=on, default 0 if omitted)\n\
-U, --undefine=NAME undefine NAME\n\
"), stdout);
+ puts ("");
fputs (_("\
-\n\
Limits control:\n\
+ -g, --gnu override -G to re-enable GNU extensions\n\
-G, --traditional suppress all GNU extensions\n\
-L, --nesting-limit=NUMBER change artificial nesting limit [1024]\n\
"), stdout);
+ puts ("");
fputs (_("\
-\n\
Frozen state files:\n\
-F, --freeze-state=FILE produce a frozen state on FILE at end\n\
-R, --reload-state=FILE reload a frozen state from FILE at start\n\
"), stdout);
+ puts ("");
fputs (_("\
-\n\
Debugging:\n\
-d, --debug[=FLAGS], --debugmode[=FLAGS]\n\
set debug level (no FLAGS implies `aeq')\n\
--debugfile=FILE redirect debug and trace output\n\
-l, --debuglen=NUM restrict macro tracing size\n\
- -t, --trace=NAME trace NAME when it is defined\n\
+ -t, --trace=NAME, --traceon=NAME\n\
+ trace NAME when it is defined\n\
+ --traceoff=NAME no longer trace NAME\n\
"), stdout);
+ puts ("");
fputs (_("\
-\n\
FLAGS is any of:\n\
a show actual arguments in trace\n\
c show definition line in trace\n\
@@ -156,19 +167,24 @@
x include unique macro call id in trace, useful with c\n\
V shorthand for all of the above flags\n\
"), stdout);
+ puts ("");
fputs (_("\
-\n\
If defined, the environment variable `M4PATH' is a colon-separated list\n\
of directories included after any specified by `-I', and the variable\n\
`M4MODPATH' is a colon-separated list of directories searched before any\n\
-specified by `-M'.\n\
+specified by `-M'. The environment variable `POSIXLY_CORRECT' implies\n\
+-G -Q; otherwise GNU extensions are enabled by default.\n\
"), stdout);
+ puts ("");
fputs (_("\
-\n\
Exit status is 0 for success, 1 for failure, 63 for frozen file version\n\
mismatch, or whatever value was passed to the m4exit macro.\n\
"), stdout);
- printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
+ puts ("");
+ /* TRANSLATORS: the placeholder indicates the bug-reporting
+ address for this application. Please add _another line_ with
+ the address for translation bugs. */
+ printf (_("Report bugs to <%s>.\n"), PACKAGE_BUGREPORT);
}
exit (status);
}
@@ -183,8 +199,13 @@
ERROR_OUTPUT_OPTION, /* not quite -o, because of message */
HASHSIZE_OPTION, /* not quite -H, because of message */
IMPORT_ENVIRONMENT_OPTION, /* no short opt */
+ POPDEF_OPTION, /* no short opt */
PREPEND_INCLUDE_OPTION, /* not quite -B, because of message */
SAFER_OPTION, /* -S still has old no-op
semantics */
+ SYNCOUTPUT_OPTION, /* not quite -s, because of opt arg */
+ TRACEOFF_OPTION, /* no short opt */
+ UNLOAD_MODULE_OPTION, /* no short opt */
+ WORD_REGEXP_OPTION, /* deprecated, used to be -W */
HELP_OPTION, /* no short opt */
VERSION_OPTION /* no short opt */
@@ -201,21 +222,24 @@
{"discard-comments", no_argument, NULL, 'c'},
{"fatal-warnings", no_argument, NULL, 'E'},
{"freeze-state", required_argument, NULL, 'F'},
+ {"gnu", no_argument, NULL, 'g'},
{"include", required_argument, NULL, 'I'},
{"interactive", no_argument, NULL, 'i'},
{"load-module", required_argument, NULL, 'm'},
{"module-directory", required_argument, NULL, 'M'},
{"nesting-limit", required_argument, NULL, 'L'},
{"prefix-builtins", no_argument, NULL, 'P'},
+ {"pushdef", required_argument, NULL, 'p'},
{"quiet", no_argument, NULL, 'Q'},
- {"regexp-syntax", required_argument, NULL, 'r'},
+ {"regexp-syntax", optional_argument, NULL, 'r'},
{"reload-state", required_argument, NULL, 'R'},
{"silent", no_argument, NULL, 'Q'},
{"synclines", no_argument, NULL, 's'},
{"trace", required_argument, NULL, 't'},
+ {"traceon", required_argument, NULL, 't'},
{"traditional", no_argument, NULL, 'G'},
{"undefine", required_argument, NULL, 'U'},
- {"word-regexp", required_argument, NULL, 'W'},
+ {"warnings", no_argument, NULL, 'W'},
{"arglength", required_argument, NULL, ARGLENGTH_OPTION},
{"debugfile", required_argument, NULL, DEBUGFILE_OPTION},
@@ -223,8 +247,13 @@
{"hashsize", required_argument, NULL, HASHSIZE_OPTION},
{"error-output", required_argument, NULL, ERROR_OUTPUT_OPTION},
{"import-environment", no_argument, NULL, IMPORT_ENVIRONMENT_OPTION},
+ {"popdef", required_argument, NULL, POPDEF_OPTION},
{"prepend-include", required_argument, NULL, PREPEND_INCLUDE_OPTION},
{"safer", no_argument, NULL, SAFER_OPTION},
+ {"syncoutput", optional_argument, NULL, SYNCOUTPUT_OPTION},
+ {"traceoff", required_argument, NULL, TRACEOFF_OPTION},
+ {"unload-module", required_argument, NULL, UNLOAD_MODULE_OPTION},
+ {"word-regexp", required_argument, NULL, WORD_REGEXP_OPTION},
{"help", no_argument, NULL, HELP_OPTION},
{"version", no_argument, NULL, VERSION_OPTION},
@@ -237,7 +266,7 @@
behavior also handles -s between files. Starting OPTSTRING with
'-' forces getopt_long to hand back file names as arguments to opt
'\1', rather than reordering the command line. */
-#define OPTSTRING "-B:D:EF:GH:I:L:M:N:PQR:S:T:U:bcd::eil:m:o:r:st:"
+#define OPTSTRING "-B:D:EF:GH:I:L:M:N:PQR:S:T:U:Wbcd::egil:m:o:p:r::st:"
/* For determining whether to be interactive. */
enum interactive_choice
@@ -332,7 +361,11 @@
#endif
if (getenv ("POSIXLY_CORRECT"))
- m4_set_posixly_correct_opt (context, true);
+ {
+ m4_set_no_gnu_extensions_opt (context, true);
+ m4_set_posixly_correct_opt (context, true);
+ m4_set_suppress_warnings_opt (context, true);
+ }
/* First, we decode the arguments, to size up tables and stuff.
Avoid lasting side effects; for example 'm4 --debugfile=oops
@@ -369,13 +402,26 @@
optchar);
break;
+ case WORD_REGEXP_OPTION:
+ /* Supported in 1.4.x as -W, but no longer present. */
+ error (0, 0, _("Warning: `%s' is deprecated"), "--word-regexp");
+ break;
+
+ case 's':
+ optchar = SYNCOUTPUT_OPTION;
+ optarg = "1";
+ /* fall through */
case 'D':
case 'U':
case 'm':
+ case 'p':
case 'r':
- case 's':
case 't':
case '\1':
+ case POPDEF_OPTION:
+ case SYNCOUTPUT_OPTION:
+ case TRACEOFF_OPTION:
+ case UNLOAD_MODULE_OPTION:
/* Arguments that cannot be handled until later are accumulated. */
defn = xmalloc (sizeof *defn);
@@ -389,6 +435,9 @@
tail->next = defn;
tail = defn;
+ if (optchar == '\1')
+ seen_file = true;
+
break;
case 'B':
@@ -458,6 +507,13 @@
frozen_file_to_read = optarg;
break;
+ case 'W':
+ /* FIXME - should W take an optional argument, to allow -Wall,
+ -Wnone, -Werror, -Wcategory, -Wno-category? If so, then have
+ -W == -Wall. */
+ m4_set_suppress_warnings_opt (context, false);
+ break;
+
case 'b':
interactive = INTERACTIVE_NO;
break;
@@ -487,6 +543,11 @@
interactive = INTERACTIVE_YES;
break;
+ case 'g':
+ m4_set_no_gnu_extensions_opt (context, false);
+ m4_set_posixly_correct_opt (context, false);
+ break;
+
case ARGLENGTH_OPTION:
error (0, 0, _("Warning: `%s' is deprecated, use `%s' instead"),
"--arglength", "--debuglen");
@@ -537,7 +598,7 @@
m4_set_interactive_opt (context, (interactive == INTERACTIVE_YES
|| (interactive == INTERACTIVE_UNKNOWN
- && optind == argc
+ && optind == argc && !seen_file
&& isatty (STDIN_FILENO)
&& isatty (STDERR_FILENO))));
if (m4_get_interactive_opt (context))
@@ -596,6 +657,7 @@
switch (defines->code)
{
case 'D':
+ case 'p':
{
m4_symbol_value *value = m4_symbol_value_create ();
@@ -608,7 +670,10 @@
m4_set_symbol_value_text (value, xstrdup (macro_value
? macro_value : ""));
- m4_symbol_define (M4SYMTAB, macro_name, value);
+ if (defines->code == 'D')
+ m4_symbol_define (M4SYMTAB, macro_name, value);
+ else
+ m4_symbol_pushdef (M4SYMTAB, macro_name, value);
free (macro_name);
}
break;
@@ -618,7 +683,8 @@
break;
case 'm':
- m4_module_load (context, arg, 0);
+ /* FIXME - should loading a module result in output? */
+ m4_module_load (context, arg, NULL);
break;
case 'r':
@@ -631,19 +697,38 @@
}
break;
- case 's':
- m4_set_sync_output_opt (context, true);
- break;
-
case 't':
m4_set_symbol_name_traced (M4SYMTAB, arg, true);
break;
case '\1':
- seen_file = true;
read_stdin |= process_file (context, arg);
break;
+ case POPDEF_OPTION:
+ if (m4_symbol_lookup (M4SYMTAB, arg))
+ m4_symbol_popdef (M4SYMTAB, arg);
+ break;
+
+ case SYNCOUTPUT_OPTION:
+ {
+ bool previous = m4_get_syncoutput_opt (context);
+ m4_set_syncoutput_opt (context,
+ m4_parse_truth_arg (context, arg,
+ "--syncoutput",
+ previous));
+ }
+ break;
+
+ case TRACEOFF_OPTION:
+ m4_set_symbol_name_traced (M4SYMTAB, arg, false);
+ break;
+
+ case UNLOAD_MODULE_OPTION:
+ /* FIXME - should unloading a module result in output? */
+ m4_module_unload (context, arg, NULL);
+ break;
+
default:
assert (!"INTERNAL ERROR: bad code in deferred arguments");
abort ();
Index: tests/builtins.at
===================================================================
RCS file: /sources/m4/m4/tests/builtins.at,v
retrieving revision 1.33
diff -u -r1.33 builtins.at
--- tests/builtins.at 11 Nov 2006 14:00:29 -0000 1.33
+++ tests/builtins.at 14 Nov 2006 05:57:01 -0000
@@ -624,15 +624,8 @@
maketemp(no_such_dir/XXXXXX)
]])
dnl Abuse our knowledge of AT_CHECK_M4 so that we can get stderr filtering...
-POSIXLY_CORRECT=1
-export POSIXLY_CORRECT
-AT_CHECK_M4([-G --safer], [0], [stdout],
-[[m4:stdin:1: Warning: maketemp: recommend using mkstemp instead
-m4:stdin:2: Warning: maketemp: recommend using mkstemp instead
-m4:stdin:3: Warning: maketemp: recommend using mkstemp instead
-m4:stdin:4: Warning: maketemp: recommend using mkstemp instead
-m4:stdin:5: Warning: maketemp: recommend using mkstemp instead
-]], [stdin& echo $! > pid; wait $!])
+AT_CHECK_M4([-G -Q --safer], [0], [stdout], [],
+[stdin& echo $! > pid; wait $!])
pid=`cat pid`
cat >expout <<EOF
Index: tests/macros.at
===================================================================
RCS file: /sources/m4/m4/tests/macros.at,v
retrieving revision 1.11
diff -u -r1.11 macros.at
--- tests/macros.at 8 Nov 2006 19:06:01 -0000 1.11
+++ tests/macros.at 14 Nov 2006 05:57:01 -0000
@@ -130,6 +130,63 @@
foo
]])
+dnl Test that -D and -U interact in correct order
+AT_DATA([in], [[foo
+]])
+AT_CHECK_M4([-Dfoo=bar in -Ufoo in], [0], [[bar
+foo
+]])
+AT_CHECK_M4([-Ufoo in -Dfoo=bar in], [0], [[foo
+bar
+]])
+
+AT_CLEANUP
+
+
+
+## -------------------- ##
+## Command line pushdef ##
+## -------------------- ##
+
+AT_SETUP([Command line pushdef])
+
+dnl Test that -p after last file still affects m4wrap'd text.
+AT_DATA([in1], [[m4wrap(`foo
+')foo
+]])
+AT_DATA([in2], [[foo
+]])
+AT_CHECK_M4([-pfoo=1 in1 -pfoo=2 in2 -pfoo=3], [0],
+[[1
+2
+3
+]])
+
+dnl Test that -p adds a definition.
+AT_DATA([in1], [[define(`foo', `1')pushdef(`foo', `2')dnl
+]])
+AT_DATA([in2], [[foo
+popdef(`foo')foo
+popdef(`foo')foo
+]])
+AT_CHECK_M4([in1 -pfoo=3 in2], [0],
+[[3
+2
+1
+]])
+
+dnl Test that --pushdef and --popdef interact in correct order
+AT_DATA([in], [[foo
+]])
+AT_CHECK_M4([-Dfoo=1 --pushdef=foo=2 in --popdef=foo in], [0],
+[[2
+1
+]])
+AT_CHECK_M4([--popdef=foo in --pushdef=foo=1 in], [0],
+[[foo
+1
+]])
+
AT_CLEANUP
Index: tests/options.at
===================================================================
RCS file: /sources/m4/m4/tests/options.at,v
retrieving revision 1.23
diff -u -r1.23 options.at
--- tests/options.at 8 Nov 2006 19:06:01 -0000 1.23
+++ tests/options.at 14 Nov 2006 05:57:01 -0000
@@ -73,6 +73,12 @@
[[m4: Warning: `--arglength' is deprecated, use `--debuglen' instead
]])
+dnl --word-regexp from 1.4.x is no longer supported. Can't test for its
+dnl alternate spelling -W, as that now means --warnings.
+AT_CHECK_M4([[--word-regexp='[a-zA-Z0-9_]+']], [0], [],
+[[m4: Warning: `--word-regexp' is deprecated
+]])
+
AT_CLEANUP
@@ -181,6 +187,63 @@
AT_CLEANUP
+## --------------- ##
+## POSIXLY_CORRECT ##
+## --------------- ##
+
+AT_SETUP([POSIXLY_CORRECT])
+
+dnl this test group depends on correct settings of POSIXLY_CORRECT
+if test -n "${POSIXLY_CORRECT+set}" ; then
+ (unset POSIXLY_CORRECT) >/dev/null 2>&1 || {
+ echo "Problem unsetting POSIXLY_CORRECT"
+ AT_CHECK([exit 77])
+ }
+ unset POSIXLY_CORRECT
+fi
+
+dnl By default, GNU extensions and warnings are enabled
+AT_DATA([in], [[__line__
+dnl()
+]])
+AT_CHECK_M4([in], [0], [[1
+]], [[m4:in:2: Warning: dnl: extra arguments ignored: 1 > 0
+]])
+AT_CHECK_M4([in -g], [0], [[1
+]], [[m4:in:2: Warning: dnl: extra arguments ignored: 1 > 0
+]])
+AT_CHECK_M4([in -G], [0], [[__line__
+]], [[m4:in:2: Warning: dnl: extra arguments ignored: 1 > 0
+]])
+AT_CHECK_M4([in -W], [0], [[1
+]], [[m4:in:2: Warning: dnl: extra arguments ignored: 1 > 0
+]])
+AT_CHECK_M4([in -Q], [0], [[1
+]])
+
+dnl Next, run with POSIX semantics
+POSIXLY_CORRECT=1
+export POSIXLY_CORRECT
+
+dnl POSIXLY_CORRECT implies -G -Q
+AT_DATA([in], [[__line__
+dnl()
+]])
+AT_CHECK_M4([in], [0], [[__line__
+]])
+AT_CHECK_M4([in -g], [0], [[1
+]])
+AT_CHECK_M4([in -G], [0], [[__line__
+]])
+AT_CHECK_M4([in -W], [0], [[__line__
+]], [[m4:in:2: Warning: dnl: extra arguments ignored: 1 > 0
+]])
+AT_CHECK_M4([in -Q], [0], [[__line__
+]])
+
+AT_CLEANUP
+
+
## --------- ##
## debugfile ##
## --------- ##
@@ -567,17 +630,23 @@
[[m4: bad regexp syntax option: `unknown'
]])
-AT_CHECK_M4([--regexp-syntax '' in], [0], [[0
+AT_CHECK_M4([--regexp-syntax= in], [0], [[0
]])
-AT_CHECK_M4([-r EXTENDED in], [1], [[
+AT_CHECK_M4([-rEXTENDED in], [1], [[
]], [[m4:in:1: regexp: bad regular expression `(': Unmatched ( or \(
]])
AT_CHECK_M4([-rgnu-m4 in], [0], [[0
]])
-AT_CHECK_M4([-r "gnu M4" in], [0], [[0
+AT_CHECK_M4([-r"gnu M4" in], [0], [[0
+]])
+
+dnl Test behavior of -r intermixed with files
+AT_CHECK_M4([-rEXTENDED in --regexp-syntax in], [1], [[
+0
+]], [[m4:in:1: regexp: bad regular expression `(': Unmatched ( or \(
]])
AT_CLEANUP
@@ -625,3 +694,54 @@
])
AT_CLEANUP
+
+
+## ---------- ##
+## syncoutput ##
+## ---------- ##
+
+AT_SETUP([--syncoutput])
+
+dnl -s/--synclines implies --syncoutput=1
+AT_DATA([in], [[hi
+]])
+AT_CHECK_M4([-s in], [0],
+[[#line 1 "in"
+hi
+]])
+AT_CHECK_M4([--synclines in], [0],
+[[#line 1 "in"
+hi
+]])
+
+dnl test intermixing option and files
+AT_CHECK_M4([in --syncoutput=1 in --syncoutput in], [0],
+[[hi
+#line 1 "in"
+hi
+hi
+]])
+
+AT_CLEANUP
+
+
+## -------------------- ##
+## traceon and traceoff ##
+## -------------------- ##
+
+AT_SETUP([--traceon and --traceoff])
+
+dnl test intermixing with files
+AT_DATA([[in]], [[divnum
+]])
+AT_CHECK_M4([-d+x in --traceon=divnum in --traceoff=divnum in], [0],
+[[0
+0
+0
+]], [[m4trace: -1- id 2: divnum -> `0'
+]])
+
+dnl test that --traceoff does not warn on untraced name
+AT_CHECK_M4([--traceoff=unknown], [0])
+
+AT_CLEANUP
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- head command line options,
Eric Blake <=