public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* g++ 4.6 and suggested flags
@ 2011-03-20 13:41 denis campredon
  2011-03-20 14:59 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: denis campredon @ 2011-03-20 13:41 UTC (permalink / raw)
  To: gcc

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: g++ 4.6 and suggested flags
  2011-03-20 13:41 g++ 4.6 and suggested flags denis campredon
@ 2011-03-20 14:59 ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2011-03-20 14:59 UTC (permalink / raw)
  To: denis campredon; +Cc: gcc

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-20 14:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-20 13:41 g++ 4.6 and suggested flags denis campredon
2011-03-20 14:59 ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).