[cfe-commits] r67045 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/Sema/bitfield.c
Anders Carlsson
andersca at mac.com
Mon Mar 16 11:19:22 PDT 2009
Author: andersca
Date: Mon Mar 16 13:19:21 2009
New Revision: 67045
URL: http://llvm.org/viewvc/llvm-project?rev=67045&view=rev
Log:
Check signedness of bitfield sizes.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Sema/bitfield.c
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=67045&r1=67044&r2=67045&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Mar 16 13:19:21 2009
@@ -3363,7 +3363,7 @@
if (Value == 0 && FieldName)
return Diag(FieldLoc, diag::err_bitfield_has_zero_width) << FieldName;
- if (Value.isNegative())
+ if (Value.isSigned() && Value.isNegative())
return Diag(FieldLoc, diag::err_bitfield_has_negative_width)
<< FieldName << Value.toString(10);
Modified: cfe/trunk/test/Sema/bitfield.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/bitfield.c?rev=67045&r1=67044&r2=67045&view=diff
==============================================================================
--- cfe/trunk/test/Sema/bitfield.c (original)
+++ cfe/trunk/test/Sema/bitfield.c Mon Mar 16 13:19:21 2009
@@ -17,5 +17,7 @@
// PR3607
enum e0 f : 1; // expected-error {{field has incomplete type 'enum e0'}}
+
+ int g : (_Bool)1;
};
More information about the cfe-commits
mailing list