Fix crash in "no non-local label before `%s'" warning (misuse of s.tok).

Add testcase for this warning while we're at it.

svn path=/trunk/yasm/; revision=952
0.2
Peter Johnson 22 years ago
parent e78c4d10b9
commit e60fe7b21c
  1. 7
      modules/parsers/nasm/nasm-token.re
  2. 5
      modules/parsers/nasm/tests/Makefile.inc
  3. 5
      modules/parsers/nasm/tests/prevlocalwarn.asm
  4. 1
      modules/parsers/nasm/tests/prevlocalwarn.errwarn
  5. 2
      modules/parsers/nasm/tests/prevlocalwarn.hex

@ -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);

@ -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

@ -0,0 +1,5 @@
[bits 16]
[section .text]
.local:
xor ax, ax

@ -0,0 +1 @@
-:4: warning: no non-local label before `.local'
Loading…
Cancel
Save