Page MenuHomeFreeBSD

m4: Change defn processing order
ClosedPublic

Authored by des on Wed, Feb 4, 8:53 PM.

Details

Summary

Currently, defn pushes its arguments on the stack in order, which means
they are then processed in reverse order. POSIX does not specify what
order they are processed in, which arguably suggests that they should be
processed in the order they are listed. Push them in reverse order so
they will be processed in their original order. This matches GNU m4.

PR: 292937
MFC after: 1 week
Sponsored by: Klara, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 70429
Build 67312: arc lint + arc unit

Event Timeline

des requested review of this revision.Wed, Feb 4, 8:53 PM
obiwac added a subscriber: obiwac.

tested, works.

is there any concern for breaking existing m4 programs?

usr.bin/m4/tests/m4_test.sh
65–71

unrelated to this revision, but shouldn't this be m4_test comments?

This revision is now accepted and ready to land.Thu, Feb 5, 12:45 AM
des marked an inline comment as done.Thu, Feb 5, 9:51 AM
des added inline comments.
usr.bin/m4/tests/m4_test.sh
65–71

see D55115

des marked an inline comment as done.

rebase

This revision now requires review to proceed.Thu, Feb 5, 1:48 PM

defn isn't in V7 m4, so gnu m4's behavior is really the only thing we can check.

This revision is now accepted and ready to land.Sat, Feb 7, 6:08 PM

fwiw:

  • With this change, defn(a,b,c) is exactly equivalent to defn(a)defn(b)defn(c), as was already the case in GNU m4.
  • Nothing in our tree uses defn with multiple arguments, so this change does not affect anything in our tree that uses m4.
  • Nothing in autoconf, autoconf-archive, automake, or libtool uses defn with multiple arguments, so this change does not affect them either.
This revision was automatically updated to reflect the committed changes.