diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2011-12-04 19:24:25 +0400 |
---|---|---|
committer | Cyrill Gorcunov <gorcunov@gmail.com> | 2011-12-04 19:24:25 +0400 |
commit | ead8772590be3cdf87f1aedcc16492006114095d (patch) | |
tree | 334c60869b59e67d93531e8231ce1f5e620ef1d8 | |
parent | d279fbbd80aab6f79584249629a4aea90b851458 (diff) | |
download | nasm-ead8772590be3cdf87f1aedcc16492006114095d.tar.gz |
Simplify is_suppressed_warning helper
The former is really hard to read.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r-- | nasm.c | 27 |
1 files changed, 18 insertions, 9 deletions
@@ -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; } /** |