summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2011-12-04 19:24:25 +0400
committerCyrill Gorcunov <gorcunov@gmail.com>2011-12-04 19:24:25 +0400
commitead8772590be3cdf87f1aedcc16492006114095d (patch)
tree334c60869b59e67d93531e8231ce1f5e620ef1d8
parentd279fbbd80aab6f79584249629a4aea90b851458 (diff)
downloadnasm-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.c27
1 files 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;
}
/**