public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* -Wconversion
@ 2004-04-17 16:59 Steven J Abner
  2004-04-17 18:36 ` -Wconversion Ian Lance Taylor
  0 siblings, 1 reply; 3+ messages in thread
From: Steven J Abner @ 2004-04-17 16:59 UTC (permalink / raw)
  To: gcc-help

Hi
    I would like to use -Wconversion in building, however I've searched 
to find a way (like #pragma unused) to shut of the warning for a 
specific case.
    Example:
warning: passing arg 2 of 'chmod' with different width due to prototype
    I'm satisfied that there is no problem, so for the function or the 
location or completed source file that uses 'chmod' I'd like to stop the 
warning, but use a blanket flag -Wconversion for any new code created 
within a project or that source file.
    Is this possible? or is what I'm asking defeating the purpose? Is 
there a directive that I can place at the head of the source file that 
can be removed if new code is added?
    Thanks

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

* Re: -Wconversion
  2004-04-17 16:59 -Wconversion Steven J Abner
@ 2004-04-17 18:36 ` Ian Lance Taylor
  2004-04-17 19:11   ` -Wconversion Steven J Abner
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Lance Taylor @ 2004-04-17 18:36 UTC (permalink / raw)
  To: Steven J Abner; +Cc: gcc-help

Steven J Abner <tauvan@starpower.net> writes:

>     I would like to use -Wconversion in building, however I've
> searched to find a way (like #pragma unused) to shut of the warning
> for a specific case.
>     Example:
> warning: passing arg 2 of 'chmod' with different width due to prototype
>     I'm satisfied that there is no problem, so for the function or the
> location or completed source file that uses 'chmod' I'd like to stop
> the warning, but use a blanket flag -Wconversion for any new code
> created within a project or that source file.
>     Is this possible? or is what I'm asking defeating the purpose? Is
> there a directive that I can place at the head of the source file that
> can be removed if new code is added?

Use typecasts: chmod ("foo", (mode_t) x);

Ian

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

* Re: -Wconversion
  2004-04-17 18:36 ` -Wconversion Ian Lance Taylor
@ 2004-04-17 19:11   ` Steven J Abner
  0 siblings, 0 replies; 3+ messages in thread
From: Steven J Abner @ 2004-04-17 19:11 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help


On Saturday, April 17, 2004, at 02:36 PM, Ian Lance Taylor wrote:

> Use typecasts: chmod ("foo", (mode_t) x);

Thanks.
My variable x is mode_t and casting it a second time as mode_t does stop
my warning.

Steven

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

end of thread, other threads:[~2004-04-17 19:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-17 16:59 -Wconversion Steven J Abner
2004-04-17 18:36 ` -Wconversion Ian Lance Taylor
2004-04-17 19:11   ` -Wconversion Steven J Abner

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).