• 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: Per-file Warnings suppression?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Per-file Warnings suppression?


  • Subject: Re: Per-file Warnings suppression?
  • From: Brian Stern <email@hidden>
  • Date: Wed, 1 Oct 2008 22:27:31 -0400


On Oct 1, 2008, at 9:06 PM, Michael Crawford wrote:

On Wed, Oct 1, 2008 at 10:11 AM, Brian Stern <email@hidden> wrote:
What would make all of this much simpler would be if gcc had a way of
turning on/off warnings and other compiler settings in the source code. I
don't think it has any way to do that. Is this a feature that's ever been
suggested for gcc? Is there any likelihood of it ever being implemented?

The natural way to do that would be to use a #pragma, which is what Visual Studio does, but #pragma's give Richard Stallman hives because they're not portable.

Richard Stallman's health is of little concern to me. Actually that's a lie. No concern to me.


Codewarrior also implemented this sort of feature with #pragmas. The #pragma GCC diagnostic mentioned upthread indicates that this is the/a direction that gcc is moving in, which is a good thing. It gives more control and more flexibility to developers.

While the per file compiler flags is a powerful feature of Xcode it is somewhat obscure. Imagine that you inherit a project from someone else that has 1000 source files and some number of per file compiler flags to turn off warnings or modify optimization or really anything. How would you sort that out or track down bugs that would have been revealed by having warnings turned on?

Having #pragmas in a source file is much more visible. I think you can wrap #pragmas with #ifdefs so you can prevent them from being visible in a particular build environment if need be anyway.

I definitely would like to have most warnings turned on but be able to turn off a particular warning for a particular function or file. I also have had cases where a particular function wouldn't compile with full optimizations so I'd like to be able to modify the optimization settings for a particular function or a particular file in code.

And since we're talking about this: Is it possible to set a per file compiler setting for generated source files (e.g. yacc generated source files)?

--
Brian Stern
email@hidden



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Per-file Warnings suppression?
      • From: Dave Carrigan <email@hidden>
References: 
 >Re: Per-file Warnings suppression? (From: Chris Espinosa <email@hidden>)
 >Re: Per-file Warnings suppression? (From: Brian Stern <email@hidden>)
 >Re: Per-file Warnings suppression? (From: "Michael Crawford" <email@hidden>)

  • Prev by Date: Re: link error.
  • Next by Date: Re: link error.
  • Previous by thread: Re: Per-file Warnings suppression?
  • Next by thread: Re: Per-file Warnings suppression?
  • Index(es):
    • Date
    • Thread