[cfe-dev] Disable #error?
Alp Toker
alp at nuanti.com
Wed Jan 15 04:54:21 PST 2014
On 14/01/2014 21:58, Sean Silva wrote:
> Just do:
>
> $ sed -i -e 's/#error.*//' **/*.h
>
> Really, ignoring the semantics of the program being analyzed (i.e.
> that it requests compilation to be aborted) is just as much of a hack
> as using sed to modify the headers. In both cases, you are forcefully
> trampling the source code's request.
Hi Sean,
The use case for 'softer' errors is source transformation and tooling,
where the directives aren't meant to be evaluated in the first place.
Without evaluation, there is no request to trample on.
There's certainly a class of syntactic errors that we could recover from
more gracefully to enable safe refactoring of incomplete translation units.
What's clear is that sed isn't a viable part of that tooling. The whole
aim is to offer a clean semantic interface to analyse and manipulate
user code -- and in that context the original source tree is always
immutable.
So let's hear out the user requests -- there's something to these but
I'm not sure quite what it is yet.
Alp.
>
> -- Sean Silva
>
>
> On Tue, Jan 14, 2014 at 2:37 PM, Jacob Carlborg <doob at me.com
> <mailto:doob at me.com>> wrote:
>
> On 2014-01-14 18:58, Alp Toker wrote:
>
> This is an interesting idea. It's always a hard error right now.
>
> We've seen similar requests to 'downgrade' a few other errors
> like the
> MS inline assembly missing-backend one and I suspect there's a
> pattern
> developing here.
>
> Could you expand on your specific use-case a little?
>
>
> I have a tool that translate C header files to D modules[1]. The
> tool is designed to translate header files one at the time. The
> problem is that in some C libraries some kind of umbrella headers
> are used. They only serve to include other sub header files. Some
> of these libraries enforce this by the sub header files checking
> for a preprocessor macro defined by the umbrella header. If this
> macro is not defined they halt the complication with the #error
> directive.
>
> I'm using libclang since the tool itself is written in D. D is ABI
> compatible with C.
>
> [1] https://github.com/jacob-carlborg/dstep
>
> --
> /Jacob Carlborg
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu <mailto:cfe-dev at cs.uiuc.edu>
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
--
http://www.nuanti.com
the browser experts
More information about the cfe-dev
mailing list