From 82c8bd6e2b9e1c53cfb60462d56ce049a01d0554 Mon Sep 17 00:00:00 2001 From: Jesse Rosenstock Date: Wed, 8 Jul 2020 23:16:15 +0200 Subject: [PATCH] Replace unary negation with subtraction Remove MSVC pragma. --- src/cc65/declare.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/cc65/declare.c b/src/cc65/declare.c index ab9b45e15..58baaf769 100644 --- a/src/cc65/declare.c +++ b/src/cc65/declare.c @@ -772,14 +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. MSVC complains - ** about unary negation of unsigned, but it's intended. - ** Disable the warning for the next line only. + /* Bits needed to byte-align the next field. + ** MSVC complains about unary negation of unsigned, + ** so it has been rewritten as subtraction. */ - #ifdef _MSC_VER - #pragma warning(disable: 4146) - #endif - unsigned PaddingBits = -BitOffs % CHAR_BITS; + unsigned PaddingBits = (0 - BitOffs) % CHAR_BITS; /* We need an anonymous name */ AnonName (Ident, "bit-field");