]> granicus.if.org Git - yasm/commitdiff
Fix crash in "no non-local label before `%s'" warning (misuse of s.tok).
authorPeter Johnson <peter@tortall.net>
Wed, 21 May 2003 00:39:24 +0000 (00:39 -0000)
committerPeter Johnson <peter@tortall.net>
Wed, 21 May 2003 00:39:24 +0000 (00:39 -0000)
Add testcase for this warning while we're at it.

svn path=/trunk/yasm/; revision=952

modules/parsers/nasm/nasm-token.re
modules/parsers/nasm/tests/Makefile.inc
modules/parsers/nasm/tests/prevlocalwarn.asm [new file with mode: 0644]
modules/parsers/nasm/tests/prevlocalwarn.errwarn [new file with mode: 0644]
modules/parsers/nasm/tests/prevlocalwarn.hex [new file with mode: 0644]

index 81f1759a75f85db7a400bb65718aaab580fb3226..b8bfc2b823bc53cf20224d4c37e7f4f35de10c72 100644 (file)
@@ -27,7 +27,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <util.h>
-RCSID("$IdPath: yasm/modules/parsers/nasm/nasm-token.re,v 1.20 2003/03/31 05:36:30 peter Exp $");
+RCSID("$IdPath$");
 
 #define YASM_LIB_INTERNAL
 #include <libyasm.h>
@@ -356,9 +356,10 @@ scan:
                yylval.str_val = yasm__xstrndup(s.tok, TOKLEN);
                RETURN(ID);
            } else if (!nasm_parser_locallabel_base) {
-               yasm__warning(YASM_WARN_GENERAL, cur_lindex,
-                             N_("no non-local label before `%s'"), s.tok[0]);
                yylval.str_val = yasm__xstrndup(s.tok, TOKLEN);
+               yasm__warning(YASM_WARN_GENERAL, cur_lindex,
+                             N_("no non-local label before `%s'"),
+                             yylval.str_val);
            } else {
                len = TOKLEN + nasm_parser_locallabel_base_len;
                yylval.str_val = yasm_xmalloc(len + 1);
index b161c203ae527b534c45c740997da025c6e934f9..724aac6c819c4e1749f5717152cb5a8eda9b8357 100644 (file)
@@ -10,4 +10,7 @@ EXTRA_DIST += \
        modules/parsers/nasm/tests/equlocal.hex         \
        modules/parsers/nasm/tests/newsect.asm          \
        modules/parsers/nasm/tests/newsect.errwarn      \
-       modules/parsers/nasm/tests/newsect.hex
+       modules/parsers/nasm/tests/newsect.hex          \
+       modules/parsers/nasm/tests/prevlocalwarn.asm    \
+       modules/parsers/nasm/tests/prevlocalwarn.errwarn \
+       modules/parsers/nasm/tests/prevlocalwarn.hex
diff --git a/modules/parsers/nasm/tests/prevlocalwarn.asm b/modules/parsers/nasm/tests/prevlocalwarn.asm
new file mode 100644 (file)
index 0000000..2d068b3
--- /dev/null
@@ -0,0 +1,5 @@
+[bits 16]
+[section .text]
+
+.local:
+       xor ax, ax
diff --git a/modules/parsers/nasm/tests/prevlocalwarn.errwarn b/modules/parsers/nasm/tests/prevlocalwarn.errwarn
new file mode 100644 (file)
index 0000000..c523eae
--- /dev/null
@@ -0,0 +1 @@
+-:4: warning: no non-local label before `.local'
diff --git a/modules/parsers/nasm/tests/prevlocalwarn.hex b/modules/parsers/nasm/tests/prevlocalwarn.hex
new file mode 100644 (file)
index 0000000..53f450a
--- /dev/null
@@ -0,0 +1,2 @@
+31 
+c0