Download raw body.
m4: better error messages for define/pushdef
On Mon, Feb 09, 2026 at 04:40:46PM +0100, Marc Espie wrote:
> Over the years, these lines have changed a bit, but the error message
> is still misleading
>
> "null definition" would refer to what you put in the macro (IMO) whereas
> in actuality, it's the macro NAME that's empty.
>
> Using two slightly different error messages will grow the executable slightly
> but it's still the right thing to do ?
Agreed. Unless I'm missing something, m4 isn't part of the instbin, so
it won't matter.
ok tb
(or I'll commit in a day or two)
>
> Index: eval.c
> ===================================================================
> RCS file: /vide/cvs/src/usr.bin/m4/eval.c,v
> diff -u -p -r1.79 eval.c
> --- eval.c 26 Dec 2022 19:16:01 -0000 1.79
> +++ eval.c 9 Feb 2026 15:35:15 -0000
> @@ -606,7 +606,7 @@ void
> dodefine(const char *name, const char *defn)
> {
> if (!*name && !mimic_gnu)
> - m4errx(1, "null definition.");
> + m4errx(1, "attempting to define macro with empty name.");
> else
> macro_define(name, defn);
> }
> @@ -643,7 +643,7 @@ static void
> dopushdef(const char *name, const char *defn)
> {
> if (!*name && !mimic_gnu)
> - m4errx(1, "null definition.");
> + m4errx(1, "attempting to pushdef macro with empty name.");
> else
> macro_pushdef(name, defn);
> }
>
m4: better error messages for define/pushdef