]> granicus.if.org Git - yasm/commitdiff
* nasm-preproc.c (nasm_preproc_input): Don't generate %line except at the
authorPeter Johnson <peter@tortall.net>
Sat, 22 Apr 2006 04:08:00 +0000 (04:08 -0000)
committerPeter Johnson <peter@tortall.net>
Sat, 22 Apr 2006 04:08:00 +0000 (04:08 -0000)
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

modules/preprocs/nasm/nasm-preproc.c
modules/preprocs/nasm/tests/Makefile.inc
modules/preprocs/nasm/tests/longline.asm [new file with mode: 0644]
modules/preprocs/nasm/tests/longline.errwarn [new file with mode: 0644]
modules/preprocs/nasm/tests/longline.hex [new file with mode: 0644]

index 67610c55b06b8f3edf77a0ae1bc3e84b1c468a40..5029a9fd34b002d0484ca56438c81fd485b4b902 100644 (file)
@@ -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;
index 964221f7b9ce99f5ab8b7631bfc7a06446a4a413..2dd9d02d3736a64f9d0aa18a6cb084daeaf48234 100644 (file)
@@ -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
diff --git a/modules/preprocs/nasm/tests/longline.asm b/modules/preprocs/nasm/tests/longline.asm
new file mode 100644 (file)
index 0000000..212a30b
--- /dev/null
@@ -0,0 +1,2 @@
+ db (((0x52<<3)^(((0x52>>5)&1)*0x11b)^(((0x52>>5)&2)*0x11b)^(((0x52>>5)&4)*0x11b)) ^ ((0x52<<2)^(((0x52>>6)&1)*0x11b)^(((0x52>>6)&2)*0x11b)) ^ ((0x52<<1)^(((0x52>>7)&1)*0x11b))), (((0x52<<3)^(((0x52>>5)&1)*0x11b)^(((0x52>>5)&2)*0x11b)^(((0x52>>5)&4)*0x11b)) ^ 0x52), (((0x52<<3)^(((0x52>>5)&1)*0x11b)^(((0x52>>5)&2)*0x11b)^(((0x52>>5)&4)*0x11b)) ^ ((0x52<<2)^(((0x52>>6)&1)*0x11b)^(((0x52>>6)&2)*0x11b)) ^ 0x52), (((0x52<<3)^(((0x52>>5)&1)*0x11b)^(((0x52>>5)&2)*0x11b)^(((0x52>>5)&4)*0x11b)) ^ ((0x52<<1)^(((0x52>>7)&1)*0x11b)) ^ 0x52), (((0x52<<3)^(((0x52>>5)&1)*0x11b)^(((0x52>>5)&2)*0x11b)^(((0x52>>5)&4)*0x11b)) ^ ((0x52<<2)^(((0x52>>6)&1)*0x11b)^(((0x52>>6)&2)*0x11b)) ^ ((0x52<<1)^(((0x52>>7)&1)*0x11b))), (((0x52<<3)^(((0x52>>5)&1)*0x11b)^(((0x52>>5)&2)*0x11b)^(((0x52>>5)&4)*0x11b)) ^ 0x52), (((0x52<<3)^(((0x52>>5)&1)*0x11b)^(((0x52>>5)&2)*0x11b)^(((0x52>>5)&4)*0x11b)) ^ ((0x52<<2)^(((0x52>>6)&1)*0x11b)^(((0x52>>6)&2)*0x11b)) ^ 0x52), (((0x52<<3)^(((0x52>>5)&1)*0x11b)^(((0x52>>5)&2)*0x11b)^(((0x52>>5)&4)*0x11b)) ^ ((0x52<<1)^(((0x52>>7)&1)*0x11b)) ^ 0x52),(((0x09<<3)^(((0x09>>5)&1)*0x11b)^(((0x09>>5)&2)*0x11b)^(((0x09>>5)&4)*0x11b)) ^ ((0x09<<2)^(((0x09>>6)&1)*0x11b)^(((0x09>>6)&2)*0x11b)) ^ ((0x09<<1)^(((0x09>>7)&1)*0x11b))), (((0x09<<3)^(((0x09>>5)&1)*0x11b)^(((0x09>>5)&2)*0x11b)^(((0x09>>5)&4)*0x11b)) ^ 0x09), (((0x09<<3)^(((0x09>>5)&1)*0x11b)^(((0x09>>5)&2)*0x11b)^(((0x09>>5)&4)*0x11b)) ^ ((0x09<<2)^(((0x09>>6)&1)*0x11b)^(((0x09>>6)&2)*0x11b)) ^ 0x09), (((0x09<<3)^(((0x09>>5)&1)*0x11b)^(((0x09>>5)&2)*0x11b)^(((0x09>>5)&4)*0x11b)) ^ ((0x09<<1)^(((0x09>>7)&1)*0x11b)) ^ 0x09), (((0x09<<3)^(((0x09>>5)&1)*0x11b)^(((0x09>>5)&2)*0x11b)^(((0x09>>5)&4)*0x11b)) ^ ((0x09<<2)^(((0x09>>6)&1)*0x11b)^(((0x09>>6)&2)*0x11b)) ^ ((0x09<<1)^(((0x09>>7)&1)*0x11b))), (((0x09<<3)^(((0x09>>5)&1)*0x11b)^(((0x09>>5)&2)*0x11b)^(((0x09>>5)&4)*0x11b)) ^ 0x09), (((0x09<<3)^(((0x09>>5)&1)*0x11b)^(((0x09>>5)&2)*0x11b)^(((0x09>>5)&4)*0x11b)) ^ ((0x09<<2)^(((0x09>>6)&1)*0x11b)^(((0x09>>6)&2)*0x11b)) ^ 0x09), (((0x09<<3)^(((0x09>>5)&1)*0x11b)^(((0x09>>5)&2)*0x11b)^(((0x09>>5)&4)*0x11b)) ^ ((0x09<<1)^(((0x09>>7)&1)*0x11b)) ^ 0x09),(((0x6a<<3)^(((0x6a>>5)&1)*0x11b)^(((0x6a>>5)&2)*0x11b)^(((0x6a>>5)&4)*0x11b)) ^ ((0x6a<<2)^(((0x6a>>6)&1)*0x11b)^(((0x6a>>6)&2)*0x11b)) ^ ((0x6a<<1)^(((0x6a>>7)&1)*0x11b))), (((0x6a<<3)^(((0x6a>>5)&1)*0x11b)^(((0x6a>>5)&2)*0x11b)^(((0x6a>>5)&4)*0x11b)) ^ 0x6a), (((0x6a<<3)^(((0x6a>>5)&1)*0x11b)^(((0x6a>>5)&2)*0x11b)^(((0x6a>>5)&4)*0x11b)) ^ ((0x6a<<2)^(((0x6a>>6)&1)*0x11b)^(((0x6a>>6)&2)*0x11b)) ^ 0x6a), (((0x6a<<3)^(((0x6a>>5)&1)*0x11b)^(((0x6a>>5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5>>7)&1)*0x11b)) ^ 0xd5), (((0xd5<<3)^(((0xd5>>5)&1)*0x11b)^(((0xd5>>5)&2)*0x11b)^(((0xd5>>5)&4)*0x11b)) ^ ((0xd5<<2)^(((0xd5>>6)&1)*0x11b)^(((0xd5>>6)&2)*0x11b)) ^ ((0xd5<<1)^(((0xd5>>7)&1)*0x11b))), (((0xd5<<3)^(((0xd5>>5)&1)*0x11b)^(((0xd5>>5)&2)*0x11b)^(((0xd5>>5)&4)*0x11b)) ^ 0xd5), (((0xd5<<3)^(((0xd5>>5)&1)*0x11b)^(((0xd5>>5)&2)*0x11b)^(((0xd5>>5)&4)*0x11b)) ^ ((0xd5<<2)^(((0xd5>>6)&1)*0x11b)^(((0xd5>>6)&2)*0x11b)) ^ 0xd5), (((0xd5<<3)^(((0xd5>>5)&1)*0x11b)^(((0xd5>>5)&2)*0x11b)^(((0xd5>>5)&4)*0x11b)) ^ ((0xd5<<1)^(((0xd5>>7)&1)*0x11b)) ^ 0xd5),(((0x30<<3)^(((0x30>>5)&1)*0x11b)^(((0x30>>5)&2)*0x11b)^(((0x30>>5)&4)*0x11b)) ^ ((0x30<<2)^(((0x30>>6)&1)*0x11b)^(((0x30>>6)&2)*0x11b)) ^ ((0x30<<1)^(((0x30>>7)&1)*0x11b))), (((0x30<<3)^(((0x30>>5)&1)*0x11b)^(((0x30>>5)&2)*0x11b)^(((0x30>>5)&4)*0x11b)) ^ 0x30), (((0x30<<3)^(((0x30>>5)&1)*0x11b)^(((0x30>>5)&2)*0x11b)^(((0x30>>5)&4)*0x11b)) ^ ((0x30<<2)^(((0x30>>6)&1)*0x11b)^(((0x30>>6)&2)*0x11b)) ^ 0x30), (((0x30<<3)^(((0x30>>5)&1)*0x11b)^(((0x30>>5)&2)*0x11b)^(((0x30>>5)&4)*0x11b)) ^ ((0x30<<1)^(((0x30>>7)&1)*0x11b)) ^ 0x30), (((0x30<<3)^(((0x30>>5)&1)*0x11b)^(((0x30>>5)&2)*0x11b)^(((0x30>>5)&4)*0x11b)) ^ ((0x30<<2)^(((0x30>>6)&1)*0x11b)^(((0x30>>6)&2)*0x11b)) ^ ((0x30<<1)^(((0x30>>7)&1)*0x11b))), (((0x30<<3)^(((0x30>>5)&1)*0x11b)^(((0x30>>5)&2)*0x11b)^(((0x30>>5)&4)*0x11b)) ^ 0x30), (((0x30<<3)^(((0x30>>5)&1)*0x11b)^(((0x30>>5)&2)*0x11b)^(((0x30>>5)&4)*0x11b)) ^ ((0x30<<2)^(((0x30>>6)&1)*0x11b)^(((0x30>>6)&2)*0x11b)) ^ 0x30), (((0x30<<3)^(((0x30>>5)&1)*0x11b)^(((0x30>>5)&2)*0x11b)^(((0x30>>5)&4)*0x11b)) ^ ((0x30<<1)^(((0x30>>7)&1)*0x11b)) ^ 0x30),(((0x36<<3)^(((0x36>>5)&1)*0x11b)^(((0x36>>5)&2)*0x11b)^(((0x36>>5)&4)*0x11b)) ^ ((0x36<<2)^(((0x36>>6)&1)*0x11b)^(((0x36>>6)&2)*0x11b)) ^ ((0x36<<1)^(((0x36>>7)&1)*0x11b))), (((0x36<<3)^(((0x36>>5)&1)*0x11b)^(((0x36>>5)&2)*0x11b)^(((0x36>>5)&4)*0x11b)) ^ 0x36), (((0x36<<3)^(((0x36>>5)&1)*0x11b)^(((0x36>>5)&2)*0x11b)^(((0x36>>5)&4)*0x11b)) ^ ((0x36<<2)^(((0x36>>6)&1)*0x11b)^(((0x36>>6)&2)*0x11b)) ^ 0x36), (((0x36<<3)^(((0x36>>5)&1)*0x11b)^(((0x36>>5)&2)*0x11b)^(((0x36>>5)&4)*0x11b)) ^ ((0x36<<1)^(((0x36>>7)&1)*0x11b)) ^ 0x36), (((0x36<<3)^(((0x36>>5)&1)*0x11b)^(((0x36>>5)&2)*0x11b)^(((0x36>>5)&4)*0x11b)) ^ ((0x36<<2)^(((0x36>>6)&1)*0x11b)^(((0x36>>6)&2)*0x11b)) ^ ((0x36<<1)^(((0x36>>7)&1)*0x11b))), (((0x36<<3)^(((0x36>>5)&1)*0x11b)^(((0x36>>5)&2)*0x11b)^(((0x36>>5)&4)*0x11b)) ^ 0x36), (((0x36<<3)^(((0x36>>5)&1)*0x11b)^(((0x36>>5)&2)*0x11b)^(((0x36>>5)&4)*0x11b)) ^ ((0x36<<2)^(((0x36>>6)&1)*0x11b)^(((0x36>>6)&2)*0x11b)) ^ 0x36), (((0x36<<3)^(((0x36>>5)&1)*0x11b)^(((0x36>>5)&2)*0x11b)^(((0x36>>5)&4)*0x11b)) ^ ((0x36<<1)^(((0x36>>7)&1)*0x11b)) ^ 0x36),(((0xa5<<3)^(((0xa5>>5)&1)*0x11b)^(((0xa5>>5)&2)*0x11b)^(((0xa5>>5)&4)*0x11b)) ^ ((0xa5<<2)^(((0xa5>>6)&1)*0x11b)^(((0xa5>>6)&2)*0x11b)) ^ ((0xa5<<1)^(((0xa5>>7)&1)*0x11b))), (((0xa5<<3)^(((0xa5>>5)&1)*0x11b)^(((0xa5>>5)&2)*0x11b)^(((0xa5>>5)&4)*0x11b)) ^ 0xa5), (((0xa5<<3)^(((0xa5>>5)&1)*0x11b)^(((0xa5>>5)&2)*0x11b)^(((0xa5>>5)&4)*0x11b)) ^ ((0xa5<<2)^(((0xa5>>6)&1)*0x11b)^(((0xa5>>6)&2)*0x11b)) ^ 0xa5), (((0xa5<<3)^(((0xa5>>5)&1)*0x11b)^(((0xa5>>5)&2)*0x11b)^(((0xa5>>5)&4)*0x11b)) ^ ((0xa5<<1)^(((0xa5>>7)&1)*0x11b)) ^ 0xa5), (((0xa5<<3)^(((0xa5>>5)&1)*0x11b)^(((0xa5>>5)&2)*0x11b)^(((0xa5>>5)&4)*0x11b)) ^ ((0xa5<<2)^(((0xa5>>6)&1)*0x11b)^(((0xa5>>6)&2)*0x11b)) ^ ((0xa5<<1)^(((0xa5>>7)&1)*0x11b))), (((0xa5<<3)^(((0xa5>>5)&1)*0x11b)^(((0xa5>>5)&2)*0x11b)^(((0xa5>>5)&4)*0x11b)) ^ 0xa5), (((0xa5<<3)^(((0xa5>>5)&1)*0x11b)^(((0xa5>>5)&2)*0x11b)^(((0xa5>>5)&4)*0x11b)) ^ ((0xa5<<2)^(((0xa5>>6)&1)*0x11b)^(((0xa5>>6)&2)*0x11b)) ^ 0xa5), (((0xa5<<3)^(((0xa5>>5)&1)*0x11b)^(((0xa5>>5)&2)*0x11b)^(((0xa5>>5)&4)*0x11b)) ^ ((0xa5<<1)^(((0xa5>>7)&1)*0x11b)) ^ 0xa5),(((0x38<<3)^(((0x38>>5)&1)*0x11b)^(((0x38>>5)&2)*0x11b)^(((0x38>>5)&4)*0x11b)) ^ ((0x38<<2)^(((0x38>>6)&1)*0x11b)^(((0x38>>6)&2)*0x11b)) ^ ((0x38<<1)^(((0x38>>7)&1)*0x11b))), (((0x38<<3)^(((0x38>>5)&1)*0x11b)^(((0x38>>5)&2)*0x11b)^(((0x38>>5)&4)*0x11b)) ^ 0x38), (((0x38<<3)^(((0x38>>5)&1)*0x11b)^(((0x38>>5)&2)*0x11b)^(((0x38>>5)&4)*0x11b)) ^ ((0x38<<2)^(((0x38>>6)&1)*0x11b)^(((0x38>>6)&2)*0x11b)) ^ 0x38), (((0x38<<3)^(((0x38>>5)&1)*0x11b)^(((0x38>>5)&2)*0x11b)^(((0x38>>5)&4)*0x11b)) ^ ((0x38<<1)^(((0x38>>7)&1)*0x11b)) ^ 0x38), (((0x38<<3)^(((0x38>>5)&1)*0x11b)^(((0x38>>5)&2)*0x11b)^(((0x38>>5)&4)*0x11b)) ^ ((0x38<<2)^(((0x38>>6)&1)*0x11b)^(((0x38>>6)&2)*0x11b)) ^ ((0x38<<1)^(((0x38>>7)&1)*0x11b))), (((0x38<<3)^(((0x38>>5)&1)*0x11b)^(((0x38>>5)&2)*0x11b)^(((0x38>>5)&4)*0x11b)) ^ 0x38), (((0x38<<3)^(((0x38>>5)&1)*0x11b)^(((0x38>>5)&2)*0x11b)^(((0x38>>5)&4)*0x11b)) ^ ((0x38<<2)^(((0x38>>6)&1)*0x11b)^(((0x38>>6)&2)*0x11b)) ^ 0x38), (((0x38<<3)^(((0x38>>5)&1)*0x11b)^(((0x38>>5)&2)*0x11b)^(((0x38>>5)&4)*0x11b)) ^ ((0x38<<1)^(((0x38>>7)&1)*0x11b)) ^ 0x38)
+
diff --git a/modules/preprocs/nasm/tests/longline.errwarn b/modules/preprocs/nasm/tests/longline.errwarn
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/modules/preprocs/nasm/tests/longline.hex b/modules/preprocs/nasm/tests/longline.hex
new file mode 100644 (file)
index 0000000..0a0968c
--- /dev/null
@@ -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