[cfe-dev] #error and #warning: why include "#error/#warning" in the diagnostic?
clattner at apple.com
Wed Feb 1 11:53:17 PST 2012
On Feb 1, 2012, at 8:57 AM, Douglas Gregor wrote:
> On Feb 1, 2012, at 8:51 AM, Ted Kremenek wrote:
>> On Feb 1, 2012, at 8:46 AM, Douglas Gregor wrote:
>>> *That* is a general flag that affects every diagnostic Clang can emit. It controls a formatting policy.
>>> What you're proposing is a flag that tweaks the wording of two specific diagnostics. It's too narrow in scope to warrant a special flag.
>>>> More generally, I can see different clients wanting to control the diagnostic output of the compiler. We can look for a general solution here; e.g., a single flag that can control various diagnostic options.
>>> Options that control general policies (color, word-wrapping, macro/template depth, carets, Fix-Its, ranges) all make sense. Options that tweak the wording of specific diagnostics don't, because it's not a useful thing for a user to think about ("oh, I *would* like that diagnostic to have a slightly different wording. let me go modify my build settings…") and because this solution just doesn't scale if we start resolving "what's the best wording?" discussions by adding a flag.
>> I agree in principle, but this isn't an academic problem. For clients (e.g., an IDE) that don't want to include the #error or #warning in the diagnostic, because they have diagnostic categories to show to user, what would you propose as the solution?
> My suggestion is to never include the #error or #warning, nor any text to explicitly stating that this diagnostic comes from a #warning or #error. It provides no value to any client that maps the error over to source code (whether it be through the caret diagnostics, range highlighting/jump-to-error in an IDE, or just plan looking at the line number). And I can't bring myself to care about clients that don't map the error over to source code, because this particular set of diagnostics is just the tip of the iceberg for those clients who willfully throw out all of the useful information we provide.
FWIW, I completely agree with Doug.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev