From 9e5b8d99a301066f3c300a48ce836a313693531f Mon Sep 17 00:00:00 2001 From: Jesse Rosenstock Date: Wed, 8 Jul 2020 21:28:31 +0200 Subject: [PATCH] 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. --- src/cc65/declare.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cc65/declare.c b/src/cc65/declare.c index 5e2e204cf..140558ad3 100644 --- a/src/cc65/declare.c +++ b/src/cc65/declare.c @@ -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 */