[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CFLAGS="-Wall -Werror" breaks AC_C_CONST (autoconf 2.59)
From: |
Chris Frost |
Subject: |
CFLAGS="-Wall -Werror" breaks AC_C_CONST (autoconf 2.59) |
Date: |
Sat, 15 Jul 2006 10:34:49 -0700 |
User-agent: |
Mutt/1.5.10i |
When I run
$ CFLAGS="-W -Wall -Werror" ./configure
against a configure.in that uses AC_C_CONST, const support is incorrectly
detected as absent because the const test has unused variables.
This is using autoconf 2.59 and gcc/g++ 3.3.5.
I was not able to find anything through a quick google or mailing search.
Is this a known bug? (Or is this the intended behavior?)
The const config.log snippet:
configure:3986: checking for an ANSI C-conforming const
configure:4053: gcc -c -W -Wall -Werror conftest.c >&5
conftest.c: In function `main':
conftest.c:42: warning: unused variable `s'
conftest.c:62: warning: unused variable `foo'
conftest.c:23: warning: unused variable `x'
conftest.c:29: warning: unused variable `zero'
configure:4059: $? = 1
configure: failed program was:
| /* confdefs.h. */
|
| #define PACKAGE_NAME "mswatch"
| #define PACKAGE_TARNAME "mswatch"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "mswatch 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE "mswatch"
| #define VERSION "1.0"
| #define _GNU_SOURCE 1
| #ifdef __cplusplus
| extern "C" void std::exit (int) throw (); using std::exit;
| #endif
| /* end confdefs.h. */
|
| int
| main ()
| {
| /* FIXME: Include the comments suggested by Paul. */
| #ifndef __cplusplus
| /* Ultrix mips cc rejects this. */
| typedef int charset[2];
| const charset x;
| /* SunOS 4.1.1 cc rejects this. */
| char const *const *ccp;
| char **p;
| /* NEC SVR4.0.2 mips cc rejects this. */
| struct point {int x, y;};
| static struct point const zero = {0,0};
| /* AIX XL C 1.02.0.0 rejects this.
| It does not let you subtract one const X* pointer from another in
| an arm of an if-expression whose if-part is not a constant
| expression */
| const char *g = "string";
| ccp = &g + (g ? g-g : 0);
| /* HPUX 7.0 cc rejects these. */
| ++ccp;
| p = (char**) ccp;
| ccp = (char const *const *) p;
| { /* SCO 3.2v4 cc rejects this. */
| char *t;
| char const *s = 0 ? (char *) 0 : (char const *) 0;
|
| *t++ = 0;
| }
| { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
| int x[] = {25, 17};
| const int *foo = &x[0];
| ++foo;
| }
| { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
| typedef const int *iptr;
| iptr p = 0;
| ++p;
| }
| { /* AIX XL C 1.02.0.0 rejects this saying
| "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
| struct s { int j; const int *ap[3]; };
| struct s *b; b->j = 5;
| }
| { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
| const int foo = 10;
| }
| #endif
|
| ;
| return 0;
| }
configure:4082: result: no
--
Chris Frost | <http://www.frostnet.net/chris/>
-------------+----------------------------------
Public PGP Key:
Email address@hidden with the subject "retrieve pgp key"
or visit <http://www.frostnet.net/chris/about/pgp_key.phtml>
- CFLAGS="-Wall -Werror" breaks AC_C_CONST (autoconf 2.59),
Chris Frost <=