autoconf-patches
[Top][All Lists]
Advanced

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

Re: bad define semantics in GNU m4


From: Gary V. Vaughan
Subject: Re: bad define semantics in GNU m4
Date: Thu, 26 Jun 2003 21:12:58 +0100
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.3) Gecko/20030312

Cc: rms for arbitration.

Tim Van Holder wrote:
you suggest to step back into specified behavior (the interaction
between define and pushdef being unspecified in something apparently
named Single Unix).

My answer is no.  I do not care about Single Unix's specification for
M4, and I keep on planning using more GNU M4 features.  GNU M4 is a
requirement for Autoconf, and there is no plan to make it easy to use
other M4s.


Consider it a defect in GNU m4 then Akim, if it does not adhere to the
Single Unix Specification (IEEE Std 1003.1).  It's much like the POSIX
incompatibilities being fixed in bison - GNU tools are supposed to
_first_ implement the standards (i.e. provide viable replacements for
system tools) and then optionally provide additional functionality.

I am reluctant to change the behaviour that has been in GNU m4 since at least 1994 (m4 1.4), since that is what everyone who uses it has come to rely on, most especially autoconf. I note that SUS only dates back to 2001, when GNU m4 version 1.4 was already 7 years old.

On the other hand, I would like to support the standard in some way, perhaps changing the behaviour to match the SUS if m4 is invoked with --traditional, or if POSIXLY_CORRECT (hmm SUSLY_CORRECT...) is set in the environment?

At the other extreme, we could add a new builtin that behaves like the current define, and then change define to behave as SUS appears to indicate it should. m4sugar could easily add something to the effect of:

    m4_define(`m4_define', `defn(`m4_replacedef')')

At the very least the GNU m4 manual should make mention of define's
behaviour wrt push/popdef in the documentation for define itself; it
is currently only mentioned in the documentation for push/popdef.

But first we should figure out what to do in the code.

Requiring GNU m4 in autoconf is fine, depending on a misfeature in it
is not.  Adjusting m4sugar to work with both semantics would then be a
good idea, as it allows the code to work with current GNU m4 (using the
'bad' BSD semantics) as well as future GNU m4s that use the SUS
behaviour.

Assuming that we decide that is what GNU m4 should do...

For reference, here is part of the SUS spec for m4
(http://www.unix.org/single_unix_specification/, free registration
required):

define
    The second argument shall become the defining text of the macro
    whose name is the first argument.
defn
    The defining text of the defn macro shall be the quoted definition
   (using the current quoting strings) of its arguments.
popdef
    The popdef macro shall delete the current definition of its
    arguments, replacing that definition with the previous one. If
   there is no previous definition, the macro is undefined.
pushdef
    The pushdef macro shall be equivalent to the define macro with the
    exception that it shall preserve any current definition for future
    retrieval using the popdef macro.
undefine
    The undefine macro shall delete all definitions (including those
    preserved using the pushdef macro) of the macros named by its
    arguments.

Cheers,
        Gary.
--
  ())_. Gary V. Vaughan     gary@(oranda.demon.co.uk|gnu.org)
  ( '/  Research Scientist  http://www.oranda.demon.co.uk       ,_())____
  / )=  GNU Hacker          http://www.gnu.org/software/libtool  \'      `&
`(_~)_  Tech' Author        http://sources.redhat.com/autobook   =`---d__/





reply via email to

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