• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Showing more warnings possible in Xcode?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Showing more warnings possible in Xcode?


  • Subject: Re: Showing more warnings possible in Xcode?
  • From: Gwynne Raskind <email@hidden>
  • Date: Fri, 29 May 2009 23:37:46 -0400

On May 29, 2009, at 11:22 PM, Graham Cox wrote:
Is there a way to tune xCode so that it warns you of these types of potential problems (and more)? The Java development environment I've been using for the past several years (Jetbrains IDEA) has unbelievably fantastic code-editing and compile-time warning systems that allow you to show a myriad of situations as warnings (some are user definable). Is there a way to do this in xCode, or at least set some flags to get more verbose warnings (especially those that can prevent "dumb" mistakes)?
In your project's build settings, scroll down to "Other Warning Flags", and paste this lot in:

-Wall -Wcast-align -Wchar-subscripts -Wextra -Wextra-tokens - Wformat=2 -Wmissing-field-initializers -Wpointer-arith -Wshadow - Wswitch-default -Wundef -Wwrite-strings

I'm not immediately sure what they all do, but that's what I compile with (cleanly).


Nice list, Graham :).

It's important to note that the original question, warning about uninitialized automatic variables, is only possible in GCC when optimization is turned on. From Xcode's research assistant for that particular setting (emphasis mine):

--
Warn if a variable might be clobbered by a setjmp call or if an automatic variable is used without prior initialization.


***Detection of uninitialized automatic variable requires data flow analsys that is only enabled during optimized compilation.***

Note that GCC cannot detect all cases where an automatic variable is initialized or all usage patterns that may lead to use prior to initialization.
--


In short, you can't get this warning in a Debug-style build unless you want to sabotage your debugging efforts by adding optimization.

-- Gwynne

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Showing more warnings possible in Xcode?
      • From: Michael Ash <email@hidden>
References: 
 >Showing more warnings possible in Xcode? (From: Eric Hermanson <email@hidden>)
 >Re: Showing more warnings possible in Xcode? (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Showing more warnings possible in Xcode?
  • Next by Date: Custom view resizing
  • Previous by thread: Re: Showing more warnings possible in Xcode?
  • Next by thread: Re: Showing more warnings possible in Xcode?
  • Index(es):
    • Date
    • Thread