[cfe-dev] Disable #error?
Jacob Carlborg
doob at me.com
Wed Jan 15 00:09:53 PST 2014
On 2014-01-14 23:25, Sean Silva wrote:
> I don't think anyone would be against adding a callback to PPCallbacks
> to indicate what the error message is so you can get the data. However,
> being able to affect the outcome of compilation from a PPCallbacks
> callback seems unwise; it would be kind of like if the #if callback
> could decide which branch to take, which means explicitly violating the
> source code's meaning, which a compiler shouldn't be doing!
I think I actually need that as well :). I would like to be able to
translate code like this:
#if Windows
typedef int foo;
#else
typedef long foo;
#endif
To:
version (Windows)
alias foo = int;
else
alias foo = long;
Preferably I would like to do that without having to run the tool on
different platforms and somehow merge the results.
I know it technically violates the meaning of the source code. I'm just
trying to automate what a developer would do manually anyway. Doing it
manually just increases the risk of making mistakes.
--
/Jacob Carlborg
More information about the cfe-dev
mailing list