diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2007-10-07 18:12:44 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2007-10-07 18:12:44 +0000 |
commit | 4cb057bd29b66597f6c3cfe931db4d65ae94ed2a (patch) | |
tree | e4cdd86d7f0ef072ed6b0a2cf4a6a23f54bed7bb /regress/usr.bin/pcc/cpp | |
parent | c4bf53740e619039da8d2facd10b2473c2f9cae3 (diff) |
and reorg this tree as well
Diffstat (limited to 'regress/usr.bin/pcc/cpp')
-rw-r--r-- | regress/usr.bin/pcc/cpp/Makefile | 9 | ||||
-rw-r--r-- | regress/usr.bin/pcc/cpp/res1 | 7 | ||||
-rw-r--r-- | regress/usr.bin/pcc/cpp/res2 | 26 | ||||
-rw-r--r-- | regress/usr.bin/pcc/cpp/res3 | 16 | ||||
-rw-r--r-- | regress/usr.bin/pcc/cpp/res4 | 5 | ||||
-rw-r--r-- | regress/usr.bin/pcc/cpp/res5 | 4 | ||||
-rw-r--r-- | regress/usr.bin/pcc/cpp/res6 | 6 | ||||
-rw-r--r-- | regress/usr.bin/pcc/cpp/res7 | 5 | ||||
-rw-r--r-- | regress/usr.bin/pcc/cpp/res8 | 8 | ||||
-rw-r--r-- | regress/usr.bin/pcc/cpp/res9 | 5 | ||||
-rw-r--r-- | regress/usr.bin/pcc/cpp/skip001.c | 3 | ||||
-rw-r--r-- | regress/usr.bin/pcc/cpp/skip001.out | 16 | ||||
-rw-r--r-- | regress/usr.bin/pcc/cpp/subdir/include.h | 1 | ||||
-rw-r--r-- | regress/usr.bin/pcc/cpp/test1 | 6 | ||||
-rw-r--r-- | regress/usr.bin/pcc/cpp/test2 | 25 | ||||
-rw-r--r-- | regress/usr.bin/pcc/cpp/test3 | 15 | ||||
-rw-r--r-- | regress/usr.bin/pcc/cpp/test4 | 4 | ||||
-rw-r--r-- | regress/usr.bin/pcc/cpp/test5 | 3 | ||||
-rw-r--r-- | regress/usr.bin/pcc/cpp/test6 | 5 | ||||
-rw-r--r-- | regress/usr.bin/pcc/cpp/test7 | 4 | ||||
-rw-r--r-- | regress/usr.bin/pcc/cpp/test8 | 7 | ||||
-rw-r--r-- | regress/usr.bin/pcc/cpp/test9 | 4 |
22 files changed, 184 insertions, 0 deletions
diff --git a/regress/usr.bin/pcc/cpp/Makefile b/regress/usr.bin/pcc/cpp/Makefile new file mode 100644 index 00000000000..36d74871b02 --- /dev/null +++ b/regress/usr.bin/pcc/cpp/Makefile @@ -0,0 +1,9 @@ +# $OpenBSD: Makefile,v 1.1 2007/10/07 18:12:43 otto Exp $ + +CC=/usr/local/bin/cc + +regress: + @echo skip001.c + ${CC} -E -I ${.CURDIR}/subdir ${.CURDIR}/skip001.c | cmp - ${.CURDIR}/skip001.out + +.include <bsd.regress.mk> diff --git a/regress/usr.bin/pcc/cpp/res1 b/regress/usr.bin/pcc/cpp/res1 new file mode 100644 index 00000000000..c0bb48019f3 --- /dev/null +++ b/regress/usr.bin/pcc/cpp/res1 @@ -0,0 +1,7 @@ +# 1 "<stdin>" + + + + +char p[] = "x ## y"; + diff --git a/regress/usr.bin/pcc/cpp/res2 b/regress/usr.bin/pcc/cpp/res2 new file mode 100644 index 00000000000..1eb808aac47 --- /dev/null +++ b/regress/usr.bin/pcc/cpp/res2 @@ -0,0 +1,26 @@ +# 1 "<stdin>" + + + + + + + + + + + + + + +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); +int i[] = { 1, 23, 4, 5, }; +char c[2][6] = { "hello", "" }; + + + + + + diff --git a/regress/usr.bin/pcc/cpp/res3 b/regress/usr.bin/pcc/cpp/res3 new file mode 100644 index 00000000000..4219319ddff --- /dev/null +++ b/regress/usr.bin/pcc/cpp/res3 @@ -0,0 +1,16 @@ +# 1 "<stdin>" + + + + + + + + + +printf("x" "1" "= %d, x" "2" "= %s", x1, x2); +fputs( +"strncmp(\"abc\\0d\", \"abc\", '\\4') == 0" ": @\n", s); +\#include "vers2.h" +"hello"; +"hello" ", world" diff --git a/regress/usr.bin/pcc/cpp/res4 b/regress/usr.bin/pcc/cpp/res4 new file mode 100644 index 00000000000..d7046a01507 --- /dev/null +++ b/regress/usr.bin/pcc/cpp/res4 @@ -0,0 +1,5 @@ +# 1 "<stdin>" + + + +(1) diff --git a/regress/usr.bin/pcc/cpp/res5 b/regress/usr.bin/pcc/cpp/res5 new file mode 100644 index 00000000000..291405dcfee --- /dev/null +++ b/regress/usr.bin/pcc/cpp/res5 @@ -0,0 +1,4 @@ +# 1 "<stdin>" + +int j[] = { 123, 45, 67, 89, + 10, 11, 12, }; diff --git a/regress/usr.bin/pcc/cpp/res6 b/regress/usr.bin/pcc/cpp/res6 new file mode 100644 index 00000000000..0bb0f9a1dbf --- /dev/null +++ b/regress/usr.bin/pcc/cpp/res6 @@ -0,0 +1,6 @@ +# 1 "<stdin>" + + + + +foo diff --git a/regress/usr.bin/pcc/cpp/res7 b/regress/usr.bin/pcc/cpp/res7 new file mode 100644 index 00000000000..18c492bda72 --- /dev/null +++ b/regress/usr.bin/pcc/cpp/res7 @@ -0,0 +1,5 @@ +# 1 "<stdin>" + + + +a YES diff --git a/regress/usr.bin/pcc/cpp/res8 b/regress/usr.bin/pcc/cpp/res8 new file mode 100644 index 00000000000..e7de0945f47 --- /dev/null +++ b/regress/usr.bin/pcc/cpp/res8 @@ -0,0 +1,8 @@ +# 1 "<stdin>" + + + + + +(hej.s_s.s_pos) + diff --git a/regress/usr.bin/pcc/cpp/res9 b/regress/usr.bin/pcc/cpp/res9 new file mode 100644 index 00000000000..aea239fc9aa --- /dev/null +++ b/regress/usr.bin/pcc/cpp/res9 @@ -0,0 +1,5 @@ +# 1 "<stdin>" + + + +ao diff --git a/regress/usr.bin/pcc/cpp/skip001.c b/regress/usr.bin/pcc/cpp/skip001.c new file mode 100644 index 00000000000..2b6b4c440b5 --- /dev/null +++ b/regress/usr.bin/pcc/cpp/skip001.c @@ -0,0 +1,3 @@ +#include "include.h" /* line which is bound to trash +yytext */ + diff --git a/regress/usr.bin/pcc/cpp/skip001.out b/regress/usr.bin/pcc/cpp/skip001.out new file mode 100644 index 00000000000..0fd118a035d --- /dev/null +++ b/regress/usr.bin/pcc/cpp/skip001.out @@ -0,0 +1,16 @@ +# 1 "/usr/src/regress/usr.bin/pcc/cpp/skip001.c" + + + + + + + + +# 1 "/usr/src/regress/usr.bin/pcc/cpp/skip001.c" + + +# 1 "/usr/src/regress/usr.bin/pcc/cpp/subdir/include.h" +line from include.h +# 3 "/usr/src/regress/usr.bin/pcc/cpp/skip001.c" + diff --git a/regress/usr.bin/pcc/cpp/subdir/include.h b/regress/usr.bin/pcc/cpp/subdir/include.h new file mode 100644 index 00000000000..da14e47f9f1 --- /dev/null +++ b/regress/usr.bin/pcc/cpp/subdir/include.h @@ -0,0 +1 @@ +line from include.h diff --git a/regress/usr.bin/pcc/cpp/test1 b/regress/usr.bin/pcc/cpp/test1 new file mode 100644 index 00000000000..79a3c5dc5d4 --- /dev/null +++ b/regress/usr.bin/pcc/cpp/test1 @@ -0,0 +1,6 @@ +#define hash_hash # ## # +#define mkstr(a) # a +#define in_between(a) mkstr(a) +#define join(c, d) in_between(c hash_hash d) +char p[] = join(x, y); // equivalent to + // char p[] = "x ## y"; diff --git a/regress/usr.bin/pcc/cpp/test2 b/regress/usr.bin/pcc/cpp/test2 new file mode 100644 index 00000000000..283d4fbc1f0 --- /dev/null +++ b/regress/usr.bin/pcc/cpp/test2 @@ -0,0 +1,25 @@ +#define x 3 +#define f(a) f(x * (a)) +#undef x +#define x 2 +#define g f +#define z z[0] +#define h g(~ +#define m(a) a(w) +#define w 0,1 +#define t(a) a +#define p() int +#define q(x) x +#define r(x,y) x ## y +#define str(x) # x +f(y+1) + f(f(z)) % t(t(g)(0) + t)(1); +g(x+(3,4)-w) | h 5) & m +(f)^m(m); +p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,) }; +char c[2][6] = { str(hello), str() }; +/* + * 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); + * int i[] = { 1, 23, 4, 5, }; + * char c[2][6] = { "hello", "" }; + */ diff --git a/regress/usr.bin/pcc/cpp/test3 b/regress/usr.bin/pcc/cpp/test3 new file mode 100644 index 00000000000..a659245ecbc --- /dev/null +++ b/regress/usr.bin/pcc/cpp/test3 @@ -0,0 +1,15 @@ +#define str(s) # s +#define xstr(s) str(s) +#define debug(s, t) printf("x" # s "= %d, x" # t "= %s", \ + x ## s, x ## t) +#define INCFILE(n) vers ## n +#define glue(a, b) a ## b +#define xglue(a, b) glue(a, b) +#define HIGHLOW "hello" +#define LOW LOW ", world" +debug(1, 2); +fputs(str(strncmp("abc\0d", "abc", '\4') // this goes away + == 0) str(: @\n), s); +\#include xstr(INCFILE(2).h) +glue(HIGH, LOW); +xglue(HIGH, LOW) diff --git a/regress/usr.bin/pcc/cpp/test4 b/regress/usr.bin/pcc/cpp/test4 new file mode 100644 index 00000000000..0068f3751b8 --- /dev/null +++ b/regress/usr.bin/pcc/cpp/test4 @@ -0,0 +1,4 @@ +#define foobar 1 +#define C(x,y) x##y +#define D(x) (C(x,bar)) +D(foo) diff --git a/regress/usr.bin/pcc/cpp/test5 b/regress/usr.bin/pcc/cpp/test5 new file mode 100644 index 00000000000..3ca0bb6c9c0 --- /dev/null +++ b/regress/usr.bin/pcc/cpp/test5 @@ -0,0 +1,3 @@ +#define t(x,y,z) x ## y ## z +int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,), + t(10,,), t(,11,), t(,,12), t(,,) }; diff --git a/regress/usr.bin/pcc/cpp/test6 b/regress/usr.bin/pcc/cpp/test6 new file mode 100644 index 00000000000..28cfddece68 --- /dev/null +++ b/regress/usr.bin/pcc/cpp/test6 @@ -0,0 +1,5 @@ +#define X(a,b, \ + c,d) \ + foo + +X(1,2,3,4) diff --git a/regress/usr.bin/pcc/cpp/test7 b/regress/usr.bin/pcc/cpp/test7 new file mode 100644 index 00000000000..b22b22bbcc9 --- /dev/null +++ b/regress/usr.bin/pcc/cpp/test7 @@ -0,0 +1,4 @@ +#define a() YES +#define b() a +b() +b()() diff --git a/regress/usr.bin/pcc/cpp/test8 b/regress/usr.bin/pcc/cpp/test8 new file mode 100644 index 00000000000..c5d2f9a1449 --- /dev/null +++ b/regress/usr.bin/pcc/cpp/test8 @@ -0,0 +1,7 @@ +// test macro expansion in arguments +#define s_pos s_s.s_pos +#define foo(x) (x) + +//hej.s_pos +foo(hej.s_pos) + diff --git a/regress/usr.bin/pcc/cpp/test9 b/regress/usr.bin/pcc/cpp/test9 new file mode 100644 index 00000000000..4d4368d5663 --- /dev/null +++ b/regress/usr.bin/pcc/cpp/test9 @@ -0,0 +1,4 @@ +#define C(a,b,c) a##b##c +#define N(x,y) C(x,_,y) +#define A_O ao +N(A,O) |