This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: g++ 4.6 and suggested flags
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: denis campredon <denis dot campredon at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Sun, 20 Mar 2011 14:59:39 +0000
- Subject: Re: g++ 4.6 and suggested flags
- References: <AANLkTimdwgq5BoAcByRUJ3n1quMHVG+g+s1ukSEe3PFA@mail.gmail.com>
On 20 March 2011 13:41, denis campredon wrote:
> downloaded gcc 4.6, and tried it.
>
> And I found something a little strange when I compile a file :
>
> g++ displayboard.cpp -lncurses -c
> displayboard.cpp: In constructor ‘DisplayBoard::DisplayBoard(int, int)’:
> displayboard.cpp:47:22: error: invalid conversion from ‘void (*
> (*)())(int)’ to ‘sighandler_t’ [-fpermissive]
> displayboard.cpp:41:16: error: ? initializing argument 2 of ‘void (*
> signal(int, sighandler_t))(int)’ [-fpermissive]
>
>
> So, I tried to compile with the flag suggested
>
>
> g++ displayboard.cpp -lncurses -c -fpermissive
> displayboard.cpp: In constructor ‘DisplayBoard::DisplayBoard(int, int)’:
> displayboard.cpp:47:22: warning: invalid conversion from ‘void (*
> (*)())(int)’ to ‘sighandler_t’ [-fpermissive]
> displayboard.cpp:41:16: warning: ? initializing argument 2 of ‘void (*
> signal(int, sighandler_t))(int)’ [-fpermissive]
>
>
>
> So I was wondering if it was normal to gcc to suggest the same flag,
> who can't change the output for the second case.
This mailing list is for discussing development of gcc, not help using
gcc. Please take any further questions to the gcc-help@gcc.gnu.org
mailing list, thanks.
Yes, it's normal. The [-fpermissive] annotation on the warning tells
you which flag controls the warning, it isn't telling you that using
the flag will make the warning go away. Using the flag downgraded the
diagnostic from an error to a warning.
Compare it with other diagnostic output e.g.
warning: comparison between signed and unsigned integer expressions
[-Wsign-compare]
This tells you the diagnostic is controlled by the -Wsign-compare
option, not that adding -Wsign-compare will make the warning go away.