aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/pp/02.expect5
-rw-r--r--tests/pp/13.expect3
-rw-r--r--tests/pp/15.c18
-rw-r--r--tests/pp/15.expect7
-rw-r--r--tests/pp/Makefile4
-rw-r--r--tests/tcctest.c4
6 files changed, 33 insertions, 8 deletions
diff --git a/tests/pp/02.expect b/tests/pp/02.expect
index f1fb927..8ae2eb9 100644
--- a/tests/pp/02.expect
+++ b/tests/pp/02.expect
@@ -1,6 +1,5 @@
f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1);
-f(2 * (2+(3,4)-0,1)) | f(2 * (~ 5)) & f(2 * (0,1))^m(0,1);
-
+f(2 * (2 +(3,4)-0,1)) | f(2 * (~ 5)) & f(2 * (0,1))^m(0,1);
char c[2][6] = { "hello", "" };
f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1);
-f(2 * (2+(3,4)-0,1)) | f(2 * (~ 5)) & f(2 * (0,1))^m(0,1);
+f(2 * (2 +(3,4)-0,1)) | f(2 * (~ 5)) & f(2 * (0,1))^m(0,1);
diff --git a/tests/pp/13.expect b/tests/pp/13.expect
index 3532dd7..6eb2bec 100644
--- a/tests/pp/13.expect
+++ b/tests/pp/13.expect
@@ -1,6 +1,3 @@
# `modelist' label. Each video mode record looks like:
-
-
-
.text
endtext:
diff --git a/tests/pp/15.c b/tests/pp/15.c
new file mode 100644
index 0000000..d989bee
--- /dev/null
+++ b/tests/pp/15.c
@@ -0,0 +1,18 @@
+// insert a space between two tokens if otherwise they
+// would form a single token when read back
+
+#define n(x) x
+
+return (n(long)n(double))d;
+return n(A)n(++)n(+)n(B);
+return n(A)n(+)n(++)n(B);
+return n(A)n(++)n(+)n(+)n(B);
+
+// not a hex float
+return n(0x1E)n(-1);
+
+// unlike gcc but correct
+XXX: return n(x)+n(x)-n(1)+n(1)-2;
+
+// unlile gcc, but cannot appear in valid C
+XXX: return n(x)n(x)n(1)n(2)n(x);
diff --git a/tests/pp/15.expect b/tests/pp/15.expect
new file mode 100644
index 0000000..f652240
--- /dev/null
+++ b/tests/pp/15.expect
@@ -0,0 +1,7 @@
+return (long double)d;
+return A+++B;
+return A+ ++B;
+return A+++ +B;
+return 0x1E -1;
+XXX: return x+x-1 +1 -2;
+XXX: return x x 1 2 x;
diff --git a/tests/pp/Makefile b/tests/pp/Makefile
index 3968481..5fe3f9a 100644
--- a/tests/pp/Makefile
+++ b/tests/pp/Makefile
@@ -40,8 +40,8 @@ DIFF_OPTS = -Nu -b -B -I "^\#"
clean:
rm -vf *.output
-# 02.test : DIFF_OPTS += -w
-# 15.test : DIFF_OPTS += -w
+02.test : DIFF_OPTS += -w
+15.test : DIFF_OPTS += -I"^XXX:"
# diff options:
# -b ighore space changes
diff --git a/tests/tcctest.c b/tests/tcctest.c
index e55dc05..abe15f8 100644
--- a/tests/tcctest.c
+++ b/tests/tcctest.c
@@ -2573,6 +2573,10 @@ void asm_test(void)
unsigned int val;
printf("inline asm:\n");
+
+ // parse 0x1E-1 as 3 tokens in asm mode
+ asm volatile ("mov $0x1E-1,%eax");
+
/* test the no operand case */
asm volatile ("xorl %eax, %eax");