[Nasm-commits] [nasm:nasm-2.15.xx] asm/error.c: handle warning "all" correctly

nasm-bot for H. Peter Anvin (Intel) hpa at zytor.com
Thu Jun 4 19:57:02 PDT 2020


Commit-ID:  12df4dd12f530f11e147a59be846c0453e79bb0c
Gitweb:     http://repo.or.cz/w/nasm.git?a=commitdiff;h=12df4dd12f530f11e147a59be846c0453e79bb0c
Author:     H. Peter Anvin (Intel) <hpa at zytor.com>
AuthorDate: Thu, 4 Jun 2020 15:46:31 -0700
Committer:  H. Peter Anvin (Intel) <hpa at zytor.com>
CommitDate: Thu, 4 Jun 2020 15:59:47 -0700

asm/error.c: handle warning "all" correctly

warning_alias[0] is "all". It is represented in the loop by
value == NULL; WARN_IDX_ALL does not have an entry in warning_state[]
and so trying to poke it is an error.

Signed-off-by: H. Peter Anvin (Intel) <hpa at zytor.com>


---
 asm/error.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/asm/error.c b/asm/error.c
index ffe7a2e5..1e241c7b 100644
--- a/asm/error.c
+++ b/asm/error.c
@@ -241,8 +241,12 @@ bool set_warning_status(const char *value)
 
         vlen = value ? strlen(value) : 0;
 
-	/* This is inefficient, but it shouldn't matter... */
-	for (wa = warning_alias; wa < &warning_alias[NUM_WARNING_ALIAS]; wa++) {
+	/*
+         * This is inefficient, but it shouldn't matter.
+         * Note: warning_alias[0] is "all".
+         */
+	for (wa = warning_alias+1;
+             wa < &warning_alias[NUM_WARNING_ALIAS]; wa++) {
             enum warn_index i = wa->warning;
 
             if (value) {


More information about the Nasm-commits mailing list