* nasm-preproc.c (nasm_preproc_input): Don't generate %line except at the

beginning of a line.  The old way could insert a %line in the middle of very
long lines (e.g. >8192 chars).
* longline.asm: Test with an ~8500 character line.

Reported by: Brian Gladman <brg@gladman.plus.com>

svn path=/trunk/yasm/; revision=1506
0.5.0
Peter Johnson 19 years ago
parent 369c628a28
commit 85380b9692
  1. 40
      modules/preprocs/nasm/nasm-preproc.c
  2. 3
      modules/preprocs/nasm/tests/Makefile.inc
  3. 2
      modules/preprocs/nasm/tests/longline.asm
  4. 0
      modules/preprocs/nasm/tests/longline.errwarn
  5. 64
      modules/preprocs/nasm/tests/longline.hex

@ -169,28 +169,28 @@ nasm_preproc_input(yasm_preproc *preproc, char *buf, size_t max_size)
preproc_nasm->linepos = preproc_nasm->line;
preproc_nasm->lineleft = strlen(preproc_nasm->line) + 1;
preproc_nasm->line[preproc_nasm->lineleft-1] = '\n';
}
altline = nasm_src_get(&linnum, &preproc_nasm->file_name);
if (altline) {
if (altline == 1 && preproc_nasm->lineinc == 1) {
*buf++ = '\n';
max_size--;
tot++;
} else {
preproc_nasm->lineinc =
(altline != -1 || preproc_nasm->lineinc != 1);
n = sprintf(buf, "%%line %ld+%d %s\n", linnum,
preproc_nasm->lineinc, preproc_nasm->file_name);
buf += n;
max_size -= n;
tot += n;
altline = nasm_src_get(&linnum, &preproc_nasm->file_name);
if (altline) {
if (altline == 1 && preproc_nasm->lineinc == 1) {
*buf++ = '\n';
max_size--;
tot++;
} else {
preproc_nasm->lineinc =
(altline != -1 || preproc_nasm->lineinc != 1);
n = sprintf(buf, "%%line %ld+%d %s\n", linnum,
preproc_nasm->lineinc, preproc_nasm->file_name);
buf += n;
max_size -= n;
tot += n;
}
preproc_nasm->prior_linnum = linnum;
}
if (preproc_nasm->file_name) {
yasm_xfree(preproc_nasm->file_name);
preproc_nasm->file_name = NULL;
}
preproc_nasm->prior_linnum = linnum;
}
if (preproc_nasm->file_name) {
yasm_xfree(preproc_nasm->file_name);
preproc_nasm->file_name = NULL;
}
n = preproc_nasm->lineleft<max_size?preproc_nasm->lineleft:max_size;

@ -5,6 +5,9 @@ TESTS += modules/preprocs/nasm/tests/nasmpp_test.sh
EXTRA_DIST += modules/preprocs/nasm/tests/nasmpp_test.sh
EXTRA_DIST += modules/preprocs/nasm/tests/ifcritical-err.asm
EXTRA_DIST += modules/preprocs/nasm/tests/ifcritical-err.errwarn
EXTRA_DIST += modules/preprocs/nasm/tests/longline.asm
EXTRA_DIST += modules/preprocs/nasm/tests/longline.errwarn
EXTRA_DIST += modules/preprocs/nasm/tests/longline.hex
EXTRA_DIST += modules/preprocs/nasm/tests/noinclude-err.asm
EXTRA_DIST += modules/preprocs/nasm/tests/noinclude-err.errwarn
EXTRA_DIST += modules/preprocs/nasm/tests/nasmpp-bigint.asm

File diff suppressed because one or more lines are too long

@ -0,0 +1,64 @@
51
f4
a7
50
51
f4
a7
50
7e
41
65
53
7e
41
65
53
1a
17
a4
c3
1a
17
a4
c3
3a
27
5e
96
3a
27
5e
96
3b
ab
6b
cb
3b
ab
6b
cb
1f
9d
45
f1
1f
9d
45
f1
ac
fa
58
ab
ac
fa
58
ab
4b
e3
03
93
4b
e3
03
93
Loading…
Cancel
Save