[cfe-dev] #error and #warning: why include "#error/#warning" in the diagnostic?

Eric Christopher echristo at apple.com
Tue Jan 31 18:03:40 PST 2012


On Jan 31, 2012, at 6:00 PM, Douglas Gregor wrote:

> 
> 
> Sent from my iPhone
> 
> On Jan 31, 2012, at 1:39 PM, Eric Christopher <echristo at apple.com> wrote:
> 
>> 
>> On Jan 31, 2012, at 12:35 PM, Ted Kremenek wrote:
>> 
>>> On Jan 31, 2012, at 12:29 PM, Dmitri Gribenko wrote:
>>> 
>>>> On Tue, Jan 31, 2012 at 10:17 PM, Ted Kremenek <kremenek at apple.com> wrote:
>>>>> I received some feedback from some users who wondered why #error/#warning diagnostics include the actual "#error" in the diagnostic, e.g.:
>>>>> 
>>>>> t.c:1:2: error: #error this is an error
>>>>> 
>>>>> This seems redundant.  Is this necessary?
>>>> 
>>>> It marks explicitly diagnostics that come from source code (as opposed
>>>> to diagnostics coming from the compiler).
>>> 
>>> That seems fine for text output, but for other clients (e.g., IDEs) we have diagnostic categories that could provide the same functionality with a much better experience.
>> 
>> True, no ideas how to do that though. Distinguishing between "compile error because the code is wrong" and "compile error because of a #error" is at least reasonably important I think.
> 
> But the caret location makes it blindingly obvious that this came from a #error or #warning. We don't need the diagnostic text to remind us a second time.

Yeah, I'd thought of that later. I was thinking again of text for some reason as IDE output :)

-eric



More information about the cfe-dev mailing list