[LLVMbugs] [Bug 9354] New: Report implicit casts of an enum type
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Mar 1 09:55:34 PST 2011
http://llvm.org/bugs/show_bug.cgi?id=9354
Summary: Report implicit casts of an enum type
Product: clang
Version: unspecified
Platform: PC
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P
Component: Static Analyzer
AssignedTo: kremenek at apple.com
ReportedBy: ranma42 at gmail.com
CC: llvmbugs at cs.uiuc.edu
I'm sanitizing a C project that (mis)uses enums.
I'm looking for a simple way to find out all the occurrence of implicit casts
to an enum type and/or from an enum type, in order to have for coding style
consistency and to ensure that the code is not misusing the enum values.
Example:
typedef enum {
A1=0, B1, C1 } myenum1;
typedef enum {
A2, B2, C2 } myenum2;
...
myenum1 x;
myenum2 y;
if (x == 0) {} /* warning */
if (x == A1) {} /* OK */
if (x == y) {} /* warning */
if (x == ((myenum1) y)) {} /* OK */
switch(x) {
0: /* warning */
B2: /* warning */
C1: /* OK */
}
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list