Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Enabling language-specific warnings in multi-language projects



On Jul 21, 2006, at 9:41 AM, Sean McBride wrote:

On 2006-07-20 21:24, Eric Albert said:

Urg! How can I get Xcode to use this warning only with languages that
support it and not give this silly warning otherwise?

One way to do this is to use "Other C Flags" instead of "Other Warning Flags" and then customize "Other C++ Flags" to not contain the flag. It's a bit messy, but it worked for me in a quick test.

Thanks for this workaround Eric.

But I don't fully follow... I see that by default OTHER_CPLUSPLUSFLAGS =
$(OTHER_CFLAGS) and so adding -Wdiv-by-zero to OTHER_CFLAGS will of
course apply it to C++ also. This must be what you're referring to when
you say "customize 'Other C++ Flags' to not contain the flag".

That's right.

But how
do I do that?  Can I simply set "OTHER_CPLUSPLUSFLAGS = "?  Will there
be unintended consequences of OTHER_CPLUSPLUSFLAGS not including the
OTHER_FLAGS as it does by default?

You can set that. The consequence is, as you mentioned, that it won't include OTHER_CFLAGS...but as long as your OTHER_CFLAGS value doesn't contain anything you'd want in OTHER_CPLUSPLUSFLAGS, that's OK.


Would you agree though that there needs to be a better way?

I'd like to have a better way to do this, yes.

I ask
because <rdar://4625640> got marked as "Behaves Correctly".  No doubt
from gcc's view it is correct behaviour, but from _my_ view (as an
Xcode, not gcc user) I find it quite cumbersome.

I think you got this one a bit backwards. That bug's about -Winvalid- offset-of, which is not valid for C but is valid for C++. If you set it in OTHER_CPLUSPLUSFLAGS, you'll be fine. Better yet, use the handy "Warn About Undefined Use of offsetof Macro" check box....


Hope this helps,
Eric

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden
References: 
 >Enabling language-specific warnings in multi-language projects (From: "Sean McBride" <email@hidden>)
 >Re: Enabling language-specific warnings in multi-language projects (From: Eric Albert <email@hidden>)
 >Re: Enabling language-specific warnings in multi-language projects (From: "Sean McBride" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.