• 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: disabling warnings on a smaller scal
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: disabling warnings on a smaller scal


  • Subject: Re: disabling warnings on a smaller scal
  • From: Chris Espinosa <email@hidden>
  • Date: Fri, 13 Jan 2006 15:19:30 -0800

On Jan 13, 2006, at 3:11 PM, John C. Daub wrote:

I'm going through our code cleaning out deprecated functions. I know about

the GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS and the -Wno-deprecated-declarations

stuff... but those appear to only function on a whole project/target or

perhaps a single-file granularity.


Is there any way to disable a warning around say a particular function or

block of code?


For instance, I'll have a C++ class that's mostly modern save a few

functions that we just have to leave using deprecated functionality. As a

result, building isn't 100% clean because we'll get the deprecated warnings.

In general we want to address such warnings so we want the setting on, but

in these few exceptional cases we know what's going on and just don't need

the compiler emitting warnings in these known exceptional cases. So, is

there a way to disable a warning on a granularity of say a function or a

block of code?


Bueller? :-)


Well, I found a solution.


I took my functions that use the deprecated OS functions and moved them into

another file. So if I had the class Foo in Foo.cpp, I moved the deprecated

functions into a Foo_deprecated.cpp file. Added the Foo_deprecated.cpp file

to the project, opened the Info window for the file, switched to the Build

tab, and added "-Wno-deprecated-declarations" as a build option for the

compilation of that file.


And that seems to work.


That is the recommended solution. gcc is generally weak on in-file directives, preferring per-file flags.  This is a design preference in the gnu community that differs from the CodeWarrior and Visual Studio traditions.

Chris
 _______________________________________________
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: disabling warnings on a smaller scal
      • From: "John C. Daub" <email@hidden>
References: 
 >Re: disabling warnings on a smaller scal (From: "John C. Daub" <email@hidden>)

  • Prev by Date: Re: disabling warnings on a smaller scal
  • Next by Date: Re: Trying to setup for remote debug
  • Previous by thread: Re: disabling warnings on a smaller scal
  • Next by thread: Re: disabling warnings on a smaller scal
  • Index(es):
    • Date
    • Thread