summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Avoid tests that make no sense, because m4 is single-threaded.stackovfEric Blake2009-02-162-3/+8
| | | | | | | * m4/gnulib-cache.m4: Avoid lock-tests and tls-tests. Signed-off-by: Eric Blake <ebb9@byu.net> (cherry picked from commit 2e16f59fdc15cace7c60960035f0d8fecd6232af)
* Don't override signal handlers installed by c-stack.Eric Blake2008-12-062-3/+15
| | | | | | | | | * src/m4.c (main): Reorder installation of signal handlers, so we don't trash a SIGBUS handler installed by c-stack. Also provide a SIGSEGV fallback, for platforms where c-stack combined with libsigsegv uses something lower level than SIGSEGV. Signed-off-by: Eric Blake <ebb9@byu.net>
* Upgrade to FDL 1.3, keep COPYING in repository.Eric Blake2008-12-0610-9/+694
| | | | | | | | | | | | | | * Makefile.am (MAINTAINERCLEANFILES): Don't remove COPYING. * .cvsignore: Don't ignore it. * .gitignore: Likewise. * COPYING: Store in repository, per automake 1.10.2 recommendation. * m4/gnulib-cache.m4: Replace fdl module with fdl-1.3. * doc/m4.texinfo (GNU Free Documentation License): Upgrade license. * doc/Makefile.am (m4_TEXINFOS): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* Update recommendation now that libsigsegv 2.6 is released.Eric Blake2008-08-254-4/+12
| | | | | | | * NEWS: Recommend libsigsegv 2.6+. * README: Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* Increase ulimit stack value to be larger than SIGSTKSZ.Eric Blake2008-08-032-2/+8
| | | | | | | * checks/stackovf.test (tmpfile): Use 300K rather than 50K, since at least OpenBSD's sh died early from an undersized stack limit. Signed-off-by: Eric Blake <ebb9@byu.net>
* Fix missing copyright notices.Eric Blake2008-07-175-2/+57
| | | | | | | | | * acinclude.m4: Add copyright license details. * c-boxes.el: Likewise. * checks/get-them: Likewise. * checks/check-them: Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* Remove redundant examples/stackovf.sh.Eric Blake2008-07-173-84/+5
| | | | | | | | * examples/stackovf.sh: Delete, now that checks has better version. * examples/Makefile.am (EXTRA_DIST): Don't distribute it. Signed-off-by: Eric Blake <ebb9@byu.net>
* Adjust to c-stack changes in gnulib.Eric Blake2008-07-179-7/+173
| | | | | | | | | | | | | | | | | * src/Makefile.am (m4_LDADD): Use libsigsegv when available and necessary, via LIBCSTACK. * src/m4.c (main) [DEBUG_STACKOVF]: Make it easier to test fault handlers. * checks/stackovf.test: New file. * checks/Makefile.in (CHECKS): Add stackovf.test, and factor... (DOC_CHECKS): ...generated documentation tests into new macro. (DISTFILES): Distribute stackovf.test. * checks/check-them: Special-case stackovf.test. * NEWS: Enhance the NEWS item for -L improvements. * README: Mention the optional dependency. * HACKING: Mention maintenance burden added by libsigsegv. Signed-off-by: Eric Blake <ebb9@byu.net>
* Adjust to new gnulib-tool layout.Eric Blake2008-06-232-1/+54
| | | | | | * ltdl/m4/gnulib-cache.m4: Reformat. Signed-off-by: Eric Blake <ebb9@byu.net>
* Use new sigaction module.Eric Blake2008-06-213-22/+18
| | | | | | | * m4/gnulib-cache.m4: Import sigaction module. * src/m4.c (main): Drop signal() calls. Signed-off-by: Eric Blake <ebb9@byu.net>
* Also trap SIGILL, SIGFPE, SIGBUS.Eric Blake2008-06-184-6/+71
| | | | | | | | | | | | | * m4/gnulib-cache.m4: Import strsignal module. * src/m4.c (main): Register more handlers, and prefer sigaction when available. (SIGBUS, NSIG): Provide fallback when lacking. (signal_message): New variable, to keep async-safety. (fault_handler): Display faulting signal description. * configure.ac (gl_DISABLE_THREADS): Request gnulib modules to optimize for single-threaded operation. Signed-off-by: Eric Blake <ebb9@byu.net>
* Inform users what to do in case of programmer error.Eric Blake2008-06-064-3/+41
| | | | | | | | | | | * src/m4.h (EXIT_INTERNAL_ERROR): New macro. * configure.ac (AC_TYPE_SIGNAL): Delete, now that we assume C89. * src/m4.c (fault_handler): New method. (program_error_message): New variable, for async-safety. (main): Print bug reporting address rather than dump core on any failed assertions or detected non-stack-overflow faults. Signed-off-by: Eric Blake <ebb9@byu.net>
* Replace stackovf with gnulib c-stack.Eric Blake2008-06-069-516/+39
| | | | | | | | | | | | | | | | | | | | | | | * m4/gnulib.cache.m4: Import c-stack module. * configure.ac (AC_CHECK_HEADERS_ONCE): Remove check for siginfo.h, sys/wait.h. (AC_CHECK_TYPES): Likewise for siginfo_t. (AC_CHECK_MEMBERS): Likewise for sa_sigaction, ss_sp. (AC_CHECK_FUNCS_ONCE): Likewise for sigaction, sigaltstack, sigstack, sigvec, strerror. (M4_cv_use_stackovf): Likewise for stack overflow detection. * src/Makefile.am (m4_SOURCES): Don't build stackovf.c. * src/stackovf.c: Delete. * src/m4.h (setup_stackovf_trap): Delete. * src/m4.c (stackovf_handler): Delete. (main): Use c_stack_action instead of setup_stackovf_trap. If stack overflow is detectable, don't limit -L artificially. (usage): Document unlimited default on supported systems. * doc/m4.texinfo (Limits control): Document new default nesting limit. * NEWS: Document this change. Signed-off-by: Eric Blake <ebb9@byu.net>
* Use progname module rather than rolling our own program_name.Eric Blake2008-06-033-6/+11
| | | | | | | | * m4/gnulib-cache.m4: Import progname module. * src/m4.c (program_name): Replace... (main): ...with a call to set_program_name. Signed-off-by: Eric Blake <ebb9@byu.net>
* Stage 24: Allow embedded NUL in macro names.Eric Blake2008-06-0216-353/+430
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * m4/gnulib-cache.m4: Import xmemdup0 module. * src/m4.h (define_builtin, push_string_init, push_wrapup_init) (lookup_symbol): Add parameters. (struct call_info): Add name_len member. (struct token_data) [ENABLE_CHANGEWORD]: Add original_len member. (struct symbol): Add len member. (TOKEN_DATA_ORIG_LEN, SYMBOL_NAME_LEN): New accessors. (m4_error_at_line, m4_warn_at_line): Delete. (m4_error, m4_warn, debug_set_output, skip_line, set_word_regexp) (bad_argc, evaluate): Adjust parameter type. * src/m4.c (m4_error_at_line, m4_warn_at_line): Delete. (m4_verror_at_line, m4_error, m4_warn): Adjust parameter type. (main): Adjust caller. * src/symtab.c (profile_strcmp) [DEBUG_SYMTAB]: Rename... (profile_memcmp): ...and accomodate NUL. (hash, lookup_symbol): Add parameter to track length. (symtab_debug, symtab_print_list): Adjust callers. * src/input.c (push_string_init, push_wrapup_init): Take location as parameter rather than using global state. (skip_line, set_word_regexp, next_token): Adjust parameter type. (peek_input, next_char_1, match_input, lex_debug): Adjust callers. * src/macro.c (struct macro_arguments): Delete argv0 and argv0_len members, now covered by info. (expand_input, expand_token, expand_argument, collect_arguments) (expand_macro, arg_text, arg_empty, arg_len, make_argv_ref) (push_arg, wrap_args): Adjust callers. * src/builtin.c (define_builtin): Add parameter. (bad_argc, numeric_arg, mkstemp_helper, substitute): Adjust parameter type. (define_user_macro, builtin_init, define_macro, m4_undefine) (m4_popdef, m4_ifdef, m4_ifelse, dumpdef_cmp, m4_dumpdef) (m4_builtin, m4_indir, m4_defn, m4_syscmd, m4_esyscmd, m4_eval) (m4_incr, m4_decr, m4_divert, m4_divnum, m4_undivert, m4_shift) (m4_changequote, m4_changecom, m4_changeword, include) (m4_maketemp, m4_mkstemp, m4_errprint, m4___file__, m4___line__) (m4___program__, m4_m4exit, m4_m4wrap, m4_traceon, m4_traceoff) (m4_debugmode, m4_debugfile, m4_len, m4_index, m4_substr) (m4_translit, m4_format, m4_regexp, m4_patsubst): Adjust all callers. * src/debug.c (debug_set_file, debug_set_output): Adjust parameter type. (trace_flush, trace_prepre, trace_pre): Adjust all callers. * src/eval.c (logical_or_term, logical_and_term, or_term) (xor_term, and_term, equality_term, cmp_term, shift_term) (add_term, mult_term, exp_term, unary_term, simple_term) (evaluate): Adjust parameter type. * src/format.c (arg_int, arg_long, arg_double): Likewise. (expand_format): Adjust caller. * doc/m4.texinfo (Using frozen files): Test this. * examples/null.m4: Likewise. * examples/null.err: Adjust expected output. * examples/null.out: Likewise. (cherry picked from commit 6167507cf07ddbc838e14e3d66803b360e63f6f2) Signed-off-by: Eric Blake <ebb9@byu.net>
* Allow autobuild usage.Eric Blake2008-06-022-2/+7
| | | | | | * m4/gnulib.cache: Import autobuild module. Signed-off-by: Eric Blake <ebb9@byu.net>
* Make closing files be consistent.Eric Blake2008-05-232-2/+7
| | | | | | | * src/freeze.c (reload_frozen_state): Use close_stream. Reported by Jean-Charles Longuet. Signed-off-by: Eric Blake <ebb9@byu.net>
* Don't allow failure to freeze give exit status of 0.Eric Blake2008-05-223-0/+19
| | | | | | | | | * doc/m4.texinfo (Using frozen files): Test the fix from 2007-11-22. * THANKS: Update. Reported by Jean-Charles Longuet. Signed-off-by: Eric Blake <ebb9@byu.net>
* Improve error message when frozen file is invalid.Eric Blake2008-05-092-35/+48
| | | | | | | * src/freeze.c (reload_frozen_state): Track current line. [GET_STRING]: New helper macro. Signed-off-by: Eric Blake <ebb9@byu.net>
* Detect integer overflow when loading frozen file.Eric Blake2008-05-092-13/+23
| | | | | | | | * src/freeze.c (reload_frozen_state) [GET_NUMBER]: Rewrite to fail immediately on overflow. Reported by Jim Meyering. Signed-off-by: Eric Blake <ebb9@byu.net>
* Stage 23: allow tracing of indirect macro calls.Eric Blake2008-05-0911-238/+385
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/m4.h (struct call_info): New struct. (trace_prepre, trace_pre, trace_post, push_string_finish) (input_print, call_macro): Alter signatures. (arg_info): New prototype. (input_block): Delete... * src/input.c (input_block): ...and make typedef local again. (push_string_init): Initialize length. (push_string_finish, input_print): Change signature, so that printing can be done before finalization. * src/macro.c (struct macro_arguments): Add info member. (collect_arguments, make_argv_ref): Manage new field. (expand_macro): Change call context management. Move tracing... (call_macro): ...here, and remove redundant parameter. (arg_info): New function. * src/debug.c (trace_format): Delete unused modifiers. (trace_header, trace_flush, trace_prepre, trace_pre, trace_post): Change signatures for stacked trace messages, and for using call context. * src/builtin.c (m4_builtin, m4_indir): Update callers. * src/m4.c (usage): Update debugmode flag summary. * doc/m4.texinfo (Defn): Update examples to match new behavior. (Trace): Mention new capability of indir. (Debug Levels): Enhance text for 'c' and 'x', update examples. (Incompatibilities): Mention risk of parsing trace output. * examples/null.m4: Enhance test. * examples/null.err: Update expected output. * NEWS: Mention these changes. Reported by Akim Demaille in the autoconf TODO file in 2000. (cherry picked from commit ec804cba9ceeef7ca863d163eeae3fca669ccd16) Signed-off-by: Eric Blake <ebb9@byu.net>
* Fix traceon regression introduced 2006-06-06.Eric Blake2008-05-074-1/+25
| | | | | | | | | * src/builtin.m4 (traceon): Only perform insertion if lookup fails. * doc/m4.texinfo (Trace): Test for the bug. * NEWS: Document it. Signed-off-by: Eric Blake <ebb9@byu.net>
* Stage 22: allow builtin token concatenation outside $@.Eric Blake2008-05-059-149/+159
| | | | | | | | | | | | | | | | | | | | | | | * src/m4.h (arg_text): Add parameter. (ARG): Adjust callers. * src/input.c (init_macro_token): Add parameter. (next_token): Support concatenating builtins. * src/macro.c (warn_builtin_concat): Delete warning. (expand_argument, arg_adjust_refcount): Handle builtin tokens. (arg_text): Add parameter. (arg_print): Adjust caller. * src/builtin.c (define_macro): Flatten builtins, rather than doing nothing. (defn): Warn on undefined macro name. * src/m4.c (main): Avoid atoi. * src/output.c: Whitespace fixes. * doc/m4.texinfo (Defn): Document the new semantics. (Ifelse, Debug Levels, M4wrap): Enhance tests. * NEWS: Document this change. (cherry picked from commit 8a47a2029b7eb60ac61abb1b6423d4a67b371281) Signed-off-by: Eric Blake <ebb9@byu.net>
* Document define_blind.Eric Blake2008-05-033-0/+65
| | | | | | | | * doc/m4.texinfo (Ifelse): Add a new composite macro. * THANKS: Update. Suggested by Mike R. Signed-off-by: Eric Blake <ebb9@byu.net>
* Fix debugmode regression from 2008-04-14.Eric Blake2008-04-244-6/+31
| | | | | | | | | | | * src/input.c (pop_input): Fix -di output on end of input. * doc/m4.texinfo (Debug Levels): Test this behavior. (Changeword, Location): Correct examples. * checks/check-them (examples): Update to account for recommended location for running tests. * doc/m4.texinfo (Debug Levels): Test this behavior. Signed-off-by: Eric Blake <ebb9@byu.net>
* Fix debugmode regression from 2008-02-18.Eric Blake2008-04-243-1/+11
| | | | | | | | | * src/m4.h (DEBUG_TRACE_VERBOSE): Make -dV verbose again. * NEWS: Document this fix. Test to come when merging stage 23 from branch argv_ref. Signed-off-by: Eric Blake <ebb9@byu.net>
* Fix spelling of attribution to Christopher Strachey.Eric Blake2008-04-213-2/+10
| | | | | | | | * doc/m4.texinfo (History, Inhibiting Invocation): Fix typo. * THANKS: Update. Reported by Fernando Carrijo. Signed-off-by: Eric Blake <ebb9@byu.net>
* Fix buildbot failure.Eric Blake2008-04-173-1/+8
| | | | | | | | | * doc/m4.texinfo (Diversions): Consume all of m4's output, in case SIGPIPE is ignored. * THANKS: Update. Detected by Bob Proulx's buildbot. Signed-off-by: Eric Blake <ebb9@byu.net>
* Avoid gcc shadowing warnings.Eric Blake2008-04-177-98/+112
| | | | | | | | | | | | | | | | * src/builtin.c (m4_ifelse): Avoid the name index. (m4_format): s/format/expand_format, so local variables can be named format. * src/format.c (format): Rename... (expand_format): ...to this, and avoid the name index. * src/input.c (push_file): Avoid the name close. * src/m4.h (expand_format): Adjust prototype. * src/macro.c (arg_token, arg_type, arg_text, arg_empty, arg_len) (arg_func, arg_print, make_argv_ref_token, make_argv_ref) (push_arg, push_arg_quote): Avoid the name index. * src/output.c (threshold_diversion_CB): Avoid the name div. Signed-off-by: Eric Blake <ebb9@byu.net>
* Another 'make installcheck' fix.Eric Blake2008-04-152-1/+7
| | | | | | | * doc/m4.texinfo (Diversions): s/m4/__program__/ in case --program-prefix was active. Signed-off-by: Eric Blake <ebb9@byu.net>
* Stage 21: $@ concatenates builtins, m4wrap takes builtins.Eric Blake2008-04-149-199/+253
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/m4.h (append_macro): New prototype. (push_macro, push_wrapup_init, arg_print, func_print): Alter prototypes. * src/input.c (INPUT_MACRO): Delete, covered by INPUT_CHAIN. (INPUT_EOF): New input block type, for efficiency. (struct input_block): Remove u.func member. (input_eof): New input sentinel. (append_macro): New function. (push_macro, push_wrapup_init): Add parameter. (push_token): Support builtin tokens. (init_macro_token): Always use chain for builtin tokens. (push_string_init, pop_input, pop_wrapup, input_print) (peek_input, next_char, next_char_1, input_init): Adjust callers. * src/macro.c (arg_equal, wrap_args): Handle builtin tokens. (arg_print): Add parameter. (collect_arguments, arg_type, arg_text): Adjust callers. * src/builtin.c (m4_m4wrap): Handle builtin tokens. (func_print): Add parameter. (m4_defn): Allow pushing builtin alongside other text. (m4_errprint): Adjust caller. * src/debug.c (trace_pre): Likewise. * doc/m4.texinfo (Defn, Ifelse, Debug Levels): Update tests to new behavior. (M4wrap): New test. (cherry picked from commit 32d4bf4d447e0e252c809897b795b57b3bfd74de) Signed-off-by: Eric Blake <ebb9@byu.net>
* Ensure --program-prefix doesn't regress.Eric Blake2008-04-112-1/+7
| | | | | | | * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): Enforce change from 2008-03-10 by testing it at 'make distcheck' time. Signed-off-by: Eric Blake <ebb9@byu.net>
* Improve OS/2+emx build.Eric Blake2008-04-117-7/+28
| | | | | | | | | | | | | | | | | * src/m4.h [__EMX__]: OS/2 does not have a Unix-compatible system(3), no matter what other macros it pre-defined. * doc/m4.texinfo (Mkstemp): Rework test to avoid globbing failure on OS/2. * src/builtin.c (predefined_tab): Ensure all possible system identifiers are defined, not just the first; the testsuite will catch if multiple identifiers mistakenly made it through. * examples/null.m4 (esyscmd): Don't rely on printf to generate NUL byte. * examples/null.out (esyscmd): Check for esyscmd success. * THANKS: Update. Reported by Elbert Pol. Signed-off-by: Eric Blake <ebb9@byu.net>
* Fix mingw build.Eric Blake2008-04-113-1/+9
| | | | | | | * src/builtin.c (define_user_macro): Avoid compiler warning. * NEWS: Tweak 1.4.10b entry. Signed-off-by: Eric Blake <ebb9@byu.net>
* Mention how to do Free Software Directory update.Eric Blake2008-04-091-0/+5
| | | | | | * HACKING: Add another release process step. Signed-off-by: Eric Blake <ebb9@byu.net>
* Remove redundant configure macros.Eric Blake2008-04-092-5/+9
| | | | | | | | | * configure.ac (AC_CANONICAL_BUILD, AC_CANONICAL_HOST) (AC_SYS_LARGEFILE, AC_TYPE_SIZE_T): Delete, since gnulib does this. (AC_CHECK_HEADERS_ONCE): Remove limits.h. Signed-off-by: Eric Blake <ebb9@byu.net>
* Mention 1.4.11 release.Eric Blake2008-04-024-21/+50
| | | | | | | | | * NEWS: Update to match release on branch-1.4. * doc/m4.texinfo (History): Update release history. (Format): Test for C99 hex-float parsing. * src/Makefile.am (m4_LDADD): Use POW_LIB when needed. Signed-off-by: Eric Blake <ebb9@byu.net>
* Improve release process.Eric Blake2008-04-026-45/+61
| | | | | | | | | | | | | | | | | | | | * maint.mk (alpha): Check for PREV_VERSION setting sooner, and remove tag operation. (version-check): Enhance this check. (prev-tarball): Depend on version-check. (web-manual): Fix VPATH usage. (this-vc-tag): Delete, and mention need to run tag... * HACKING: ...here, prior to make maintainer-distcheck. Update the instructions to match this particular release process. * Makefile.am (.version, announcement): Allow for VPATH build. * cfg.mk (gnulib_dir): Likewise. * doc/Makefile.am ($(srcdir)/m4.1): Include release number in man page. Signed-off-by: Eric Blake <ebb9@byu.net> (cherry picked from commit c07173b0a58b56c07633a28323d56451b98b7de5) Conflicts:
* Add test for divert bug on 2007-05-28, patched 2007-07-21.Eric Blake2008-03-272-0/+19
| | | | | | * doc/m4.texinfo (Diversions): Add test. Signed-off-by: Eric Blake <ebb9@byu.net>
* Tweak wording to point to autoconf patch.Eric Blake2008-03-241-8/+14
| | | | Signed-off-by: Eric Blake <ebb9@byu.net>
* Mention FIFO m4wrap more prominently in NEWS.v1.5.89aEric Blake2008-03-243-13/+29
| | | | | | | | | * NEWS: Describe effect on autoconf 2.59 and earlier. * doc/m4.texinfo (History): The next version will be 1.6, not 1.4.11. Reported by Ralf Wildenhues. Signed-off-by: Eric Blake <ebb9@byu.net>
* Pull GNUmakefile from gnulib.Eric Blake2008-03-2410-110/+32
| | | | | | | | | | | | | | | | | | | * m4/gnulib-cache.m4: Import gnumakefile module. * GNUmakefile: Remove from version control; supplied by gnulib instead. * configure.ac (AC_CONFIG_LINKS): Let gnulib do this now. * Makefile.am (distclean-local): Likewise. (EXTRA_DIST): Likewise. Also handle renamed files. * Makefile.cfg: Rename... * cfg.mk: ...to this. * Makefile.maint: Rename... * maint.mk: ...to this. (ME, makefile-check, m4-check): Use new macro instead of hard-coded name. * HACKING: Mention that maintainer rules should now work in VPATH builds. Signed-off-by: Eric Blake <ebb9@byu.net>
* Stage 20: make m4wrap obey POSIX fifo ordering.Eric Blake2008-03-187-81/+230
| | | | | | | | | | | | | | | | | | | | | | | | | | * src/m4.h (enum token_chain_type): Add CHAIN_LOC. (struct token_chain): Add u_l member. (wrap_args): New prototype. * src/input.c (push_wrapup_init, push_wrapup_finish): Rewrite to guarantee a FIFO chain in the wrapup stack. (pop_input, peek_input, next_char_1): Support location link. (next_char): Add parameter. (init_macro_token, init_argv_token): Require user to consume empty input. (skip_line, match_input): Adjust callers. (next_token): Always consume first character. * src/macro.c (arg_text): Tighten assertion. (wrap_args): New method. * src/builtin.c (m4_m4wrap): Use it. (define_macro): Issue warning when ignoring builtin token during macro definition. * doc/m4.texinfo (M4wrap, Location, Incompatibilities) (Improved m4wrap): Adjust examples to corrected behavior. * NEWS: Document this fix. (cherry picked from commit f7f45337fa1bfba9512841e8d3d2251359944681) Signed-off-by: Eric Blake <ebb9@byu.net>
* Update for fresh bootstrap.Eric Blake2008-03-172-2/+7
| | | | | | * m4/gnulib-cache.m4: Updated copyright from upstream. Signed-off-by: Eric Blake <ebb9@byu.net>
* Document join, in order to fix bug in m4wrap example.Eric Blake2008-03-155-34/+309
| | | | | | | | | | | | | * examples/join.m4: New file. * examples/wraplifo2.m4: Likewise. * examples/Makefile.am (EXTRA_DIST): Add new files. * doc/m4.texinfo (Improved m4wrap): New node. (Defn, Location): Enhance tests. (Shift): Document the composit macro join. (Incompatibilities): Move documentation of LIFO vs. FIFO... (M4wrap): ...here, to match improved example. Signed-off-by: Eric Blake <ebb9@byu.net>
* Stage 19: allow builtin tokens in more macros.Eric Blake2008-03-147-105/+414
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/m4.h (enum token_chain_type): Add CHAIN_FUNC. (struct token_chain): Add func member. * src/input.c (push_token, pop_input, input_print, peek_input) (next_char_1, init_macro_token): Handle builtin tokens from back-references. (next_token): Flatten builtin tokens inside comments or quotes, except when a builtin is the only thing inside quotes. * src/macro.c (expand_argument): Strengthen assertion. (collect_arguments): Handle builtin tokens. (expand_macro): Fix harmless typo. (arg_token): Add parameter. (arg_type, arg_text, arg_equal, arg_empty, arg_len, arg_func) (arg_print, push_arg_quote, push_args): Update callers to either require flattened arguments or to handle builtins. * src/builtin.c (m4_defn, m4_dumpdef, m4_ifdef, m4_ifelse) (m4_popdef, m4_shift, m4_traceoff, m4_traceon, m4_undefine): Handle builtin tokens, either by recognizing invalid macro names or passing them through transparently. (define_user_macro): Make all user macros handle builtin token arguments transparently. * doc/m4.texinfo (Defn, Ifdef, Ifelse, Debuglen): Document and test the new behavior. * NEWS: Document this change. (cherry picked from commit 434656c96d6486cf959c3050aa85aecb72d948a0) Signed-off-by: Eric Blake <ebb9@byu.net>
* Consistently cast malloc results, for C++ compilation.Eric Blake2008-03-135-8/+20
| | | | | | | | | * src/builtin.c (compile_pattern): Add cast. * src/macro.c (expand_macro): Likewise. * src/output.c (m4_tmpname): Likewise. * src/stackovf.c (setup_stackovf_trap): Use correct type. Signed-off-by: Eric Blake <ebb9@byu.net>
* Allow 'make installcheck' with './configure --program-prefix'.Eric Blake2008-03-103-18/+31
| | | | | | | | | * checks/Makefile.in (program_transform_name): New macro. (installcheck): Use it to transform name of m4 before testing. * checks/check-them (m4): Add -m option, to allow testing m4 by a different name. Signed-off-by: Eric Blake <ebb9@byu.net>
* More maintainer fixes.Eric Blake2008-03-103-12/+10
| | | | | | | | | | * GNUmakefile (_created_version_file): Delete, now that VPATH builds include GNUmakefile. * configure.ac (AC_INIT): Base version on .tarball-version, not .version. Reported by Ralf Wildenhues, fix by Jim Meyering in coreutils. Signed-off-by: Eric Blake <ebb9@byu.net>
* Fix nested builtin(`shift',$@) regression from 2008-02-22.Eric Blake2008-03-064-3/+31
| | | | | | | | | | * src/macro.c (make_argv_ref_token): Don't output expansion text when making wrapper for builtin or indir. * doc/m4.texinfo (Builtin): Test it. * NEWS: Document the fix. Reported by Andreas Schwab. Signed-off-by: Eric Blake <ebb9@byu.net>