From ead8772590be3cdf87f1aedcc16492006114095d Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Sun, 4 Dec 2011 19:24:25 +0400 Subject: [PATCH] Simplify is_suppressed_warning helper The former is really hard to read. Signed-off-by: Cyrill Gorcunov --- nasm.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/nasm.c b/nasm.c index 40ef4f91..d7442536 100644 --- a/nasm.c +++ b/nasm.c @@ -1908,15 +1908,24 @@ static void nasm_verror_vc(int severity, const char *fmt, va_list ap) */ static bool is_suppressed_warning(int severity) { - /* - * See if it's a suppressed warning. - */ - return (severity & ERR_MASK) == ERR_WARNING && - (((severity & ERR_WARN_MASK) != 0 && - !warning_on[(severity & ERR_WARN_MASK) >> ERR_WARN_SHR]) || - /* See if it's a pass-one only warning and we're not in pass one. */ - ((severity & ERR_PASS1) && pass0 != 1) || - ((severity & ERR_PASS2) && pass0 != 2)); + + /* Not a warning at all */ + if ((severity & ERR_MASK) != ERR_WARNING) + return false; + + /* Might be a warning but suppresed explicitly */ + if (severity & ERR_WARN_MASK) { + int index = (severity & ERR_WARN_MASK) >> ERR_WARN_SHR; + if (warning_on[index]) + return false; + } + + /* See if it's a pass-one only warning and we're not in pass one. */ + if (((severity & ERR_PASS1) && pass0 != 1) || + ((severity & ERR_PASS2) && pass0 != 2)) + return true; + + return true; } /** -- 2.11.4.GIT