mirror of
https://github.com/cc65/cc65.git
synced 2024-12-24 11:31:31 +00:00
Fix bit-field truncation warning message
Fix copy & paste bug with warning message. struct X { signed int a : 3; }; struct X g = { 5 }; Before: s.c(4): Warning: Implicit truncation from 'int' to 'int : 3' in bit-field initializer changes value from 5 to 5 After: s.c(4): Warning: Implicit truncation from 'int' to 'int : 3' in bit-field initializer changes value from 5 to -3 Fixes #1268
This commit is contained in:
parent
34177d9edd
commit
d0089aef95
@ -2567,9 +2567,9 @@ static unsigned ParseStructInit (Type* T, int* Braces, int AllowFlexibleMembers)
|
|||||||
long RestoredVal = asr_l(asl_l (Val, ShiftBits), ShiftBits);
|
long RestoredVal = asr_l(asl_l (Val, ShiftBits), ShiftBits);
|
||||||
if (ED.IVal != RestoredVal) {
|
if (ED.IVal != RestoredVal) {
|
||||||
Warning ("Implicit truncation from '%s' to '%s : %u' in bit-field initializer "
|
Warning ("Implicit truncation from '%s' to '%s : %u' in bit-field initializer "
|
||||||
"changes value from %ld to %d",
|
"changes value from %ld to %ld",
|
||||||
GetFullTypeName (ED.Type), GetFullTypeName (Entry->Type),
|
GetFullTypeName (ED.Type), GetFullTypeName (Entry->Type),
|
||||||
Entry->V.B.BitWidth, ED.IVal, Val);
|
Entry->V.B.BitWidth, ED.IVal, RestoredVal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user