bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] sh-quote: avoid a warning from -Wstrict-prototypes


From: Bruno Haible
Subject: Re: [PATCH] sh-quote: avoid a warning from -Wstrict-prototypes
Date: Sun, 22 Nov 2009 02:33:29 +0100
User-agent: KMail/1.9.9

Hi Jim,

> I get only one -Wstrict-prototypes violation in diffutil's lib/
> directory.  This fixes it.  Ok to apply?

Not in gnulib, but you are free to use this patch as lib/sh-quote.c.diff in a
gnulib --local-dir of your package.

Rationale: In the C and C++ standards,
    static void init_sh_quoting_options () { ... }
and
    static void init_sh_quoting_options (void) { ... }
have exactly the same behaviour.

We have already examined in detail the GCC warnings that are not part of -Wall
a couple of months ago. Some of them are useful in the sense that they highlight
dangerous constructs, regardless of the programming style. Others are purely
stylistic warnings.

The -Wstrict-prototypes warning is 90% a useful warning (think of declarations
of function pointers types) and 10% a stylistic warning - regarding () vs. 
(void)
in function *definitions*.

I don't think it's good to let people push their preferred style into gnulib,
via the argument of gcc warning options - because different styles exist and
you will never achieve agreements with everyone. My style, for one, is to use
ISO C declarations with C++ spirit in some places, but avoid redundant tokens
or declarations.

So, really, it would be better to bring this up with the GCC people. So that
either they change -Wstrict-prototypes to not contain a stylistic component,
or provide a different option which only warns about dangerous constructs
and not about style. Please, someone, bring this up with them. I don't have
time for this currently.

Bruno




reply via email to

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