bug-gnulib
[Top][All Lists]
Advanced

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

Re: avoid some warnings in tests


From: Bruno Haible
Subject: Re: avoid some warnings in tests
Date: Sun, 25 Oct 2009 21:42:48 +0100
User-agent: KMail/1.9.9

Ben Pfaff wrote:
> >   - There is no reason for GCC to warn about foo().
> 
> Probably Eric is using -Wstrict-prototypes:
> 
>     `-Wstrict-prototypes (C and Objective-C only)'
>          Warn if a function is declared or defined without specifying the
>          argument types.  (An old-style function definition is permitted
>          without a warning if preceded by a declaration which specifies the
>          argument types.)
> 
> -Wstrict-prototypes is useful for finding foo()-style
> declarations (especially in header files) to remind the
> programmer to change them to foo(void) prototypes, so that
> callers cannot inadvertently invoke them with one or more
> arguments.

I agree with the usefulness of this warning for function *declarations*.
But for function *definitions* it is not useful to warn about
   int foo(void) { ... }
because when the caller inadvertently provides the wrong number of
arguments, a compilation error results anyway.

This GCC warning option is broken. It warns about code for which there
is no reason to warn about.

Bruno




reply via email to

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