bug-gnulib
[Top][All Lists]
Advanced

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

Re: [bug-gnulib] compiler warnings in getopt.c


From: Bruno Haible
Subject: Re: [bug-gnulib] compiler warnings in getopt.c
Date: Mon, 5 Sep 2005 13:33:27 +0200
User-agent: KMail/1.5

Werner LEMBERG wrote:
> Compiling getopt.c I get these warnings from gcc:
>
>   getopt.c: In function `_getopt_initialize':
>   getopt.c:253: warning: unused parameter `argc'
>   getopt.c:253: warning: unused parameter `argv'
>   getopt.c:1159:5: warning: "_LIBC" is not defined

You get these warnings only when you use -W and -Wall simultaneously.
The gcc doc says about these
  "Some of them warn about constructions that users generally do not consider
   questionable, but which occasionally you might wish to check for;
   others warn about constructions that are necessary or hard to avoid in
   some cases, and there is no simple way to modify the code to suppress
   the warning."

We do something about this kind of warnings when they indicate bugs, but
otherwise we let gcc complain. However, we try to eradicate all "gcc -Wall"
warnings.

Especially the
  warning: "_LIBC" is not defined
will be repeated hundreds of times for various HAVE_... feature macros.
We have adopted the style
  #if HAVE_XXX
instead of
  #ifdef HAVE_XXX
because it allows the HAVE_XXX to carry the value 0 and thus to be used
inside normal C expressions, not only in preprocessor expressions. But
evidently in many cases the autoconf test sets HAVE_XXX to 1 or doesn't
define it at all; that's the traditional autoconf behaviour.

Bruno





reply via email to

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