[PATCH] Add a check to flag the usage of C-style casts (Google Style).

Alexander Kornienko alexfh at google.com
Wed Jun 25 11:16:28 PDT 2014


On Wed, Jun 25, 2014 at 7:17 PM, Alp Toker <alp at nuanti.com> wrote:

>
> On 25/06/2014 14:06, Alexander Kornienko wrote:
>
>  On Wed, Jun 25, 2014 at 10:48 AM, Alp Toker <alp at nuanti.com <mailto:
>> alp at nuanti.com>> wrote:
>>
>>     How about just using -Wold-style-cast?
>>
>>
>> I thought, it was agreed upon, that the -Wold-style-cast warning isn't
>> going to suggest automatic fixes: http://lists.cs.uiuc.edu/
>> pipermail/cfe-commits/Week-of-Mon-20131125/094121.html. However, this
>> check is going to.
>>
>> Any other concerns?
>>
>>
> Hmm, if this is identical to -Wold-style-cast why is it going into
> clang-tidy/google/?
>
> There doesn't seem to be anything Google-specific at all here, any more
> than the equivalent compiler flag in clang is Nuanti-specific.


Currently, we're trying to organize the checks by coding style to make it
easy to select all checks from a certain style (using -checks=-*,google-*
or -checks=-*,llvm-*). And from the two coding styles we are currently
planning to support, only one specifically has the rule to avoid C-style
casts. If the check didn't implement a rule of one of this styles, it would
go misc/.

We know that this system is sub-optimal, as categorization of the checks by
style doesn't work well when checks can be shared between styles. A better
approach could be to have checks arranged separately by some property (e.g.
some characteristic of the issue they address -
readability/performance/compatibility/bug-prone coding patterns), and the
styles being just lists of checks with specific configurations and
meta-data (e.g. links to specific style guide rules).

We're going to do this kind of rearrangement, but it will be done
independently from this patch.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140625/43dd270d/attachment.html>


More information about the cfe-commits mailing list