Add 'remark' diagnostic type in clang

Arthur O'Dwyer arthur.j.odwyer at gmail.com
Wed Feb 26 14:57:49 PST 2014


On Wed, Feb 26, 2014 at 2:27 PM, Chris Lattner <clattner at apple.com> wrote:
> On Feb 26, 2014, at 2:26 PM, Hal Finkel <hfinkel at anl.gov> wrote:
>>
>> Remarks should often indicate things that are good (like this loop was vectorized),
>> and so upgrading remarks to errors will only make sense for 'negative' remarks.
>
> Each remark should have its own identifier, so people can choose to upgrade them
> or not.  It’s not worth the complexity to try to add another level or behavior for
> “positive remarks”.

Hear hear hear hear hear.

-------------

Going off on an ambitious tangent here: It seems to me that -Werror is
currently a synonym for what in EDG's world would be spelled
"--diag_error=<all-diags-that-are-warnings-by-default>".

I.e., we might have the generic syntax
"-W<severity>=<diagnostic-class>", of which "-Werror=format" is
currently an example. We'd add additional diagnostic-classes, such as
"warnings" = "the class of all diags that are warnings by default",
"remarks" = "the class of all diags that are remarks by default" and
"everything" = "the class of all diags, period". Then

-Werror=foo  remains exactly the same
-Werror   becomes a driver synonym for -Werror=warnings
-Wformat   becomes a driver synonym for -Wwarning=format
-Wno-format  becomes a driver synonym for -Wsuppress=format
-Weverything  becomes a driver synonym for -Wwarning=everything

and so on.

--remarks would still be its own thing, since (as I mentioned before)
it's about conceptually //redirecting the output// of certain
diagnostics, which isn't the same thing as //changing the severity//
of those diagnostics.
I believe -w falls in the same category as --remarks (conceptually
redirecting diagnostics of less-than-error severity to the bitbucket),
rather than trying to treat it as a driver synonym for
"-Wsuppress=warnings"; the difference is detectable via command lines
like "clang -w -Wformat".

–Arthur




More information about the cfe-commits mailing list