[cfe-dev] Disable #error?
doob at me.com
Wed Jan 15 23:40:18 PST 2014
On 2014-01-15 22:09, Sean Silva wrote:
> The cleanest thing in your particular usecase is to just ignore that
> header if you hit that sort of #error, since you will end up including
> it through it's "proper" user-facing header when processing a different
> header. Or is there some impediment to doing that?
This doesn't really work. The problem is the tool is designed to
translate header files one by one. The reason for that is that the C
#include directive is so different from how modules work in D. I don't
want to end up with one single enormous D module which contains
declarations for a complete C library and half of the C standard
library. Therefore I'm only translating what's actually declared in the
header file being translated.
> Otherwise, it's really a discussion about "where do we put in a gross
> hack to trample the source code's intent and forcibly ignore the check
> and #error". That gross hack could be in clang, it could be done by sed,
> it could be done in memory on the file buffers, it could be done by
> detecting such errors and reparsing with -D__INCLUDED_UMBRELLA_H (or
> whatever the guard macro is), or any of a number of techniques. Without
> a really compelling use case, my gut is to not want that hack to live in
Hmm, using the -D flag is a pretty good idea, as a workaround. That
wouldn't require me to change any code.
More information about the cfe-dev