[PATCH] implement -Wold-style-cast

Ondřej Hošek ondra.hosek at gmail.com
Thu Nov 21 09:19:51 PST 2013


Hello,

the attached patch implements the old-style cast warning known from GCC
(activated via -Wold-style-cast). The warning is triggered by C-style
(parentheses) casts in C++ code.

This patch has been motivated by a thread on Apple's Objective-C
language mailing list. [1] I have also submitted it as bug #18012. [2]

A warning is emitted on:
* parentheses casts in C++ or Objective-C++ code

No warning is emitted on:
* parentheses casts in C or Objective-C code
* (static|dynamic|reinterpret)_casts in C++ or Objective-C++ code
* functional-style casts in C++ or Objective-C++ code

This matches GCC behavior.

Cheers,
~~ Ondra

[1] http://lists.apple.com/archives/objc-language/2013/Nov/msg00018.html
[2] http://llvm.org/bugs/show_bug.cgi?id=18012
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Wold-style-cast.patch
Type: text/x-patch
Size: 2380 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131121/ffa44f8f/attachment.bin>


More information about the cfe-commits mailing list