Re: Warning flag for 'if (x = y)'
Re: Warning flag for 'if (x = y)'
- Subject: Re: Warning flag for 'if (x = y)'
- From: Scott Tooker <email@hidden>
- Date: Mon, 26 Jan 2004 14:17:59 -0800
On Jan 16, 2004, at 11:42 AM, Prachi Gauriar wrote:
> On Jan 16, 2004, at 1:03 PM, Alastair Houghton wrote:
>
>> On 16 Jan 2004, at 18:00, Matt Gough wrote:
>>>
>>> I just spent half an hour tracking down a bug caused by doing:
>>>
>>> if (x = y)
>>>
>>> when I meant:
>>>
>>> if (x == y)
>>> <snip>
>>
>> The warning flag you are after is -Wparentheses. Personally, I use
>> -Wall, which includes this warning by default; you might be using
>> -Wmost, which doesn't.
>
> In Xcode, if I set that flag for the build style, I get no warnings,
> but when I set it on a particular file, I do. Is this expected
> behavior? I would think you could set it for the whole project, but
> it doesn't quite work.
by default "Other Warning Flags" gets populated with -Wmost (and some
other warning flags), since the other warning flags are passed later
than the "Missing Braces and Parentheses" warning flag. So you have two
options:
1) add "-Wparentheses" to the end of "Other Warning Flags" in the
target (unless you have a ton of targets, it's less hassle just to
modify the targets in this case). If you want to do this in a build
style set "Other Warning Flags" to "$(value) -Wparentheses".
2) Clear out "Other Warning Flags" and re-enable the warnings you want
in the target individually. This is problematic since there is no way
to turn off all warnings in gcc and build them up one by one, but in
many cases this will do what you want.
Scott
>
> -Prachi
> _______________________________________________
> xcode-users mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/xcode-users
> Do not post admin requests to the list. They will be ignored.
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.