[Top][All Lists]

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

Bug or not? Order of compiler warning flags matters

From: Marcel Loose
Subject: Bug or not? Order of compiler warning flags matters
Date: Mon, 22 Nov 2004 13:44:58 +0100

Hi all,

I'm not sure whether this is a bug, or "expected" GCC behaviour. Hence, I
want to check here first, before submitting a bug report.
Consider the following code:

void f(int i)

int main()
  return 0;

Compiling this with -Wall -W correctly produces the warning about the unused
parameter `int i'.
Adding the flag -Wno-unused-parameter suppresses this warning, but ONLY when
it is added AFTER the -Wall switch.

$ gcc -W -Wall -Wno-unused-parameter

OK, silent.

$ gcc -W -Wno-unused-parameter -Wall In function `void f(int)': warning: unused parameter `int i'

Not OK. I don't want this warning.

Now it wouldn't be such a big deal if I would have complete control over the
order of the compiler flags. However, since we use the GNU Autotools for our
project, I decided to use "AM_CXXFLAGS = -Wno-unused-parameter" in my As you might guess, automake (or one of the other auto-tools)
places this flag as the very first, after some flags (like -Wall -W) that
are added by default to our list of compiler flags. Hence, the flag is
effectively ignored.

Could anyone shed a light on this issue. Thanks in advance.

Kind regards,

    Marcel Loose.

reply via email to

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