[Bug 292937] m4 defn() macro with multiple args concatenates in wrong order

[email protected] Wed, 04 Feb 2026 16:27:08 +0000
Newsgroups gmane.os.freebsd.devel.standards
Message-ID <[email protected]/bugzilla/>
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=292937

            Bug ID: 292937
           Summary: m4 defn() macro with multiple args concatenates in
                    wrong order
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: standards
          Assignee: [email protected]
          Reporter: [email protected]

One reason that BSD's m4 is not yet a drop-in for GNU's m4 in all situations is
that the two disagree on the correct output for this command line:

$ echo 'changequote([,])define(a,1)define(b,2)defn([a],[b])' | m4

GNU m4 outputs 12, but BSD m4 outputs 21.  POSIX says
https://pubs.opengroup.org/onlinepubs/9799919799/utilities/m4.html "The
defining text of the defn macro shall be the quoted definition (using the
current quoting strings) of its arguments.".  Since it does not mention
reordering those arguments, I argue that BSD's stack-like behavior of
multi-argument defn is wrong.  Especially when compared to it's multi-argument
dumpdef which does follow argument order.

-- 
You are receiving this mail because:
You are the assignee for the bug.