Re: Conditional warning
Re: Conditional warning
- Subject: Re: Conditional warning
- From: Chris Espinosa <email@hidden>
- Date: Wed, 8 Oct 2008 19:56:56 -0700
On Oct 8, 2008, at 7:29 PM, Ben Lachman wrote:
I'm trying to stick a conditional #warning in one of the header's
included from my projects .pch. I'd like this warning only to get
fired once per compile so I have it enclosed in a conditional, but
this doesn't seem to be working. Is there a way to only have a
warning fire just once? These are my current (not working) compiler
directives.
#define SOUSCHEF_DEBUG 1
#if SOUSCHEF_DEBUG
#ifndef SOUSCHEF_DEBUG_WARN_ONCE
#define SOUSCHEF_DEBUG_WARN_ONCE
#warning Debug Flag Enabled
#endif
#endif
Every compilation unit (source file) processes all the lines in all
the headers it includes. If you put this in a file in the #include
chain of every source file in your project, you'll get the warning
triggered once per source file.
Two notions:
1) Create a special dependent target with one dummy source file in it
that has this #warning in the source, and make your target dependent
on it.
2) Add a Run Script Build Phase to your project to just echo the
warning to the build transcript on every build, conditional on the $
(CONFIGURATION) build setting.
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