forked from OSchip/llvm-project
Improve the bit-field too wide error message.
llvm-svn: 101384
This commit is contained in:
parent
1ba1428577
commit
7a4a25de1e
|
@ -1666,9 +1666,9 @@ def err_anon_bitfield_has_negative_width : Error<
|
|||
"anonymous bit-field has negative width (%0)">;
|
||||
def err_bitfield_has_zero_width : Error<"named bit-field %0 has zero width">;
|
||||
def err_bitfield_width_exceeds_type_size : Error<
|
||||
"size of bit-field %0 exceeds size of its type (%1 bits)">;
|
||||
"size of bit-field %0 (%1 bits) exceeds size of its type (%2 bits)">;
|
||||
def err_anon_bitfield_width_exceeds_type_size : Error<
|
||||
"size of anonymous bit-field exceeds size of its type (%0 bits)">;
|
||||
"size of anonymous bit-field (%0 bits) exceeds size of its type (%1 bits)">;
|
||||
def warn_missing_braces : Warning<
|
||||
"suggest braces around initialization of subobject">,
|
||||
InGroup<DiagGroup<"missing-braces">>, DefaultIgnore;
|
||||
|
|
|
@ -5373,9 +5373,9 @@ bool Sema::VerifyBitField(SourceLocation FieldLoc, IdentifierInfo *FieldName,
|
|||
if (Value.getZExtValue() > TypeSize) {
|
||||
if (FieldName)
|
||||
return Diag(FieldLoc, diag::err_bitfield_width_exceeds_type_size)
|
||||
<< FieldName << (unsigned)TypeSize;
|
||||
<< FieldName << (unsigned)Value.getZExtValue() << (unsigned)TypeSize;
|
||||
return Diag(FieldLoc, diag::err_anon_bitfield_width_exceeds_type_size)
|
||||
<< (unsigned)TypeSize;
|
||||
<< (unsigned)Value.getZExtValue() << (unsigned)TypeSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ struct a {
|
|||
int a : -1; // expected-error{{bit-field 'a' has negative width}}
|
||||
|
||||
// rdar://6081627
|
||||
int b : 33; // expected-error{{size of bit-field 'b' exceeds size of its type (32 bits)}}
|
||||
int b : 33; // expected-error{{size of bit-field 'b' (33 bits) exceeds size of its type (32 bits)}}
|
||||
|
||||
int c : (1 + 0.25); // expected-error{{expression is not an integer constant expression}}
|
||||
int d : (int)(1 + 0.25);
|
||||
|
@ -21,7 +21,7 @@ struct a {
|
|||
int g : (_Bool)1;
|
||||
|
||||
// PR4017
|
||||
char : 10; // expected-error {{size of anonymous bit-field exceeds size of its type (8 bits)}}
|
||||
char : 10; // expected-error {{size of anonymous bit-field (10 bits) exceeds size of its type (8 bits)}}
|
||||
unsigned : -2; // expected-error {{anonymous bit-field has negative width (-2)}}
|
||||
float : 12; // expected-error {{anonymous bit-field has non-integral type 'float'}}
|
||||
};
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
int a : -1; // expected-error{{bit-field 'a' has negative width}}
|
||||
|
||||
// rdar://6081627
|
||||
int b : 33; // expected-error{{size of bit-field 'b' exceeds size of its type (32 bits)}}
|
||||
int b : 33; // expected-error{{size of bit-field 'b' (33 bits) exceeds size of its type (32 bits)}}
|
||||
|
||||
int c : (1 + 0.25); // expected-error{{expression is not an integer constant expression}}
|
||||
int d : (int)(1 + 0.25);
|
||||
|
|
Loading…
Reference in New Issue