bug-autoconf
[Top][All Lists]
Advanced

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

AC 2.59/2.57: AC_C_CONST breaks with -Wcast-qual -pedantic-errors on GCC


From: Matthias Andree
Subject: AC 2.59/2.57: AC_C_CONST breaks with -Wcast-qual -pedantic-errors on GCC 2.95.
Date: Thu, 22 Jan 2004 02:41:05 +0100
User-agent: Mutt/1.5.5.1i

Hi,

I have a problem with AC_C_CONST on FreeBSD 4.9:

AC_C_CONST doesn't work on GCC 2.95 with -Wcast-qual AND
-pedantic-errors both set. This problem goes away by doing either of:

- switching to GCC 3.3,
- using -pedantic instead of -pedantic-error,
- omitting -Wcast-qual.

The problem is a - IMHO - broken test in the corresponding conftest. ccp
is a const * const * something variable, and here's the config.log
snippet:

configure:2664: checking for an ANSI C-conforming const
configure:2732: gcc -c -std=c89 -pedantic-errors -Wcast-qual  conftest.c >&5
configure: In function `main':
configure:2702: cast discards qualifiers from pointer target type
configure:2735: $? = 1
configure: failed program was:
...
| /* HPUX 7.0 cc rejects these. */
| ++ccp;
> p = (char**) ccp;
| ccp = (char const *const *) p;
| { /* SCO 3.2v4 cc rejects this.  */
...

I wonder if this bogus (char **)ccp can be dropped from the test.

To reproduce this, unpack this shar, cd to the directory run autoconf
2.57 or 2.59 with -i option, then (FWIW, I used automake 1.7 but it
isn't involved so you need not care):

./configure CFLAGS="-std=c89 -pedantic-errors -Wcast-qual" CC=/path/to/gcc-2.95

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#       minimal
#       minimal/hello.c
#       minimal/configure.ac
#       minimal/Makefile.am
#
echo c - minimal
mkdir -p minimal > /dev/null 2>&1
echo x - minimal/hello.c
sed 's/^X//' >minimal/hello.c << 'END-of-minimal/hello.c'
X#include <stdio.h>
X
Xint main(void) {
X       const char *const s = "Hello, world!\n";
X       puts(s);
X       return 0;
X}
END-of-minimal/hello.c
echo x - minimal/configure.ac
sed 's/^X//' >minimal/configure.ac << 'END-of-minimal/configure.ac'
X#                                               -*- Autoconf -*-
X# Process this file with autoconf to produce a configure script.
X
XAC_PREREQ(2.57)
XAC_INIT(breakme, 1.0)
XAC_CONFIG_SRCDIR([hello.c])
Xdnl AC_CONFIG_HEADER([config.h])
XAM_INIT_AUTOMAKE(foreign)
X
X# Checks for programs.
XAC_PROG_CC
X
X# Checks for libraries.
X
X# Checks for header files.
X
X# Checks for typedefs, structures, and compiler characteristics.
XAC_C_CONST
X
X# Checks for library functions.
X
XAC_CONFIG_FILES([Makefile])
XAC_OUTPUT
END-of-minimal/configure.ac
echo x - minimal/Makefile.am
sed 's/^X//' >minimal/Makefile.am << 'END-of-minimal/Makefile.am'
Xbin_PROGRAMS=hello
END-of-minimal/Makefile.am
exit


-- 
Matthias Andree

Encrypt your mail: my GnuPG key ID is 0x052E7D95




reply via email to

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