[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Inconsistency w.r.t. defining the same symbol more than once
From: |
Thomas Schwinge |
Subject: |
Inconsistency w.r.t. defining the same symbol more than once |
Date: |
Sun, 8 Oct 2006 14:16:00 +0200 |
User-agent: |
Mutt/1.5.6+20040907i |
Hello!
This is with Autoconf 2.59.
Consider the following:
configure.ac
#v+
AC_INIT([foo], [1])
AC_DEFINE([FOO], [0])
AC_DEFINE([FOO], [1])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
#v-
Makefile.in
#v+
DEFS = @DEFS@
#v-
#v+
$ autoconf
$ ./configure
configure: creating ./config.status
config.status: creating Makefile
$ cat Makefile
DEFS = -DPACKAGE_NAME=\"foo\" -DPACKAGE_TARNAME=\"foo\" -DPACKAGE_VERSION=\"1\"
-DPACKAGE_STRING=\"foo\ 1\" -DPACKAGE_BUGREPORT=\"\" -DFOO=0 -DFOO=1
#v-
When used with GCC, this will obviously result in ``warning: "FOO"
redefined'' and the _last_ definition (i.e. `FOO=1') will be used.
Now.
configure.ac
#v+
AC_INIT([foo], [1])
AC_DEFINE([FOO], [0], [FOO 0])
AC_DEFINE([FOO], [1], [FOO 1])
AC_CONFIG_HEADER([config.h])
AC_OUTPUT
#v-
#v+
$ autoconf
$ autoheader
$ ./configure
configure: creating ./config.status
config.status: creating config.h
$ grep FOO config.h
/* FOO 1 */
#define FOO 0
#v-
The _first_ definition (i.e. `FOO=0') will be used. And the commentary
from the _last_ one.
In both cases I would have expected that a subsequent `AC_DEFINE' on the
same symbol would simply override the previous definition, like in a
variable assignment.
What is the expected outcome? The manual doesn't tell me.
Regards,
Thomas
signature.asc
Description: Digital signature
- Inconsistency w.r.t. defining the same symbol more than once,
Thomas Schwinge <=
Re: Inconsistency w.r.t. defining the same symbol more than once, Thomas Schwinge, 2006/10/10