m4-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: improved error messages


From: Eric Blake
Subject: Re: improved error messages
Date: Fri, 23 Nov 2007 16:29:32 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[Hmm, I haven't seen the original message show up on the lists yet, but I
have committed the patches...]

According to Eric Blake on 11/22/2007 8:44 PM:
> A lot of error messages include the macro name, and some even make the
> enclosing macro name optional (such as detecting end of file in a string).
>  However, blindly printing a macro name to a tty can corrupt terminal
> state, if the user has used changeword/changesyntax, or is using indir, to
> include non-printing characters in the macro name.  So this patch factors
> out the macro name into the m4_warn function, so that a future patch can
> use the gnulib quotearg module to protect strange macro names in one place
> (other things also need help from quotearg, but one step at a time...).
> The branch has the bigger impact, but even head is impacted.
> 
> 2007-11-22  Eric Blake  <address@hidden>
> 
>         More error messages tied to macro names.
>         * src/input.c (set_word_regexp): Take additional parameter.
>         (input_init): Adjust caller.
>         * src/debug.c (debug_set_file, debug_set_output): Take additional
>         parameter.
>         (debug_init): Adjust caller.
>         (expansion_level): Move declaration...
>         * src/m4.h (expansion_level): ...here.
>         (debug_set_output, set_word_regexp): Adjust prototypes.
>         * src/builtin.c (m4_changeword, m4_m4exit, m4_debugfile): Adjust
>         callers.
>         * src/m4.c (main): Likewise.
> 
>         Refactor error messages to avoid macros.
>         * src/m4.h (_): Define, as a placeholder for now.
>         (M4ERROR, M4ERROR_AT_LINE): Delete.
>         (m4_error, m4_error_at_line): Change prototype.
>         (m4_warn, m4_warn_at_line): New prototypes.
>         * src/m4.c (m4_verror_at_line): New helper function.
>         (m4_error, m4_error_at_line): Use new function, and properly call
>         va_end.
>         (m4_warn, m4_warn_at_line): New functions.
>         (stackovf_handler, main): All callers changed.
>         * src/builtin.c: Likewise.
>         * src/debug.c: Likewise.
>         * src/eval.c: Likewise.
>         * src/format.c: Likewise.
>         * src/freeze.c: Likewise.
>         * src/input.c: Likewise.
>         * src/macro.c: Likewise.
>         * doc/m4.texinfo (Indir, Builtin, Dumpdef, Incr, Eval, Substr)
>         (Improved forloop): Adjust tests accordingly.
> 

I've also rebased the argv_ref branch on top of these changes.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHR2Jc84KuGfSFAYARAgqGAJ0bPKbLOUeDDb+WOmSk+pK8o2qs7QCfWWAJ
i+SL6x19ER+C1zLEW6kJw3o=
=z5GS
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]