[Top][All Lists]

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

Re: Avoid compiler warnings

From: Eric Blake
Subject: Re: Avoid compiler warnings
Date: Tue, 22 Aug 2006 11:47:01 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20060719 Thunderbird/ Mnenhy/

Hash: SHA1

[cc'ing autoconf for the first issue, on AC_C_CONST]

Hi Ralf,

According to Ralf Wildenhues on 8/14/2006 10:01 AM:
> Hello Eric,
> * Eric Blake wrote on Fri, Aug 11, 2006 at 06:42:47PM CEST:
>> I tried configuring m4 with its --enable-debug switch, which enables various 
>> -W 
>> warning options, and combined it with -Werror to forcefully see the 
>> warnings.  
> Nice to have would be the exact list of warnings this enabled on your
> system, the system, and the GCC version you used.  Plus the config.log
> excerpts for the errors you encountered.  (This isn't necessary.)

Sorry for not thinking of that the first time.  I'm on cygwin 1.5.21, gcc
3.4.4, and currently testing CVS automake, autoconf, and libtool.

>> The compilation choked when compiling libltdl.  The check for AC_C_CONST is 
>> now 
>> obsolete, but warned due to -Wshadow, which made it fail and define const to 
>> the empty string, and led to all sorts of followon fun.  

$ ./configure CFLAGS='-Wall -Werror -Wconst'
checking for an ANSI C-conforming const... no
$ less config.log
configure:11121: gcc -c -Werror -Wshadow -Wall  conftest.c >&5
conftest.c: In function `main':
conftest.c:55: warning: declaration of 'x' shadows a previous local
conftest.c:30: warning: shadowed declaration is here
conftest.c:61: warning: declaration of 'p' shadows a previous local
conftest.c:33: warning: shadowed declaration is here

I don't know if this is worth fixing upstream in autoconf, since we have
documented that it is obsolete, but it would just be a couple of variable
renames to ensure that nothing in AC_C_CONST shadows anything else.

>> And the check for how 
>> to use nm was failing due to -Wmissing-prototypes.  Yes, it's probably too 
>> strict of an environment to sanely compile in normally, but it was easy 
>> enough 
>> to patch.  OK to apply?  Should I try backporting it to 1.5.x as well?

$ ./configure CFLAGS='-Werror -Wmissing-prototypes'
$ less config.log
configure:6190: checking command to parse /usr/bin/nm -B output from gcc
configure:6306: gcc -c -Werror -Wmissing-prototypes  conftest.c >&5
conftest.c:5: warning: no previous prototype for 'nm_test_func'

> The changes in the first patch are ok provided they have been tested on
> MinGW and Cygwin (MinGW exercises lt__dirent.h, right?); please do not
> backport them to branch-1-5, though.

Easily tested on cygwin.  MinGW was harder, but I think I tested it
correctly; however, mingw now provides a working dirent.h, so it did not
use the WINDOWS fallback.  My understanding is the only oddball system
without dirent.h now is MSVC, and I don't have access to that compiler
(I'm not about to pay money for a non-compliant and proprietary compiler
when better ones are freely available, in both senses of the word free).

> * Eric Blake wrote on Fri, Aug 11, 2006 at 08:04:51PM CEST:
>> A followon - using LTDL_SET_PRELOADED_SYMBOLS() choked with
>> -Wnested-externs.
>> 2006-08-11  Eric Blake  <address@hidden>
>>       * libltdl/ltdl.h (lt_preloaded_symbols): Declare outside of a
>>       nested scope.
> No, please drop this patch.  (Rationale: I'm not convinced this
> declaration isn't a problem on some w32 system.)

OK, I won't touch that part for now.  But it does mean that libtool should
probably document that using -Wnested-externs is inadvisable when using
preloaded libraries with libltdl.

> Cheers,
> Ralf

- --
Life is short - so eat dessert first!

Eric Blake             address@hidden
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at
Comment: Using GnuPG with Mozilla -


reply via email to

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