1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-24 11:31:31 +00:00

Fix MSVC build broken by #1058

MSVC complains about unary negation of unsigned, but it's
intended.  Suppress the warning.

https://github.com/cc65/cc65/pull/1058#discussion_r451757967

"Tested" with godbolt.org.
This commit is contained in:
Jesse Rosenstock 2020-07-08 21:28:31 +02:00 committed by Oliver Schmidt
parent 359da1ae76
commit 9e5b8d99a3

View File

@ -772,7 +772,11 @@ static SymEntry* ParseStructDecl (const char* Name)
*/
if (BitOffs > 0) {
if (FieldWidth <= 0 || (BitOffs + FieldWidth) > INT_BITS) {
/* Bits needed to byte-align the next field. */
/* Bits needed to byte-align the next field. MSVC complains
** about unary negation of unsigned, but it's intended.
** Disable the warning for the next line only.
*/
#pragma warning(disable: 4146)
unsigned PaddingBits = -BitOffs % CHAR_BITS;
/* We need an anonymous name */