autoconf-patches
[Top][All Lists]
Advanced

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

Re: doco m4 notes


From: Paul Eggert
Subject: Re: doco m4 notes
Date: 21 May 2003 16:42:58 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Kevin Ryde <address@hidden> writes:

> I collected up the notes below about problems and variations struck.
> I wonder if this would be good for the autoconf manual,

It's a nice set of notes, but wouldn't it be better fodder for the GNU
m4 manual?  It's not really relevant to Autoconf per se.  I'll CC:
this to bug-m4 to see if they like the idea.  (Note to m4 maintainer:
Ryde's original message is in
<http://mail.gnu.org/archive/html/autoconf-patches/2003-05/msg00055.html>.)

One thought is that you might want also to mention what POSIX
1003.1-2001 (with corrigenda) requires for an m4 behavior, if it
requires one.  See
<http://www.opengroup.org/onlinepubs/007904975/utilities/m4.html>.
For example:

> dnl  len() - When "len()" is given an empty argument, BSD m4 evaluates to
> dnl       nothing, whereas GNU, SysV, and the new OpenBSD, evaluate to 0.
> dnl       See m4_length() below which works around this.

POSIX requires the GNU behavior.

> dnl  translit() - GNU m4 accepts character ranges like A-Z, and the new
> dnl       OpenBSD m4 does under option -g, but basic BSD and SysV don't.

POSIX requires the basic BSD behavior.

> dnl  popdef() - in BSD and SysV m4 popdef() takes multiple arguments and
> dnl       pops each, but GNU m4 only takes one argument.

POSIX requires the BSD behavior.  This appears to me to be a shortcoming
in GNU m4; a bug report is in order, perhaps?

> dnl  eval() &,|,^ - GNU and SysV m4 have bitwise operators &,|,^ available,
> dnl       but BSD m4 doesn't (contrary to what the man page suggests) and
> dnl       instead ^ is exponentiation.

POSIX requires the GNU behavior.

> dnl  eval() ?: - The C ternary operator "?:" is available in BSD m4, but not
> dnl       in SysV or GNU m4 (as of GNU m4 1.4 and betas of 1.5).

POSIX requires the GNU behavior; it does not allow ?:, even as an extension.

> dnl  eval() -2^31 - BSD m4 has a bug where an eval() resulting in -2^31
> dnl       (ie. -2147483648) gives "-(".  Using -2147483648 within an
> dnl       expression is ok, it just can't be a final result.

POSIX doesn't allow this behavior.

> dnl  eval() <<,>> - SysV m4 doesn't support shift operators in eval() (on
> dnl       Solaris 7 /usr/xpg4/m4 has them but /usr/ccs/m4 doesn't).  See
> dnl       m4_lshift() and m4_rshift() below for workarounds.

POSIX requires support for << and >>.

> dnl  m4wrap() sequence - in BSD m4, m4wrap() replaces any previous m4wrap()
> dnl       string, in SysV m4 it appends to it, and in GNU m4 it prepends.
> dnl       See m4wrap_prepend() below which brings uniformity to this.

POSIX requires the SysV behavior.  Another bug report for GNU m4, perhaps?

> dnl  m4wrap() 0xFF - old versions of BSD m4 store EOF in a C "char" under an
> dnl       m4wrap() and on systems where char is unsigned by default a
> dnl       spurious 0xFF is output.

POSIX doesn't allow this bug.

> dnl  changecom() - BSD m4 changecom doesn't quite work like the man page
> dnl       suggests, in particular "changecom" or "changecom()" doesn't
> dnl       disable the comment feature, and multi-character comment sequences
> dnl       don't seem to work.  If the default `#' and newline aren't
> dnl       suitable it's necessary to change it to something else,
> dnl       eg. changecom(;).

POSIX requires that "changecom" must disable the comment feature, and
that the start- and end-comments may be up to 5 characters.

> dnl  OpenBSD 2.6 m4 - in this m4, eval() rejects decimal constants containing
> dnl       an 8 or 9, making it pretty much unusable.  The bug is confined to
> dnl       version 2.6 (it's not in 2.5, and has been fixed in 2.7).

The bug isn't allowed  by POSIX.

> dnl  SunOS /usr/bin/m4 - this m4 lacks a number of desired features,
> dnl       including $# and $@, defn(), m4exit(), m4wrap(), pushdef(),
> dnl       popdef().  /usr/5bin/m4 is a SysV style m4 which should always be
> dnl       available, and "configure" will reject /usr/bin/m4 in favour of
> dnl       /usr/5bin/m4 (if necessary).

Here by "SunOS" I assume you mean "SunOS 4.x".  On Solaris 8 (SunOS
5.8), the two m4s are /usr/ccs/bin/m4 and /usr/xpg4/bin/m4.  The
documentation says that the two both support the features that you
mention; they differ only in that /usr/xpg4/bin/m4 eval supports <<
and >>, whereas the other eval does not; also, that xpg4 m4 uses
C-style precedence (but the precedence for ccs m4 is not defined).




reply via email to

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