diff options
author | Ben Cheng <bccheng@google.com> | 2013-03-28 11:14:20 -0700 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2013-03-28 12:40:33 -0700 |
commit | af0c51ac87ab2a87caa03fa108f0d164987a2764 (patch) | |
tree | 4b8b470f7c5b69642fdab8d0aa1fbc148d02196b /gcc-4.8/gcc/testsuite/gcc.dg/cpp | |
parent | d87cae247d39ebf4f5a6bf25c932a14d2fdb9384 (diff) | |
download | toolchain_gcc-af0c51ac87ab2a87caa03fa108f0d164987a2764.tar.gz toolchain_gcc-af0c51ac87ab2a87caa03fa108f0d164987a2764.tar.bz2 toolchain_gcc-af0c51ac87ab2a87caa03fa108f0d164987a2764.zip |
[GCC 4.8] Initial check-in of GCC 4.8.0
Change-Id: I0719d8a6d0f69b367a6ab6f10eb75622dbf12771
Diffstat (limited to 'gcc-4.8/gcc/testsuite/gcc.dg/cpp')
506 files changed, 11284 insertions, 0 deletions
diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/#cmdlne-M-2.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/#cmdlne-M-2.h new file mode 100644 index 000000000..40a8c178f --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/#cmdlne-M-2.h @@ -0,0 +1 @@ +/* empty */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19921210-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19921210-1.c new file mode 100644 index 000000000..32d2a816e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19921210-1.c @@ -0,0 +1,13 @@ +/* Test for proper disabling of macros within their own expansions. */ +/* { dg-do compile } */ + +/* The following is a trick to evaluate a complex boolean expression + at compile time, inspired by autoconf 2.13's sizeof-detection. */ + +enum { a = 4, f = 3 }; + +#define a1(y) (y+2) +#define a2(y) a1(y)+1 +#define f a+f + +char array[(a2(f)) == 10 ? 1 : -1]; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19930510-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19930510-1.c new file mode 100644 index 000000000..62c120674 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19930510-1.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ + +extern void exit (int); + +#define ugly 3 +#ugly "foobar" 3 /* { dg-error "invalid" "invalid directive" } */ +int main() { exit (0); } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19940712-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19940712-1.c new file mode 100644 index 000000000..a79b2f548 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19940712-1.c @@ -0,0 +1,20 @@ +/* { dg-do preprocess } */ +/* PR 4713 */ + +/* dg.exp doesn't read the header files for magic comments. */ +/* { dg-error "unterminated comment" "" { target *-*-* } 4 } */ +/* { dg-error "unterminated comment" "header error" { target *-*-* } 8 } */ + +#include "19940712-1.h" +/* { dg-message "" "In file included from:" { target *-*-* } 0 } */ +#include "19940712-1a.h" +#include "19940712-1b.h" + +/* comment start in comment error +/* in a .c file */ + +int main () +{ + return 0; +} + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19940712-1.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19940712-1.h new file mode 100644 index 000000000..183821334 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19940712-1.h @@ -0,0 +1,10 @@ +/* comment start in comment error +/* in a .h file */ + +#if 0 +#endif /* comment start in comment error +/* after a cpp directive */ + +/* comment start in comment error + + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19940712-1a.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19940712-1a.h new file mode 100644 index 000000000..55ab6b844 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19940712-1a.h @@ -0,0 +1,4 @@ +/* spanning a .h file */ + +#if 0 +#endif /* comment start in comment error diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19940712-1b.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19940712-1b.h new file mode 100644 index 000000000..d75156c04 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19940712-1b.h @@ -0,0 +1,2 @@ +/* spanning a .h file */ + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19951025-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19951025-1.c new file mode 100644 index 000000000..b817b68c8 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19951025-1.c @@ -0,0 +1,4 @@ +/* { dg-do preprocess } */ +/* { dg-error "include expects" "include" { target *-*-* } 4 } */ +/* { dg-error "newline at end" "newline" { target *-*-* } 4 } */ +#include /\ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19951227-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19951227-1.c new file mode 100644 index 000000000..da2f6d851 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19951227-1.c @@ -0,0 +1,3 @@ +/* { dg-do preprocess } */ +#if 0xe-1 /* { dg-error "invalid suffix" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19960224-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19960224-1.c new file mode 100644 index 000000000..5efc62769 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19960224-1.c @@ -0,0 +1,8 @@ +/* { dg-do preprocess } */ + +#if 0 +#if 0 +#endif \ +\ + +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19990119-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19990119-1.c new file mode 100644 index 000000000..10a7baae3 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19990119-1.c @@ -0,0 +1,9 @@ +/* This checks for two things: + - an obscure corner case in the standard rules for __LINE__ + - regression of an associated bug in cpplib where the semicolon got lost */ +/* { dg-do compile } */ + +enum { i = __LINE__\ +}; + +char array[i == 6 ? 1 : -1]; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19990228-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19990228-1.c new file mode 100644 index 000000000..acae1169a --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19990228-1.c @@ -0,0 +1,21 @@ +/* Regression test for cpp. The following input may cause core dumps + or # line markers in the middle of the line. */ +/* { dg-do preprocess } */ + +#define foo(string, arg) bar(2, string, arg) + +foo ("\ +\ +\ +\ +\ +\ +\ +\ +\ +\ +\ +", +NULL); + +/* { dg-final { scan-file-not 19990228-1.i "\[^\\n\]#" } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19990407-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19990407-1.c new file mode 100644 index 000000000..d6da8d656 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19990407-1.c @@ -0,0 +1,19 @@ +/* Regression test for a cpplib macro-expansion bug where + `@' becomes `@@' when stringified. */ + +/* { dg-do run } */ + +#include <string.h> +#include <stdlib.h> + +#define STR(x) #x + +char *a = STR(@foo), *b = "@foo"; + +int +main(void) +{ + if (strcmp (a, b)) + abort (); + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19990409-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19990409-1.c new file mode 100644 index 000000000..d7f5e2852 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19990409-1.c @@ -0,0 +1,6 @@ +/* Test that __LINE__ works when embedded in a macro. */ +/* { dg-do compile } */ + +#define XLINE __LINE__ + +char array[XLINE == __LINE__ ? 1 : -1]; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19990413-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19990413-1.c new file mode 100644 index 000000000..17d8441e8 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/19990413-1.c @@ -0,0 +1,13 @@ +/* Verify that cpp doesn't screw up the line numbering when a macro argument + extends over multiple lines. */ +/* { dg-do compile } */ + +#define FOO(x) /* nothing */ + +void +func(void) +{ + FOO(i + = 4) + else; /* { dg-error "'else' without a previous 'if'" "error on this line" { target *-*-* } { 12 } } */ +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000127-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000127-1.c new file mode 100644 index 000000000..467ad2c3d --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000127-1.c @@ -0,0 +1,139 @@ +/* { dg-do compile } */ + +/* Test for core dump in the preprocessor. Originally exposed by + XEmacs, but this has been synthesized from scratch. */ + +#define foo(bar) bar + +int x = +foo( + /* + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + + */ + 2); diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000129-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000129-1.c new file mode 100644 index 000000000..878002bee --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000129-1.c @@ -0,0 +1,15 @@ +/* Regression test for trigraph warnings. Under certain conditions we + got the line numbers wrong. + Originally exposed by XEmacs and reported by Martin Buchholz + <martin@xemacs.org>; this test case is synthetic. */ + +/* { dg-do preprocess } */ +/* { dg-options -Wall } */ + +#define some_macro \ + blah \ + blah \ + blah \ + blah + +??> /* { dg-warning "trigraph ..." "trigraph encountered" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000207-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000207-1.c new file mode 100644 index 000000000..931cc0d47 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000207-1.c @@ -0,0 +1,16 @@ +/* { dg-do preprocess } */ + +/* Test for proper handling of unary minus in #if. */ + +#if !(-1) +#error Error /* { dg-bogus "Error" "case !(-1)" } */ +#endif + +#if !-1 +#error Error /* { dg-bogus "Error" "case !-1" } */ +#endif + +#if -1 +#else +#error Error /* { dg-bogus "Error" "case -1" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000207-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000207-2.c new file mode 100644 index 000000000..fbdf39e14 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000207-2.c @@ -0,0 +1,16 @@ +/* { dg-do preprocess } */ + +/* Test for proper handling of unary plus in #if. */ + +#if !(+1) +#error Error /* { dg-bogus "Error" "case !(+1)" } */ +#endif + +#if !+1 +#error Error /* { dg-bogus "Error" "case !+1" } */ +#endif + +#if +1 +#else +#error Error /* { dg-bogus "Error" "case +1" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000209-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000209-1.c new file mode 100644 index 000000000..fe7105857 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000209-1.c @@ -0,0 +1,34 @@ +/* { dg-do preprocess } */ + +/* Tests for line numbering around function-like macro calls. + Bug found by Mark Mitchell. */ + +#define f(x) x +#define g f + +f (3); +#error here /* { dg-error "here" "case 0" } */ + +f + (3); +#error here /* { dg-error "here" "case 1" } */ + +(f + )(3); +#error here /* { dg-error "here" "case 2" } */ + +g + (3); +#error here /* { dg-error "here" "case 3" } */ + +(g + )(3); +#error here /* { dg-error "here" "case 4" } */ + +f /* some + text */ (3); +#error here /* { dg-error "here" "case 5" } */ + +(g /* some + text */ )(3); +#error here /* { dg-error "here" "case 6" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000209-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000209-2.c new file mode 100644 index 000000000..6a9198f64 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000209-2.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ +/* Distilled from glibc sources. Tests preprocessor corner cases. + Since it uses rest args, we must turn off -pedantic-errors. */ + +#define NO_PAREN(rest...) rest +#define DEFINE_CATEGORY(category, items) \ +const int _nl_value_type_##category[] = { NO_PAREN items } + +DEFINE_CATEGORY +( + LC_COLLATE, + ( + 1, + 2, + 3, + )); + +DEFINE_CATEGORY(LC_CTYPE, (1, 2, 3)); diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000301-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000301-1.c new file mode 100644 index 000000000..85645b062 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000301-1.c @@ -0,0 +1,3 @@ +/* { dg-do preprocess } */ +/* Test for crash with indented empty definitions. */ + #define _LIBC_LIMITS_H_ /* nothing */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000419-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000419-1.c new file mode 100644 index 000000000..c4400ee6c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000419-1.c @@ -0,0 +1,15 @@ +/* Test for erroneous deletion of the entire macro expansion when pruning + \r escapes. Problem noted by DJ Delorie <dj@delorie.com>; test case + distilled from GNU libc header files. */ +/* { dg-do preprocess } */ + +#define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias)) +#define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname) +#define __ASMNAME2(prefix, cname) __STRING (prefix) cname +#define __STRING(x) #x + +__REDIRECT (a, b, c) +__ASMNAME2 (__USER_LABEL_PREFIX__, harumph) + +/* { dg-bogus "used without args" "no args, 1" { target *-*-* } 11 } */ +/* { dg-bogus "used without args" "no args, 1" { target *-*-* } 12 } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000519-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000519-1.c new file mode 100644 index 000000000..7cd7daa3a --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000519-1.c @@ -0,0 +1,11 @@ +/* Regression test for preprocessor crash. + Reported by Mathias Froehlich <frohlich@na.uni-tuebingen.de>. */ +/* { dg-do preprocess } */ +/* { dg-options "-ansi" } */ +#define foo + +#define __CAT__(a,b,c,d) a##b##c##d +#define CAT(a,b,c,d) __CAT__(a,b,c,d) + +#define bar CAT(,foo,bar,) +bar diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000529-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000529-1.c new file mode 100644 index 000000000..6343a81fe --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000529-1.c @@ -0,0 +1,14 @@ +/* Regression test for bug with macro expansion on #if lines - + exposed by glibc. */ +/* { dg-do compile } */ + +# define SHLIB_COMPAT(lib, introduced, obsoleted) \ + (!(ABI_##lib##_##obsoleted - 0) \ + || ((ABI_##lib##_##introduced - 0) < (ABI_##lib##_##obsoleted - 0))) + +#if 0 +bad +#elif SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) +int +#endif +x; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000625-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000625-1.c new file mode 100644 index 000000000..01ce98bf6 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000625-1.c @@ -0,0 +1,17 @@ + +/* Regression test for paste corner cases. Distilled from + syscall stub logic in glibc. */ + +/* { dg-do compile } */ + +#define ENTRY(name) name##: +#define socket bind + +int +main(void) +{ + goto socket; + + ENTRY(socket) /* { dg-error "valid preprocessing token" "" } */ + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000627-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000627-1.c new file mode 100644 index 000000000..dc0173244 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000627-1.c @@ -0,0 +1,10 @@ +/* Test for spurious warnings with backslashes in perverse locations. + Bug exposed by Plumhall. */ +/* { dg-do compile } */ + +extern int bar; + +#def\ +ine foo bar + +int main(void) { return foo; } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000628-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000628-1.c new file mode 100644 index 000000000..41b84108c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000628-1.c @@ -0,0 +1,5 @@ +/* Test if #line commands are generated properly even when header + includes self. */ +/* { dg-do compile } */ +#include "20000628-1.h" +int main(void) { return a + b + c; } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000628-1.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000628-1.h new file mode 100644 index 000000000..2b2fb479e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000628-1.h @@ -0,0 +1,8 @@ +/* Test if #line commands are generated properly even when header + includes self. */ +#include "20000628-1a.h" +#ifndef t20000628_1_h +#define t20000628_1_h 1 +#include "20000628-1.h" +#include "20000628-1a.h" +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000628-1a.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000628-1a.h new file mode 100644 index 000000000..0fdc46d58 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000628-1a.h @@ -0,0 +1,15 @@ +/* Included from 20000628-1.h. This header is supposed to be seen + exactly three times. */ + +#if !defined A +#define A +int a; +#elif !defined B +#define B +int b; +#elif !defined C +#define C +int c; +#else +#error Included a fourth time +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000725-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000725-1.c new file mode 100644 index 000000000..6fa72e454 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20000725-1.c @@ -0,0 +1,3 @@ +/* { dg-do preprocess } */ + +#define foo(x, y, defined) bar(x, y, defined) diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20020927-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20020927-1.c new file mode 100644 index 000000000..91f89518a --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20020927-1.c @@ -0,0 +1,91 @@ +/* Test case for buffer overflow bug in token stringification. + See PR preprocessor/8055 for details. + Reported by Alexander N. Kabaev <ak03@gte.com>. + Test case written by Zack Weinberg <zack@codesourcery.com>. */ + +/* { dg-do preprocess } */ + +#define S(x) #x + +/* Fill up one internal buffer with data. */ +S(1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 1234567890123456789012345678901234567890123456789012345678901234567890 + 12345678901234567890123456789012345678901234567890123456789012345) + +/* When stringify_arg() was called with an empty macro argument, it would + advance the buffer pointer by one but fail to check for running past the + end of the buffer. We can only know where the end of the buffer is to + within about eight bytes, so do this sixteen times to be sure of hitting + it. */ + +S() +S() +S() +S() +S() +S() +S() +S() +S() +S() +S() +S() +S() +S() +S() +S() + +/* Now allocate more memory in the buffer, which should provoke a crash. */ + +S(abcdefghijklmnopqrstuvwxyz) +S(abcdefghijklmnopqrstuvwxyz) diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20050215-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20050215-1.c new file mode 100644 index 000000000..e5aaf220e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/20050215-1.c @@ -0,0 +1,10 @@ +/* Testcase for memory corruption bug in macro processing. + See PR preprocessor/19077 for details. */ + +/* { dg-do compile } */ +/* { dg-options "-g3" } */ +#define FOO(a,b,c,d,e) a b c d e \ +" " \ +" " \ +" " +int i; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/System/Library/Frameworks/Carbon.framework/Headers/Carbon.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/System/Library/Frameworks/Carbon.framework/Headers/Carbon.h new file mode 100644 index 000000000..4259c3718 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/System/Library/Frameworks/Carbon.framework/Headers/Carbon.h @@ -0,0 +1,4 @@ +/* Used by gcc.dg/cpp/isysroot-2.c to test isysroot. */ +void foo() +{ +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wmissingdirs.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wmissingdirs.c new file mode 100644 index 000000000..69b3aae3d --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wmissingdirs.c @@ -0,0 +1,7 @@ +/* { dg-do preprocess } */ +/* { dg-options "-std=gnu99 -I /jolly/well/better/not/exist -Wmissing-include-dirs" } */ + +/* Test that -Wmissing-include-dirs issues a warning when a specified + directory does not exist. Source Ben Elliston, 2004-05-13. */ + +/* { dg-warning "No such file or directory" "-Wmissing-include-dirs" { target *-*-* } 0 } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wsignprom.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wsignprom.c new file mode 100644 index 000000000..87d422b79 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wsignprom.c @@ -0,0 +1,26 @@ +/* { dg-do preprocess } */ +/* { dg-options "-Wall" } */ + +/* Test that -Wall emits the warnings about integer promotion changing + the sign of an operand. */ + +#if -1 > 0U /* { dg-warning "5:changes sign when promoted" } */ +#endif + +#if 0U + -1 /* { dg-warning "10:changes sign when promoted" } */ +#endif + +#if 0U * -1 /* { dg-warning "10:changes sign when promoted" } */ +#endif + +#if 1U / -2 /* { dg-warning "10:changes sign when promoted" } */ +#endif + +#if -1 % 1U /* { dg-warning "5:changes sign when promoted" } */ +#endif + +#if 1 ? 0U : -1 /* { dg-warning "14:changes sign when promoted" } */ +#endif + +#if 1 ? -1 : 0U /* { dg-warning "9:changes sign when promoted" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wtrigraphs-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wtrigraphs-2.c new file mode 100644 index 000000000..8d61f2841 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wtrigraphs-2.c @@ -0,0 +1,20 @@ +/* { dg-do preprocess } */ +/* { dg-options "-std=c99 -Wtrigraphs" } */ + +/* Test warnings for trigraphs in comments, with trigraphs enabled. + Neil Booth. 4 May 2003. */ + +/* { dg-bogus "converted" } Test ??< ??= a few ??/ random things in + { dg-warning "converted" } some ??/ + { dg-bogus "converted" } ??< comments. */ + +// { dg-bogus "converted" } More ??/ comment ??> tests. + +// { dg-warning "converted" } Another ??/ + Test + +// { dg-warning "converted" } And another with space after ??/ + the escape + +// { dg-bogus "converted" } A tricky one ??/\ + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wtrigraphs.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wtrigraphs.c new file mode 100644 index 000000000..d4be2040c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wtrigraphs.c @@ -0,0 +1,27 @@ +/* { dg-do preprocess } */ +/* { dg-options "-std=gnu99 -Wtrigraphs" } */ + +/* Test we don't double warn for trigraphs immediately after preceding + text. Source Neil Booth. 22 Nov 2000. */ + +abcdef??< /* { dg-warning "ignored" } */ +123456??> /* { dg-warning "ignored" } */ ++??= /* { dg-warning "ignored" } */ + +/* Test we warn of escaped newlines only in comments. Source Neil + Booth. 4 May 2003. */ + +/* { dg-bogus "ignored" } Test ??< ??= a few ??/ random things in + { dg-warning "ignored" } some ??/ + { dg-bogus "ignored" } ??< comments. */ + +// { dg-bogus "ignored" } More ??/ comment ??> tests. + +// { dg-warning "ignored" } Another ??/ + Test + +// { dg-warning "ignored" } And another with space after ??/ + the escape + +// { dg-bogus "ignored" } A tricky one ??/\ + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wunknown-pragmas-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wunknown-pragmas-1.c new file mode 100644 index 000000000..4f6a04be4 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wunknown-pragmas-1.c @@ -0,0 +1,29 @@ +/* Copyright 2003 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ +/* { dg-options "-Wunknown-pragmas" } */ + +/* Make sure we get warnings in the expected lines. */ + +#pragma unknown1 /* { dg-warning "unknown1" "unknown1" } */ + +#define COMMA , +#define FOO(x) x +#define BAR(x) _Pragma("unknown_before") x +#define BAZ(x) x _Pragma("unknown_after") + +int _Pragma("unknown2") bar1; /* { dg-warning "unknown2" "unknown2" } */ + +FOO(int _Pragma("unknown3") bar2); /* { dg-warning "unknown3" "unknown3" } */ + +int BAR(bar3); /* { dg-warning "unknown_before" "unknown_before 1" } */ + +BAR(int bar4); /* { dg-warning "unknown_before" "unknown_before 2" } */ + +int BAZ(bar5); /* { dg-warning "unknown_after" "unknown_after 1" } */ + +int BAZ(bar6;) /* { dg-warning "unknown_after" "unknown_after 2" } */ + +FOO(int bar7; _Pragma("unknown4")) /* { dg-warning "unknown4" "unknown4" } */ + +#pragma unknown5 /* { dg-warning "unknown5" "unknown5" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wunused.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wunused.c new file mode 100644 index 000000000..ac363ad04 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wunused.c @@ -0,0 +1,38 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* Duplicate command line options should not warn. */ +/* { dg-options "-Wunused-macros -Dfoo -Dfoo" } */ + +/* Test everything related to -Wunused-macros. + + Source: Neil Booth, 23 Jul 2002. */ + +#include "Wunused.h" + +#define used1 /* { dg-bogus "used" } */ +#define used2 /* { dg-bogus "used" } */ +#define used3 /* { dg-bogus "used" } */ +#define used4 used4 /* { dg-bogus "used" } */ + +#define unused5 /* { dg-warning "used" } */ +#define unused6 /* { dg-warning "used" } */ +#define unused7() /* { dg-warning "used" } */ + +#if defined used1 +#endif +#ifdef used2 +#endif +#ifndef used3 +#endif +used4 + +unused7 /* This does not count as a use. */ + +#if 0 +unused5 /* This does not count as a use. */ +#endif +#undef unused5 + +#define unused6 +unused6 diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wunused.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wunused.h new file mode 100644 index 000000000..8b54412bd --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wunused.h @@ -0,0 +1 @@ +#define unused_but_ok diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wvariadic-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wvariadic-1.c new file mode 100644 index 000000000..b034aacd2 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wvariadic-1.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic -Werror" } */ + +#define f(x,...) /* { dg-error "variadic" } */ +#define g(x,y...) /* { dg-error "variadic" } */ +int not_empty; +/* { dg-message "warnings being treated as errors" "" { target *-*-* } 0 } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wvariadic-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wvariadic-2.c new file mode 100644 index 000000000..f72e311f6 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wvariadic-2.c @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic -Werror -Wno-variadic-macros" } */ + +#define f(x,...) /* { dg-bogus "variadic" } */ +#define g(x,y...) /* { dg-bogus "variadic" } */ +int not_empty; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wvariadic-3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wvariadic-3.c new file mode 100644 index 000000000..0317c3c6d --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wvariadic-3.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic -Werror" } */ + +#define f(x,...) +#define g(x,y...) /* { dg-error "variadic" } */ +int not_empty; +/* { dg-message "warnings being treated as errors" "" { target *-*-* } 0 } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wvariadic-4.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wvariadic-4.c new file mode 100644 index 000000000..428365e0d --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/Wvariadic-4.c @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic -Werror -Wno-variadic-macros" } */ + +#define f(x,...) +#define g(x,y...) +int not_empty; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/_Pragma1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/_Pragma1.c new file mode 100644 index 000000000..0f211a985 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/_Pragma1.c @@ -0,0 +1,39 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Tests the _Pragma operator. Contributed by Neil Booth 1 Nov 2000. */ + +/* Within the preprocessor, the easy pragma to test is "poison". */ + +#pragma GCC poison p1 +p1 /* { dg-error "poisoned" } */ + +/* Standard use of _Pragma. */ +_Pragma ("GCC poison p2") +p2 /* { dg-error "poisoned" } */ + +/* Don't interpret _Pragmas in directives. The standard is not clear + on this, but I think this makes most sense. */ +#if 1 _Pragma (L"GCC poison p3") /* { dg-error "missing binary operator" } */ +p3 +#endif + +#define M1 _Pragma ("GCC poison p4") +p4 /* No problem; not yet poisoned. */ +#define M2(x) _Pragma (#x) + +/* Now test macro expansion with embedded _Pragmas. */ +M1 p4 /* { dg-error "poisoned" } */ +M2 (GCC poison p5) p5 /* { dg-error "poisoned" } */ + +/* Not interpreting _Pragma in directives means they don't nest. */ +_Pragma ("_Pragma (\"GCC poison p6\") GCC poison p7") +p6 +p7 + +/* Check we ignore them in false conditionals. */ +#if 0 +_Pragma ("GCC poison p8") +#endif +p8 /* No problem. */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/_Pragma2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/_Pragma2.c new file mode 100644 index 000000000..24c4457ed --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/_Pragma2.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Don't allow directives in a _Pragma string. */ + +/* Contributed by Neil Booth 14 Nov 2000. */ + +_Pragma("#define test") + +#ifdef test +#error Do not allow directives in _Pragma strings +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/_Pragma3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/_Pragma3.c new file mode 100644 index 000000000..7d1b42aab --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/_Pragma3.c @@ -0,0 +1,11 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Pragma buffers have a NULL "inc" member, which we would dereference + when getting a file's date and time. + + Based on PR 7526. 14 Aug 2002. */ + +#define GCC_PRAGMA(x) _Pragma (#x) +GCC_PRAGMA(GCC dependency "mi1c.h") diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/_Pragma4.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/_Pragma4.c new file mode 100644 index 000000000..f6f43d6b2 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/_Pragma4.c @@ -0,0 +1,8 @@ +/* { dg-do preprocess } */ + +/* Based on Debian GNATS PR 157416. 3 Sep 2002. */ + +#define b foo _Pragma ("bar") baz +a b c + +/* { dg-final { scan-file "_Pragma4.i" "(^|\\n)#pragma bar($|\\n)" } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/_Pragma5.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/_Pragma5.c new file mode 100644 index 000000000..141d56b9a --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/_Pragma5.c @@ -0,0 +1,10 @@ +/* { dg-do preprocess } */ + +/* Based on Debian GNATS PR 8524. 17 Nov 2002. */ + +#define ALPHA(A) alpha_ ## A +#define BETA(B) beta_ ## B +#define GAMMA(C) _Pragma("moose") ALPHA(C) BETA(C) +GAMMA(baz); + +/* { dg-final { scan-file "_Pragma5.i" "alpha_baz beta_baz;" } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/_Pragma6.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/_Pragma6.c new file mode 100644 index 000000000..7f3f7763e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/_Pragma6.c @@ -0,0 +1,10 @@ +/* PR c/27747 */ +/* This is supposed to succeed only if + the target doesn't define HANDLE_PRAGMA_PACK_WITH_EXPANSION. */ +/* { dg-do compile { target { ! { *-*-solaris2* } } } } */ + +#define push bar +#define foo _Pragma ("pack(push)") +foo +int i; +#pragma pack(pop) diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/_Pragma7.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/_Pragma7.c new file mode 100644 index 000000000..a7a5b1bcb --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/_Pragma7.c @@ -0,0 +1,14 @@ +/* + Origin: PR preprocessor/53469 + { dg-do compile } + */ + +#define STRINGIFY(x) #x +#define TEST(x) \ + _Pragma(STRINGIFY(GCC diagnostic ignored "-Wunused-local-typedefs")) \ + typedef int myint; + +void bar () +{ + TEST(myint) +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/arith-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/arith-1.c new file mode 100644 index 000000000..99e3cd7be --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/arith-1.c @@ -0,0 +1,257 @@ +/* Preprocessor arithmetic semantic tests. */ + +/* Copyright (C) 2002 Free Software Foundation, Inc. */ +/* Source: Neil Booth, 25 May 2002. */ + +/* The file tests all aspects of preprocessor arithmetic that are + independent of target precision. */ + +/* { dg-do preprocess } */ +/* { dg-options "" } */ + +/* Test || operator and its short circuiting. */ +#if 0 || 0 +# error /* { dg-bogus "error" } */ +#endif + +#if 5 || 0 +#else +# error /* { dg-bogus "error" } */ +#endif + +#if 0 || 1 +#else +# error /* { dg-bogus "error" } */ +#endif + +#if 1 || 4 +#else +# error /* { dg-bogus "error" } */ +#endif + +#if 1 || (8 / 0) /* { dg-bogus "division by zero" } */ +#else +# error /* { dg-bogus "error" } */ +#endif + +#if 1 || (1 << 256) /* { dg-bogus "overflow" } */ +#endif + +/* Test && operator and its short circuiting. */ +#if (0 && 0) || (0 && 1) || (1 && 0) +# error /* { dg-bogus "error" } */ +#endif + +#if 1 && 2 +#else +# error /* { dg-bogus "error" } */ +#endif + +#if 0 && (8 / 0)/* { dg-bogus "division by zero" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if 0 && (1 << 256) /* { dg-bogus "overflow" } */ +#endif + +/* Test == and != operators, and their signedness. */ +#if 1 == 0 || 0 == 1 || 20 != 0x014 || 142 != 0216 +# error /* { dg-bogus "error" } */ +#endif + +#if (1 == 1) - 2 > 0 || (1U != 1U) - 2 > 0 +# error /* { dg-bogus "error" } */ +#endif + +/* Test ? : operator, its short circuiting, and its signedness. */ +#if (1 ? 3: 5) != 3 || (0 ? 3: 5) != 5 +# error /* { dg-bogus "error" } */ +#endif + +#if 1 ? 0: 1 / 0 /* { dg-bogus "division by zero" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if 0 ? 1 / 0: 0 /* { dg-bogus "division by zero" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if 0 ? (1 << 256): 0 /* { dg-bogus "overflow" } */ +#endif + +#if 1 ? 0: (1 << 256) /* { dg-bogus "overflow" } */ +#endif + +/* Test unary + and its signedness. */ + +#if 23 != +23 || 23 != + +23 +# error /* { dg-bogus "error" } */ +#endif + +#if (+1 - 2) > 0 || (+1U - 2) < 0 +# error /* { dg-bogus "error" } */ +#endif + +/* Test unary - and its signedness. */ + +#if -1 + 1 != 0 +# error /* { dg-bogus "error" } */ +#endif + +#if -1 >= 0 || -1U <= 0 +# error /* { dg-bogus "error" } */ +#endif + +/* Test unary ! and its signedness. */ +#if !5 != 0 || !1 != 0 || !0 != 1 +# error /* { dg-bogus "error" } */ +#endif + +#if !5 - 1 > 0 || !5U - 1 > 0 +# error /* { dg-bogus "error" } */ +#endif + +/* Test unary ~ and its signedness. */ +#if ~0 != -1 || ~~5 != 5 || ~-2 != 1 +# error /* { dg-bogus "error" } */ +#endif + +#if ~5 > 0 || ~5U < 0 +# error /* { dg-bogus "error" } */ +#endif + +/* Test comparison operators and their signedness. */ +#if 1 >= 1 && 2 >= 1 && -1 >= -1 && -1 >= -2 && 1 >= -1 && 1 >= -2 \ + && !(-2 >= -1) && !(2 >= 3) && -1U >= 2 && !(-1 >= 1) +#else +# error /* { dg-bogus "error" } */ +#endif + +#if ((1 > 0) - 2) > 0 || ((1U > 0) - 2) > 0 +# error /* { dg-bogus "error" } */ +#endif + +#if !(1 > 1) && 2 > 1 && !(-1 > -1) && -1 > -2 && 1 > -1 && 1 > -2 \ + && !(-2 > -1) && !(2 > 3) && -1U > 2 && !(-1 > 1) +#else +# error /* { dg-bogus "error" } */ +#endif + +#if ((1 >= 0) - 2) > 0 || ((1U >= 0) - 2) > 0 +# error /* { dg-bogus "error" } */ +#endif + +#if 1 <= 1 && !(2 <= 1) && -1 <= -1 && !(-1 <= -2) && !(1 <= -1) && !(1 <= -2) \ + && -2 <= -1 && 2 <= 3 && !(-1U <= 2) && -1 <= 1 +#else +# error /* { dg-bogus "error" } */ +#endif + +#if ((1 <= 0) - 2) > 0 || ((1U <= 0) - 2) > 0 +# error /* { dg-bogus "error" } */ +#endif + +#if !(1 < 1) && !(2 < 1) && !(-1 < -1) && !(-1 < -2) && !(1 < -1) && !(1 < -2) \ + && -2 < -1 && 2 < 3 && !(-1U < 2) && -1 < 1 +#else +# error /* { dg-bogus "error" } */ +#endif + +#if ((1 < 0) - 2) > 0 || ((1U < 0) - 2) > 0 +# error /* { dg-bogus "error" } */ +#endif + +/* Test bitwise operators and their signedness. */ +#if (3 & 7) != 3 || (-1 & 34) != 34 +# error /* { dg-bogus "error" } */ +#endif + +#if (3 & 7) - 20 > 0 || (3 & 7U) - 20 < 0 +# error /* { dg-bogus "error" } */ +#endif + +#if (3 | 5) != 7 || (-1 | 34) != -1 +# error /* { dg-bogus "error" } */ +#endif + +#if (3 | 7) - 20 > 0 || (3 | 7U) - 20 < 0 +# error /* { dg-bogus "error" } */ +#endif + +#if (7 ^ 5) != 2 || (-1 ^ 34) != ~34 +# error /* { dg-bogus "error" } */ +#endif + +#if (3 ^ 7) - 20 > 0 || (3 ^ 7U) - 20 < 0 +# error /* { dg-bogus "error" } */ +#endif + +/* Test shifts and their signedness. */ +#if 3 << 2 != 12 || 3 << -2 != 0 || -1 << 1 != -2 +# error /* { dg-bogus "error" } */ +#endif + +#if 5 >> 1 != 2 || 5 >> -2 != 20 || -5 >> 1 != -3 +# error /* { dg-bogus "error" } */ +#endif + +#if (5 >> 2) - 2 >= 0 || (5U >> 2) - 2 <= 0 +# error /* { dg-bogus "error" } */ +#endif + +#if (5 << 1) - 20 >= 0 || (5U << 1) - 20 <= 0 +# error /* { dg-bogus "error" } */ +#endif + +#if 0 +/* Test min / max and their signedness. */ +#if (3 >? 2) != 3 || (-3 >? -2) != -2 +# error /* { dg-bogus "error" } */ +#endif + +#if (3 <? 2) != 2 || (-3 <? -2) != -3 +# error /* { dg-bogus "error" } */ +#endif + +#if (3 >? 2) - 4 >= 0 || (3 >? 2U) - 4 <= 0 +# error /* { dg-bogus "error" } */ +#endif + +#if (3 <? 2) - 4 >= 0 || (3 <? 2U) - 4 <= 0 +# error /* { dg-bogus "error" } */ +#endif +#endif + +/* Test *, / and % and their signedness. */ +#if 3 * 2 != 6 || 3 * -2 != -6 || -2 * 3 != -6 || -2 * -3 != 6 +# error /* { dg-bogus "error" } */ +#endif + +#if 3 * 2 - 7 >= 0 || 3 * 2U - 7 < 0 +# error /* { dg-bogus "error" } */ +#endif + +#if 5 / 2 != 2 || -325 / 50 != -6 || 53 / -4 != -13 || -55 / -12 != 4 +# error /* { dg-bogus "error" } */ +#endif + +#if 3 / 2 - 7 >= 0 || 3 / 2U - 7 < 0 +# error /* { dg-bogus "error" } */ +#endif + +#if 5 % 2 != 1 || -325 % 50 != -25 || 53 % -4 != 1 || -55 % -12 != -7 +# error /* { dg-bogus "error" } */ +#endif + +#if 3 % 2 - 7 >= 0 || 3U % 2 - 7 < 0 +# error /* { dg-bogus "error" } */ +#endif + +/* Test , and its signedness. */ +#if (1, 2) != 2 || (2, 1) != 1 +# error /* { dg-bogus "error" } */ +#endif + +#if (1, 2) - 3 >= 0 || (1, 2U) - 3 <= 0 || (1U, 2) - 3 >= 0 +# error /* { dg-bogus "error" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/arith-3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/arith-3.c new file mode 100644 index 000000000..2f94e9811 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/arith-3.c @@ -0,0 +1,447 @@ +/* Preprocessor arithmetic semantic tests. */ + +/* Copyright (C) 2002 Free Software Foundation, Inc. */ +/* Source: Neil Booth, 26 May 2002. */ + +/* The file tests overflow warnings for, and values of, preprocessor + arithmetic that are dependent on target precision. + + Please keep changes to arith-2.c and arith-3.c in sync. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=c99 -fshow-column" } */ + +#include <limits.h> + +#define APPEND2(NUM, SUFF) NUM ## SUFF +#define APPEND(NUM, SUFF) APPEND2(NUM, SUFF) + +#define TARGET_UTYPE_MAX ULLONG_MAX + +/* The tests in this file depend only on the macros defined in this + #if block. Note that it is no good calculating these values, as + the intent is to test both the preprocessor's number parser and + arithmetic. */ +#if TARGET_UTYPE_MAX == 65535ULL + +# define TARG_PRECISION 16 +# define MAX_INT 32767 +# define MAX_UINT 65535 + +# define TARG_MAX_HEX 0x7fff +# define TARG_MAX_OCT 077777 +# define TARG_MAX_PLUS_1 32768L +# define TARG_MAX_PLUS_1_U 32768UL +# define TARG_MAX_PLUS_1_HEX 0x8000 +# define TARG_MAX_PLUS_1_OCT 0100000 +# define UTARG_MAX_HEX 0xffff +# define UTARG_MAX_OCT 0177777 +# define UTARG_MAX_PLUS_1 65536L +# define UTARG_MAX_PLUS_1_HEX 0x10000 +# define UTARG_MAX_PLUS_1_OCT 0200000 + +# define TARG_LOWPART_PLUS_1 256L +# define TARG_LOWPART_PLUS_1_U 256UL + + /* Division and modulo; anything that uses the high half in both + dividend and divisor. */ +# define LONG_UDIVISION 61234UL / 260L +# define LONG_UDIVISION_ANSWER 235 +# define LONG_SDIVISION -15000L / 299L +# define LONG_SDIVISION_ANSWER -50 +# define LONG_UMODULO 61234UL % 260L +# define LONG_UMODULO_ANSWER 134 +# define LONG_SMODULO -15000L % 299L +# define LONG_SMODULO_ANSWER -50 + +#elif TARGET_UTYPE_MAX == 4294967295ULL + +# define TARG_PRECISION 32 +# define MAX_INT 2147483647 +# define MAX_UINT 4294967295 + +# define TARG_MAX_HEX 0x7fffffff +# define TARG_MAX_OCT 017777777777 +# define TARG_MAX_PLUS_1 2147483648L +# define TARG_MAX_PLUS_1_U 2147483648UL +# define TARG_MAX_PLUS_1_HEX 0x80000000 +# define TARG_MAX_PLUS_1_OCT 020000000000 +# define UTARG_MAX_HEX 0xffffffff +# define UTARG_MAX_OCT 037777777777 +# define UTARG_MAX_PLUS_1 4294967296L +# define UTARG_MAX_PLUS_1_HEX 0x100000000 +# define UTARG_MAX_PLUS_1_OCT 040000000000 + +# define TARG_LOWPART_PLUS_1 65536 +# define TARG_LOWPART_PLUS_1_U 65536UL + + /* Division and modulo; anything that uses the high half in both + dividend and divisor. */ +# define LONG_UDIVISION 268335456UL / 70000L +# define LONG_UDIVISION_ANSWER 3833 +# define LONG_SDIVISION -368335456L / 123456L +# define LONG_SDIVISION_ANSWER -2983 +# define LONG_UMODULO 268335456UL % 70000L +# define LONG_UMODULO_ANSWER 25456 +# define LONG_SMODULO -368335456L % 123456L +# define LONG_SMODULO_ANSWER -66208 + +#elif TARGET_UTYPE_MAX == 18446744073709551615ULL + +# define TARG_PRECISION 64 +# define MAX_INT 9223372036854775807 +# define MAX_UINT 18446744073709551615 + +# define TARG_MAX_HEX 0x7fffffffffffffff +# define TARG_MAX_OCT 0777777777777777777777 +# define TARG_MAX_PLUS_1 9223372036854775808L +# define TARG_MAX_PLUS_1_U 9223372036854775808UL +# define TARG_MAX_PLUS_1_HEX 0x8000000000000000 +# define TARG_MAX_PLUS_1_OCT 01000000000000000000000 +# define UTARG_MAX_HEX 0xffffffffffffffff +# define UTARG_MAX_OCT 01777777777777777777777 +# define UTARG_MAX_PLUS_1 18446744073709551616L +# define UTARG_MAX_PLUS_1_HEX 0x10000000000000000 +# define UTARG_MAX_PLUS_1_OCT 02000000000000000000000 + +# define TARG_LOWPART_PLUS_1 4294967296 +# define TARG_LOWPART_PLUS_1_U 4294967296U + + /* Division and modulo; anything that uses the high half in both + dividend and divisor. */ +# define LONG_UDIVISION 235184372088832UL / 17279869184L +# define LONG_UDIVISION_ANSWER 13610 +# define LONG_SDIVISION -234582345927345L / 12345678901L +# define LONG_SDIVISION_ANSWER -19001 +# define LONG_UMODULO 235184372088832UL % 17279869184L +# define LONG_UMODULO_ANSWER 5352494592L +# define LONG_SMODULO -234582345927345L % 12345678901L +# define LONG_SMODULO_ANSWER -2101129444L + +#else + +# error Please extend the macros here so that this file tests your target + +#endif + +/* Create more macros based on the above. */ +#define TARG_PART_BITS (TARG_PRECISION / 2) +#define TARG_MIN (-TARG_MAX - 1) +#define TARG_MAX APPEND (MAX_INT, L) +#define TARG_MAX_U APPEND (MAX_INT, UL) +#define UTARG_MAX APPEND (MAX_UINT, L) +#define UTARG_MAX_U APPEND (MAX_UINT, UL) + +/* And now the tests. */ + +#if TARG_MAX /* { dg-bogus "so large" } */ +#endif +#if TARG_MAX_PLUS_1_HEX /* { dg-bogus "so large" } */ +#endif +#if TARG_MAX_PLUS_1_OCT /* { dg-bogus "so large" } */ +#endif + +#if UTARG_MAX /* { dg-warning "so large" } */ +#endif +#if UTARG_MAX_PLUS_1 /* { dg-warning "too large" } */ +#endif +#if UTARG_MAX_PLUS_1_HEX /* { dg-warning "too large" } */ +#endif +#if UTARG_MAX_HEX /* { dg-bogus "too large" } */ +#endif +#if UTARG_MAX_PLUS_1_OCT /* { dg-warning "too large" } */ +#endif +#if UTARG_MAX_OCT /* { dg-bogus "too large" } */ +#endif + +#if TARG_MAX < 0 || TARG_MAX_PLUS_1 < 0 /* { dg-warning "so large" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if UTARG_MAX_HEX < 0 || TARG_MAX_HEX < 0 +# error /* { dg-bogus "error" } */ +#endif + +#if UTARG_MAX_OCT < 0 || TARG_MAX_OCT < 0 +# error /* { dg-bogus "error" } */ +#endif + +#if -1 != UTARG_MAX_U +# error /* { dg-bogus "error" } */ +#endif + + + + +/* Test each operator correctly warns of overflow conditions, and + gives the right answer. */ + +/* Binary +. */ +#if TARG_MAX + 1 != TARG_MIN /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if -TARG_MAX + -2 != TARG_MAX /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if -TARG_MAX + -1 != TARG_MIN /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_MAX_U + 1 != TARG_MIN /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if -TARG_MAX_U + -2 != TARG_MAX /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + + + + +/* Binary -. */ +#if TARG_MAX - -1 != TARG_MIN /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if -TARG_MAX - 2 != TARG_MAX /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if -TARG_MAX - 1 != TARG_MIN /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_MAX_U - -1 != TARG_MIN /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if -TARG_MAX_U - 2 != TARG_MAX /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + + + + + +/* Binary *. */ +#if TARG_LOWPART_PLUS_1 * (TARG_LOWPART_PLUS_1 >> 1) != TARG_MIN /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if (TARG_LOWPART_PLUS_1 >> 1) * TARG_LOWPART_PLUS_1 != TARG_MIN /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if (TARG_LOWPART_PLUS_1 << 1) * (TARG_LOWPART_PLUS_1 + 1) != (TARG_LOWPART_PLUS_1 << 1) /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_MAX * 1 != TARG_MAX /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if (TARG_MAX >> 1) * 2 != TARG_MAX - 1 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if (TARG_LOWPART_PLUS_1_U + 61) * (TARG_LOWPART_PLUS_1 << 1) != 61 * (TARG_LOWPART_PLUS_1 << 1) /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if (TARG_LOWPART_PLUS_1 >> 1) * TARG_LOWPART_PLUS_1_U != TARG_MIN /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if 1 * TARG_MIN != TARG_MIN /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + + + + +/* Binary /. */ +#if TARG_MIN / -1 != TARG_MIN /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_MIN / 1 != TARG_MIN /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if -TARG_MAX_PLUS_1_U / -1 != 0 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if -5 / (2 - 2) /* { dg-error "13:division by zero" } */ +#endif + +#if LONG_UDIVISION != LONG_UDIVISION_ANSWER +# error /* { dg-bogus "error" } */ +#endif + +#if LONG_SDIVISION != LONG_SDIVISION_ANSWER +# error /* { dg-bogus "error" } */ +#endif + +/* Binary %. Cannot overflow. */ +#if -5 % (2 - 2) /* { dg-error "13:division by zero" } */ +#endif + +#if TARG_MIN % 1 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if LONG_UMODULO != LONG_UMODULO_ANSWER +# error /* { dg-bogus "error" } */ +#endif + +#if LONG_SMODULO != LONG_SMODULO_ANSWER +# error /* { dg-bogus "error" } */ +#endif + +#if 234 % -1U != 234 +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_MIN % -1U != TARG_MIN +# error /* { dg-bogus "error" } */ +#endif + +/* Binary << and Binary >>, the latter cannot overflow. */ +#if -1 >> 3 != -1 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_MAX >> 3 != TARG_MAX / 8 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if 0 << 256 != 0 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if 1 << 256 != 0 /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if 1U << 256 != 0 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_MAX << 1 != -2 /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_MAX_U << 1 != -2 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_LOWPART_PLUS_1 << TARG_PART_BITS != 0 /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_LOWPART_PLUS_1 << (TARG_PART_BITS - 1) != TARG_MIN /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_LOWPART_PLUS_1_U << (TARG_PART_BITS - 1) != TARG_MIN /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_LOWPART_PLUS_1 << (TARG_PART_BITS - 2) != (TARG_MAX_PLUS_1_U >> 1) /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +/* Test how the sign bit is handled. */ +#if (TARG_MIN << 1) != 0 /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if (TARG_MAX_PLUS_1_U << 1) != 0 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if (TARG_MIN >> 1) != 3U << (TARG_PRECISION - 2) /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if (TARG_MAX_PLUS_1_U >> 1) != 1 << (TARG_PRECISION - 2) /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + + + +/* Unary -. It can overflow in just one case. */ +#if -TARG_MIN != TARG_MIN /* { dg-warning "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if - -TARG_MAX != TARG_MAX /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + + + + +/* Unary +, ~, and !. They cannot overflow. */ +#if +TARG_MAX != TARG_MAX /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if !TARG_MAX + !TARG_MIN != 0 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if ~TARG_MAX , ~TARG_MIN != TARG_MAX /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + + + + +/* Bitwise &, ^, |. They cannot overflow. */ +#if (TARG_MAX & -1), (TARG_MIN & -1) != TARG_MIN /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_MAX | -1, (TARG_MIN | -1) != -1 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if TARG_MAX ^ -1, (TARG_MIN ^ -1) != TARG_MAX /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + + + + +/* Comparison operators. They cannot overflow. */ +#if -1 <= TARG_MAX, (TARG_MIN <= 1) != 1 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if -1 >= TARG_MAX, (TARG_MIN >= 1) != 0 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if -1 < TARG_MAX, (TARG_MIN < 1) != 1 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if -1 > TARG_MAX, (TARG_MIN > 1) != 0 /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + + + + +/* Comma and ? : operators. They cannot overflow. */ +#if -1, TARG_MAX, TARG_MIN != TARG_MIN /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif + +#if -1 ? TARG_MAX: TARG_MAX, 0 ? 1: TARG_MIN != TARG_MIN /* { dg-bogus "overflow" } */ +# error /* { dg-bogus "error" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/assembl2.S b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/assembl2.S new file mode 100644 index 000000000..e9cd8b689 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/assembl2.S @@ -0,0 +1,19 @@ +/* Copyright (C) 2000-2013 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Source: Bug report of Jonathan Larmour. Tweaked for test suite by + Neil Booth, 17 Jan 2000. */ + +/* We would not test the buffer->was_skipping variable when skipping, + meaning that some false directives confused CPP. */ + +#if 0 + # foo + # fee + # fie + # foe + # fum +#elif 0 + # bundy +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/assembler.S b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/assembler.S new file mode 100644 index 000000000..7069b7b50 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/assembler.S @@ -0,0 +1,26 @@ +/* Regression test - in assembly language, # may have some significance + other than 'stringize macro argument' and therefore must be preserved + in the output, and should not be warned about. */ + +/* { dg-do preprocess } */ +/* { dg-options "" } */ + +#define foo() mov r0, #5 /* { dg-bogus "not followed" "spurious warning" } */ + +entry: + foo() + +/* Check we don't EOF on an unknown directive. */ +#unknown directive +#error a later diagnostic /* { dg-error "diagnostic" } */ + +/* + { dg-final { if ![file exists 20000510-1.i] { return } } } + { dg-final { set tmp [grep 20000510-1.i # line] } } + { dg-final { if {[string length $tmp] > 0} \{ } } + { dg-final { pass "20000510-1.S: # preservation" } } + { dg-final { \} else \{ } } + { dg-final { fail "20000510-1.S: # preservation" } } + { dg-final { \} } } +*/ + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/assert1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/assert1.c new file mode 100644 index 000000000..d1446105c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/assert1.c @@ -0,0 +1,46 @@ +/* Basic tests of the #assert preprocessor extension. */ +/* { dg-do compile } */ +/* { dg-options "-Wno-deprecated" } */ + +#define def unused expansion +#define fail int fail + +#assert abc (def) +#assert abc (ghi) +#assert abc (jkl) +#assert space ( s p a c e ) + +/* Basic: */ +#if !#abc (def) || !#abc (ghi) || !#abc (jkl) +fail +#endif + +/* any answer for #abc */ +#if !#abc +fail +#endif + +/* internal whitespace is collapsed, + external whitespace is deleted */ +#if !#space (s p a c e) || !#space ( s p a c e ) || #space (space) +fail +#endif + +/* removing assertions */ +#unassert abc (jkl) +#if !#abc || !#abc (def) || !#abc (ghi) || #abc (jkl) +fail +#endif + +#unassert abc +#if #abc || #abc (def) || #abc (ghi) || #abc (jkl) +fail +#endif + +int gobble + +/* make sure it can succeed too. + also check space before open paren isn't significant */ +#if #space(s p a c e) +; +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/assert2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/assert2.c new file mode 100644 index 000000000..12b11b78e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/assert2.c @@ -0,0 +1,24 @@ +/* Malformed assertion tests. */ +/* { dg-do preprocess } */ +/* { dg-options "-fshow-column -Wno-deprecated" } */ + +#assert /* { dg-error "without predicate" "assert w/o predicate" } */ +#assert % /* { dg-error "9:an identifier" "assert punctuation" } */ +#assert 12 /* { dg-error "9:an identifier" "assert number" } */ +#assert abc /* { dg-error "9:missing" "assert w/o answer" } */ + +#if # /* { dg-error "without predicate" "test w/o predicate" } */ +#endif + +#if #% /* { dg-error "6:an identifier" "test punctuation" } */ +#endif + +#if #12 /* { dg-error "6:an identifier" "test number" } */ +#endif + +#if #abc +#error /* { dg-bogus "error" "test w/o answer" } */ +#endif + +#if #abc[def] /* { dg-error "9:is not valid" "test with malformed answer" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/assert3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/assert3.c new file mode 100644 index 000000000..9010ecebd --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/assert3.c @@ -0,0 +1,10 @@ +/* Copyright (C) 2000, 2008 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-A abc=def -A abc\(ghi\) \"-Aabc = jkl\" -A abc=mno -A -abc=mno -Wno-deprecated" } */ + +/* Test -A command line syntax. Source Neil Booth. 31 Oct 2000. */ + +#if !#abc (def) || !#abc (ghi) || !#abc (jkl) || #abc(mno) +#error Command line -A assertions +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/assert4.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/assert4.c new file mode 100644 index 000000000..92e3dba5c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/assert4.c @@ -0,0 +1,384 @@ +/* Copyright (C) 2003, 2006, 2008, 2009, 2011, 2012 + Free Software Foundation, Inc. + + Test builtin preprocessor assertions. + By Kaveh Ghazi <ghazi@caip.rutgers.edu>. */ + +/* { dg-do preprocess } */ +/* { dg-options "-ansi -Wno-deprecated" } */ + +/* Check for #system assertions. */ + +#if defined __linux__ +# if !#system(linux) || !#system(unix) || !#system(posix) +# error +# endif +#elif #system(linux) +# error +#endif + +#if defined __gnu_hurd__ +# if !#system(gnu) || !#system(unix) || !#system(posix) || !#system(mach) +# error +# endif +#elif #system(gnu) +# error +#endif + +#if defined __FreeBSD__ +# if !#system(FreeBSD) || !#system(unix) || !#system(bsd) +# error +# endif +#elif #system(FreeBSD) +# error +#endif + +#if defined __NetBSD__ +# if !#system(NetBSD) || !#system(unix) || !#system(bsd) +# error +# endif +#elif #system(NetBSD) +# error +#endif + +#if defined __OpenBSD__ +# if !#system(OpenBSD) || !#system(unix) || !#system(bsd) +# error +# endif +#elif #system(OpenBSD) +# error +#endif + +#if defined __svr4__ || defined __SYSTYPE_SVR4__ +# if !#system(svr4) || !#system(unix) +# error +# endif +#elif #system(svr4) +# error +#endif + +#if defined __hpux__ +# if !#system(hpux) || !#system(unix) +# error +# endif +#elif #system(hpux) +# error +#endif + +#if defined _AIX +# if !#system(aix) || !#system(unix) +# error +# endif +#elif #system(aix) +# error +#endif + +#if defined __lynx__ +# if !#system(lynx) || !#system(unix) +# error +# endif +#elif #system(lynx) +# error +#endif + +#if ( defined __unix__ && !defined __CYGWIN__ ) || defined _AIX \ + || defined __vxworks +# if !#system(unix) +# error +# endif +#elif #system(unix) +# error +#endif + +#if defined __rtems__ +# if !#system(rtems) +# error +# endif +#elif #system(rtems) +# error +#endif + +#if defined __vms__ +# if !#system(vms) +# error +# endif +#elif #system(vms) +# error +#endif + +#if defined __mvs__ +# if !#system(mvs) +# error +# endif +#elif #system(mvs) +# error +#endif + +#if defined __MSDOS__ +# if !#system(msdos) +# error +# endif +#elif #system(msdos) +# error +#endif + +#if defined __WINNT__ || defined __CYGWIN__ +# if !#system(winnt) +# error +# endif +#elif #system(winnt) +# error +#endif + + +/* Check for #cpu and #machine assertions. */ + +#if defined __alpha__ +# if !#cpu(alpha) || !#machine(alpha) \ + || (defined __alpha_cix__ && !#cpu(cix)) \ + || (!defined __alpha_cix__ && #cpu(cix)) \ + || (defined __alpha_fix__ && !#cpu(fix)) \ + || (!defined __alpha_fix__ && #cpu(fix)) \ + || (defined __alpha_bwx__ && !#cpu(bwx)) \ + || (!defined __alpha_bwx__ && #cpu(bwx)) \ + || (defined __alpha_max__ && !#cpu(max)) \ + || (!defined __alpha_max__ && #cpu(max)) \ + || (defined __alpha_ev6__ && !#cpu(ev6)) \ + || (!defined __alpha_ev6__ && #cpu(ev6)) \ + || (defined __alpha_ev5__ && !#cpu(ev5)) \ + || (!defined __alpha_ev5__ && #cpu(ev5)) \ + || (defined __alpha_ev4__ && !#cpu(ev4)) \ + || (!defined __alpha_ev4__ && #cpu(ev4)) +# error +# endif +#elif #cpu(alpha) || #machine(alpha) || #cpu(cix) || #cpu(fix) || #cpu(bwx) \ + || #cpu(max) || #cpu(ev6) || #cpu(ev5) || #cpu(ev4) +# error +#endif + +#if defined __arm__ +# if !#cpu(arm) || !#machine(arm) +# error +# endif +#elif #cpu(arm) || #machine(arm) +# error +#endif + +#if defined __cris__ +# if !#cpu(cris) || !#machine(cris) +# error +# endif +#elif #cpu(cris) || #machine(cris) +# error +#endif + +#if defined __fr30__ +# if !#cpu(fr30) || !#machine(fr30) +# error +# endif +#elif #cpu(fr30) || #machine(fr30) +# error +#endif + +#if defined __frv__ +# if !#cpu(frv) || !#machine(frv) +# error +# endif +#elif #cpu(frv) || #machine(frv) +# error +#endif + +#if defined __H8300__ +# if !#cpu(h8300) || !#machine(h8300) \ + || (defined __H8300__ && (!#cpu(h8300) || !#machine(h8300))) \ + || (defined __H8300H__ && (!#cpu(h8300h) || !#machine(h8300h))) \ + || (!defined __H8300H__ && (#cpu(h8300h) || #machine(h8300h))) \ + || (defined __H8300S__ && (!#cpu(h8300s) || !#machine(h8300s))) \ + || (!defined __H8300S__ && (#cpu(h8300s) || #machine(h8300s))) +# error +# endif +#elif #cpu(h8300) || #machine(h8300) || #cpu(h8300h) || #machine(h8300h) || \ + #cpu(h8300s) || #machine(h8300s) +# error +#endif + +#if defined __hppa__ +# if !#cpu(hppa) || !#machine(hppa) +# error +# endif +#elif #cpu(hppa) || #machine(hppa) +# error +#endif + +#if defined __i370__ +# if !#cpu(i370) || !#machine(i370) +# error +# endif +#elif #cpu(i370) || #machine(i370) +# error +#endif + +#if defined __x86_64__ +# if !#cpu(x86_64) || !#machine(x86_64) +# error +# endif +#elif #cpu(x86_64) || #machine(x86_64) +# error +#endif + +#if defined __i386__ +# if !#cpu(i386) || !#machine(i386) +# error +# endif +#elif #cpu(i386) || #machine(i386) +# error +#endif + +#if defined __ia64__ +# if !#cpu(ia64) || !#machine(ia64) +# error +# endif +#elif #cpu(ia64) || #machine(ia64) +# error +#endif + +#if defined __iq2000__ +# if !#cpu(iq2000) || !#machine(iq2000) +# error +# endif +#elif #cpu(iq2000) || #machine(iq2000) +# error +#endif + +#if defined __M32R__ +# if !#cpu(m32r) || !#machine(m32r) +# error +# endif +#elif #cpu(m32r) || #machine(m32r) +# error +#endif + +#if defined __m68k__ +# if !#cpu(m68k) || !#machine(m68k) +# error +# endif +#elif #cpu(m68k) || #machine(m68k) +# error +#endif + +#if defined __mcore__ +# if !#cpu(mcore) || !#machine(mcore) +# error +# endif +#elif #cpu(mcore) || #machine(mcore) +# error +#endif + +#if defined __mips__ +# if !#cpu(mips) +# error +# endif +#elif #cpu(mips) || #machine(mips) +# error +#endif + +#if defined __mn10300__ +# if !#cpu(mn10300) || !#machine(mn10300) +# error +# endif +#elif #cpu(mn10300) || #machine(mn10300) +# error +#endif + +#if defined __pdp11__ +# if !#cpu(pdp11) || !#machine(pdp11) +# error +# endif +#elif #cpu(pdp11) || #machine(pdp11) +# error +#endif + +#if defined __powerpc__ || defined __PPC__ +# if defined __powerpc64__ +# if (#cpu(powerpc) || #machine(powerpc) \ + || !#cpu(powerpc64) || !#machine(powerpc64)) +# error +# endif +# else +# if (!#cpu(powerpc) || !#machine(powerpc) \ + || #cpu(powerpc64) || #machine(powerpc64)) +# error +# endif +# endif +#elif (#cpu(powerpc) || #machine(powerpc) \ + || #cpu(powerpc64) || #machine(powerpc64)) +# error +#endif + +#if defined __rs6000__ +# if !#cpu(rs6000) || !#machine(rs6000) +# error +# endif +#elif #cpu(rs6000) || #machine(rs6000) +# error +#endif + +#if defined __s390__ +# if !#cpu(s390) || !#machine(s390) +# error +# endif +#elif #cpu(s390) || #machine(s390) +# error +#endif + +#if defined __sh__ +# if !#cpu(sh) || !#machine(sh) +# error +# endif +#elif #cpu(sh) || #machine(sh) +# error +#endif + +#if defined __sparc__ +# if (defined __arch64__ \ + && (!#cpu(sparc64) || !#machine(sparc64) || #cpu(sparc) || #machine(sparc))) + || (!defined __arch64__ \ + && (#cpu(sparc64) || #machine(sparc64) || !#cpu(sparc) || !#machine(sparc))) +# error +# endif +#elif #cpu(sparc64) || #machine(sparc64) || #cpu(sparc) || #machine(sparc) +# error +#endif + +#if defined __xstormy16__ +# if !#cpu(xstormy16) || !#machine(xstormy16) +# error +# endif +#elif #cpu(xstormy16) || #machine(xstormy16) +# error +#endif + +#if defined __v850__ +# if !#cpu(v850) || !#machine(v850) +# error +# endif +#elif #cpu(v850) || #machine(v850) +# error +#endif + +#if defined __vax__ +# if !#cpu(vax) || !#machine(vax) +# error +# endif +#elif #cpu(vax) || #machine(vax) +# error +#endif + +#if defined __XTENSA__ +# if !#cpu(xtensa) || !#machine(xtensa) +# error +# endif +#elif #cpu(xtensa) || #machine(xtensa) +# error +#endif + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/avoidpaste1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/avoidpaste1.c new file mode 100644 index 000000000..3591f9c08 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/avoidpaste1.c @@ -0,0 +1,29 @@ +/* Copyright (C) 2001, 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-ansi" } */ + +/* This tests that we avoid accidental pasting only before and after + macros and arguments, and not when the tokens are already pasted + in the souce file (e.g. "::" in a C source file). + + Neil Booth, 28 Jan 2001. */ + +#define f(x) x +#define g +#define tricky 1.0e ## -1 + +/* This should preprocess as + +:: : : : : :^: 1.0e- 1 +: : : .. . 0 0 . + +It relies on the fact that even when preprocessing C we bother to separate +the colons of C++'s :: operator. If we confine this behavior to C++ +in future, this test needs to change. */ + +:: :g: :f(): :f(^): tricky +:f(:): .. .__INCLUDE_LEVEL__ __INCLUDE_LEVEL__. /* Check builtins, too. */ + +/* { dg-final { scan-file avoidpaste1.i ":: : : : : :\\^: 1.0e- 1" } } + { dg-final { scan-file avoidpaste1.i ": : : \\\.\\\. \\\. 0 0 \\\." } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/avoidpaste2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/avoidpaste2.c new file mode 100644 index 000000000..dc5bbc7f2 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/avoidpaste2.c @@ -0,0 +1,31 @@ +/* Copyright (C) 2001, 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-ansi" } */ + +/* This tests that we avoid accidental pasting, as well as gratuitous + space insertion, in various nasty places _inside_ a macro's + replacement list: on either side of a paste, and on either side of + an argument. It also tests that we don't pass empty macro leading + whitespace to the next line - this problem use to break Emacs + preprocessor abuse. + + Neil Booth, 1 Feb 2001. */ + +#define EMPTY_WITH_LEADING_SPACE +#define f(x, y) :x: -y##> -##y> +#define g(x, y) :x: :y##2 2##y: + +/* This should preprocess as + +: : : - > - > +:2: :22 22: + +We used to get a space at the start of the line. */ + + EMPTY_WITH_LEADING_SPACE +f(:,) +g(2, 2) + +/* { dg-final { scan-file avoidpaste2.i "(^|\\n): : : - > - >" } } + { dg-final { scan-file avoidpaste2.i "(^|\\n):2: :22 22:" } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/backslash.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/backslash.c new file mode 100644 index 000000000..f1b094a0b --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/backslash.c @@ -0,0 +1,21 @@ +/* Test backslash newline with and without trailing spaces. */ + +#define alpha(a, b, c) \ + a, \ + b, \ + c + +/* Note the trailing whitespace on the next three lines. */ +#define beta(a, b, c) \ + a, \ + b, \ + c + +/* { dg-warning "separated by space" "space" { target *-*-* } 9 } */ +/* { dg-warning "separated by space" "tab" { target *-*-* } 10 } */ +/* { dg-warning "separated by space" "space and tab" { target *-*-* } 11 } */ + +int x[] = { + alpha(1, 2, 3), + beta(4, 5, 6) +}; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/backslash2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/backslash2.c new file mode 100644 index 000000000..65142d930 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/backslash2.c @@ -0,0 +1,14 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Test warnings for backslash-space-newline. + Source: Neil Booth. 6 Dec 2000. */ + +foo \ +bar +/* { dg-warning "separated by space" "" { target *-*-* } 8 } */ + +/* foo \ + bar */ +/* { dg-bogus "separated by space" "" { target *-*-* } 12 } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c89-pedantic.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c89-pedantic.c new file mode 100644 index 000000000..3b7f6dd02 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c89-pedantic.c @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=c89 -pedantic" } */ + +/* This file is for testing the preprocessor in -std=c89 -pedantic mode. + Neil Booth, 2 Dec 2000. */ + +#if 1LL /* { dg-warning "long long" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c89.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c89.c new file mode 100644 index 000000000..8c5fd28a6 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c89.c @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=c89" } */ + +/* This file is for testing the preprocessor in -std=c89 mode. + Neil Booth, 2 Dec 2000. */ + +#if 1LL +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c90-empty-macro-args.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c90-empty-macro-args.c new file mode 100644 index 000000000..e90f8e6cb --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c90-empty-macro-args.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c89 -pedantic" } */ + +#define f(a,b) f2(a,,b) +#define f2(a,b,c) a; b; c; +#define f3(a) a + +#define g() p() + +void p(void) {} + + +void foo(void) +{ + f(p(),p()); /* { dg-warning "macro f2 argument 2: empty macro arguments are undefined" } */ + f2(p(),,p()); /* { dg-warning "macro f2 argument 2: empty macro arguments are undefined" } */ + f3(); /* { dg-warning "macro f3 argument 1: empty macro arguments are undefined" } */ + g(); +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c90-if-comma-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c90-if-comma-1.c new file mode 100644 index 000000000..c00403f16 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c90-if-comma-1.c @@ -0,0 +1,11 @@ +/* Test for commas in constant expressions in #if: not permitted in C90 + but permitted in unevaluated subexpressions in C99. */ +/* Origin: Joseph Myers <jsm@polyomino.org.uk> */ +/* { dg-do preprocess } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +#if (1, 2) /* { dg-error "comma" "evaluated comma" } */ +#endif + +#if 1 || (1, 2) /* { dg-error "comma" "unevaluated comma" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c90-pedantic.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c90-pedantic.c new file mode 100644 index 000000000..3d6c82fc8 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c90-pedantic.c @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=c90 -pedantic" } */ + +/* This file is for testing the preprocessor in -std=c90 -pedantic mode. + Neil Booth, 2 Dec 2000. */ + +#if 1LL /* { dg-warning "long long" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c90.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c90.c new file mode 100644 index 000000000..d8656c364 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c90.c @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=c90" } */ + +/* This file is for testing the preprocessor in -std=c90 mode. + Neil Booth, 2 Dec 2000. */ + +#if 1LL +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c94-pedantic.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c94-pedantic.c new file mode 100644 index 000000000..1c1216449 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c94-pedantic.c @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=iso9899:199409 -pedantic" } */ + +/* This file is for testing the preprocessor in -std=iso9899:199409 + -pedantic mode. Neil Booth, 2 Dec 2000. */ + +#if 1LL /* { dg-warning "long long" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c94.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c94.c new file mode 100644 index 000000000..d7a5e75da --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c94.c @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=iso9899:199409" } */ + +/* This file is for testing the preprocessor in -std=iso9899:199409 mode. + Neil Booth, 2 Dec 2000. */ + +#if 1LL +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c99-empty-macro-args.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c99-empty-macro-args.c new file mode 100644 index 000000000..e1e0c61ec --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c99-empty-macro-args.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c99 -pedantic" } */ + +#define f(a,b) f2(a,,b) +#define f2(a,b,c) a; b; c; +#define f3(a) a + +#define g() p() + +void p(void) {} + + +void foo(void) +{ + f(p(),p()); + f2(p(),,p()); + f3(); + g(); +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c99-hexfloat-3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c99-hexfloat-3.c new file mode 100644 index 000000000..44c49c995 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c99-hexfloat-3.c @@ -0,0 +1,6 @@ +/* Test for hex floating point constants: in C99 only. Compiler test. */ +/* Origin: Michael Matz <matz@suse.de> */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +double d = 0x.2p2; /* { dg-bogus "radix 16" "bogus C99 hex float error" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c99-if-comma-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c99-if-comma-1.c new file mode 100644 index 000000000..cb8eb6f73 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c99-if-comma-1.c @@ -0,0 +1,11 @@ +/* Test for commas in constant expressions in #if: not permitted in C90 + but permitted in unevaluated subexpressions in C99. */ +/* Origin: Joseph Myers <jsm@polyomino.org.uk> */ +/* { dg-do preprocess } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +#if (1, 2) /* { dg-error "comma" "evaluated comma" } */ +#endif + +#if 1 || (1, 2) +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c99-pedantic.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c99-pedantic.c new file mode 100644 index 000000000..0128a323c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c99-pedantic.c @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=c99 -pedantic" } */ + +/* This file is for testing the preprocessor in -std=c99 -pedantic mode. + Neil Booth, 2 Dec 2000. */ + +#if 1LL +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c99.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c99.c new file mode 100644 index 000000000..b74ff6387 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/c99.c @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=c99" } */ + +/* This file is for testing the preprocessor in -std=c99 mode. + Neil Booth, 2 Dec 2000. */ + +#if 1LL +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/charconst-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/charconst-2.c new file mode 100644 index 000000000..59fa500e3 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/charconst-2.c @@ -0,0 +1,19 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ +/* { dg-options "-fsigned-char" } */ + +/* Crosscompiling from i686-linux (32-bit) to x86_64-linux (64-bit) + gave extra warnings on the two assignments: + warning: large integer implicitly truncated to unsigned type + warning: overflow in implicit constant conversion + This test has been added as a regression test after fixing the bug + by Andreas Jaeger, 23 Nov 2001. */ +int +main (void) +{ + signed char c = '\xff'; + unsigned char d = '\xff'; + + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/charconst-3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/charconst-3.c new file mode 100644 index 000000000..7c1966391 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/charconst-3.c @@ -0,0 +1,50 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do run } */ +/* { dg-options -Wno-multichar } */ + +/* This tests values and signedness of multichar charconsts. + + Neil Booth, 5 May 2002. */ + +#include <limits.h> + +extern void abort (void); + +int main () +{ + /* These tests require at least 2-byte ints. 8-) */ +#if INT_MAX > 127 + int scale = (int) (unsigned char) -1 + 1; + + if ('ab' != (int) ((unsigned char) 'a' * scale + (unsigned char) 'b')) + abort (); + + if ('\234b' != (int) ((unsigned char) '\234' * scale + (unsigned char) 'b')) + abort (); + + if ('b\234' != (int) ((unsigned char) 'b' * scale + (unsigned char) '\234')) + abort (); + /* Multichar charconsts have type int and should be signed. */ +#if INT_MAX == 32767 +# if '\234a' > 0 +# error Preprocessor charconsts 1 +# endif + if ('\234a' > 0) + abort (); +#elif INT_MAX == 2147483647 +# if '\234aaa' > 0 +# error Preprocessor charconsts 2 +# endif + if ('\234aaa' > 0) + abort (); +#elif INT_MAX == 9223372036854775807 +# if '\234aaaaaaa' > 0 +# error Preprocessor charconsts 3 +# endif + if ('\234aaaaaaa' > 0) + abort (); +#endif +#endif + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/charconst-4.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/charconst-4.c new file mode 100644 index 000000000..aae33d35e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/charconst-4.c @@ -0,0 +1,52 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do run } */ +/* { dg-options "-Wno-multichar -fsigned-char" } */ + +/* This tests how overly-long multichar charconsts are truncated, and + whether "short" multichar charconsts are incorrectly sign extended + (regardless of char signedness). Preprocessor is used so that we + have only one place where the too long warning is generated, so + that the test works for all targets. + + Neil Booth, 8 May 2002. */ + +#include <limits.h> + +extern void abort (void); + +#if INT_MAX == 32767 +# define LONG_CHARCONST '!\234a' +# define SHORT_CHARCONST '\234a' +# define POS_CHARCONST '\1' +#elif INT_MAX == 2147483647 +# define LONG_CHARCONST '!\234abc' +# define SHORT_CHARCONST '\234abc' +# define POS_CHARCONST '\234a' +#elif INT_MAX == 9223372036854775807 +# define LONG_CHARCONST '!\234abcdefg' +# define SHORT_CHARCONST '\234abcdefg' +# define POS_CHARCONST '\234a' +#else +/* Target int size not handled, do something that won't fail. */ +# define LONG_CHARCONST '\234a' +# define SHORT_CHARCONST '\234a' +# define POS_CHARCONST '\1' +#endif + +#if POS_CHARCONST < 0 +# error Charconst incorrectly sign-extended +#endif + +#if LONG_CHARCONST != SHORT_CHARCONST /* { dg-warning "too long" "" } */ +# error Overly long charconst truncates wrongly for preprocessor +#endif + +int main () +{ + if (POS_CHARCONST < 0) + abort (); + if (LONG_CHARCONST != SHORT_CHARCONST) /* { dg-warning "too long" "" } */ + abort (); + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/charconst.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/charconst.c new file mode 100644 index 000000000..8934d6a67 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/charconst.c @@ -0,0 +1,36 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ + +/* This tests various diagnostics about character constants, for both + the preprocessor and the compiler. + + Neil Booth, 22 May 2001. */ + +#if '' /* { dg-error "empty" "empty charconst" } */ +#endif +#if L'' /* { dg-error "empty" "empty wide charconst" } */ +#endif +#if 'very long' /* { dg-warning "too long" "long charconst" } */ +#endif +#if L'very long' /* { dg-warning "too long" "long wide charconst" } */ +#endif +/* Don't do this test for L'ab'; it depends upon sizeof (wchar_t). */ +#if 'ab' /* { dg-warning "multi-char" "multi-character" } */ +#endif + +void foo () +{ + int c; + __WCHAR_TYPE__ w; + + c = ''; /* { dg-error "empty" "empty charconst" } */ + w = L''; /* { dg-error "empty" "empty wide charconst" } */ + + c = 'very long'; /* { dg-warning "too long" "long charconst" } */ + w = L'very long'; /* { dg-warning "too long" "long wide charconst" } */ + + c = 'ab'; /* { dg-warning "multi-char" "multi-char" } */ + /* Wide charconsts cannot contain more than one wide character. */ + w = L'ab'; /* { dg-warning "too long" "multi-char wide" } */ +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-C.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-C.c new file mode 100644 index 000000000..2dafec253 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-C.c @@ -0,0 +1,37 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options -C } */ + +/* Test -C doesn't fail with #define. #define is the tricky case, + being the only directive that remembers its comments. + + -C treats comments as tokens in their own right, so e.g. comment at + the beginning of a directive turns it into a non-directive. */ + +#define simple no comments + +#define/**/obj_like/**/(some)/**/thing/**/ +#define fun_like(/**/x/**/,/**/y/**/)/**/ +/**/#define not_a_macro + +#if !defined simple || !defined obj_like || !defined fun_like +#error Missed some macros with -C +#endif + +#ifdef not_a_macro +#error not_a_macro is! +#endif + +/* Check obj_like doesn't expect arguments, and fun_like does. */ +obj_like +fun_like (foo, bar) + +/* Check OK to redefine fun_like without comments in the params. */ +#define fun_like(x, y)/**/ + +/* Check comments in macros in directives are OK. */ +#define ZERO 0 /* A trailing comment. */ + +#if ZERO +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-C2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-C2.c new file mode 100644 index 000000000..be046704c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-C2.c @@ -0,0 +1,17 @@ +/* Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-C" } */ + +/* This tests that C++ comments are either dropped, or converted to C + comments in macro expansions. The + in the regexp stops it from + matching itself 8-) + + Neil Booth, 9 Oct 2001. */ + +#define ZERO 0 // A comment + +ZERO: + +/* { dg-final { scan-file-not cmdlne-C2.i "c+omment:" } } */ + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-C3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-C3.c new file mode 100644 index 000000000..86a942216 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-C3.c @@ -0,0 +1,13 @@ +/* { dg-do preprocess } */ +/* { dg-options "-C -P" } */ + +#define macro(X) X + +macro( +// Comment1 +x +// Comment2 +); + +/* { dg-final { scan-file cmdlne-C3.i "\\\*\\\/ x \\\/\\\*" } } */ + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-M-2#.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-M-2#.h new file mode 100644 index 000000000..40a8c178f --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-M-2#.h @@ -0,0 +1 @@ +/* empty */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-M-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-M-2.c new file mode 100644 index 000000000..6479822f9 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-M-2.c @@ -0,0 +1,14 @@ +/* Copyright (C) 2008 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-M" } */ + +/* Test that dependency output suppresses warnings by implying -w. */ + +#include "#cmdlne-M-2.h" +#include "cmdlne-M-2#.h" + +/* { dg-final { scan-file cmdlne-M-2.i "(^|\\n)cmdlne-M-2.o:" } } + { dg-final { scan-file cmdlne-M-2.i "cmdlne-M-2.c" } } + { dg-final { scan-file cmdlne-M-2.i "\\\\#cmdlne-M-2.h" } } + { dg-final { scan-file cmdlne-M-2.i "cmdlne-M-2\\\\#.h" } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-M.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-M.c new file mode 100644 index 000000000..4eb6407cd --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-M.c @@ -0,0 +1,8 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-M" } */ + +/* Test that dependency output suppresses warnings by implying -w. */ + +#warning bogus /* { dg-bogus "warning" "warning not suppressed" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-P.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-P.c new file mode 100644 index 000000000..faadf9fbf --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-P.c @@ -0,0 +1,11 @@ +/* Copyright (C) 2000, 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-P" } */ + +/* Test that we don't stair-step output with -P. Source: Neil Booth, + 18 Dec 2000. */ + +int x = 1; + +/* { dg-final { scan-file cmdlne-P.i "(^|\n)int x = 1;($|\n)" } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dD-M.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dD-M.c new file mode 100644 index 000000000..d1a3b8f09 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dD-M.c @@ -0,0 +1,15 @@ +/* Copyright (C) 2002, 2003, 2008 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-dD -M" } */ + +/* Test -dD -M does not fail. It should print just + the Makefile rule with dependencies. */ + +#define foo bar +#define funlike(like) fun like +int variable; + +/* { dg-final { scan-file-not cmdlne-dD-M.i "(^|\\n)#define foo bar($|\\n)" } } + { dg-final { scan-file-not cmdlne-dD-M.i "variable" } } + { dg-final { scan-file cmdlne-dD-M.i "(^|\n)cmdlne-dD-M\[^\\n\]*:( *\\\\\\n)?\[^\\n\]*cmdlne-dD-M.c" } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dD-dM.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dD-dM.c new file mode 100644 index 000000000..9e3c732d3 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dD-dM.c @@ -0,0 +1,14 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-dD -dM" } */ + +/* Test -dD -dM does not fail. It should give the same output + as plain -dM. */ + +#define foo bar +#define funlike(like) fun like +int variable; + +/* { dg-final { scan-file cmdlne-dD-dM.i "(^|\\n)#define foo bar($|\\n)" } } + { dg-final { scan-file-not cmdlne-dD-dM.i "variable" } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dD.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dD.c new file mode 100644 index 000000000..59d521195 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dD.c @@ -0,0 +1,12 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options -dD } */ + +/* Test -dD does not fail. */ + +#define objlike obj like +#define funlike(like) fun like +#define funlike2(fun, like) fun ## like +#define varargs(x, ...) x #x __VA_ARGS__ +#define gnu_varargs(x, y...) x ## y diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dI-C.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dI-C.c new file mode 100644 index 000000000..6b4bfee22 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dI-C.c @@ -0,0 +1,11 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. */ +/* PR 13726 */ + +/* { dg-do preprocess } */ +/* { dg-options "-dI -C" } */ + +#include "cmdlne-dI-C.h" /* #include comment */ +/* comment 2 */ + +/* { dg-final { scan-file cmdlne-dI-C.i "#include c+omment" } } */ +/* { dg-final { scan-file cmdlne-dI-C.i "header file c+omment" } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dI-C.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dI-C.h new file mode 100644 index 000000000..5021488e4 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dI-C.h @@ -0,0 +1 @@ +/* header file comment */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dI-M.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dI-M.c new file mode 100644 index 000000000..db08a72b4 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dI-M.c @@ -0,0 +1,16 @@ +/* Copyright (C) 2002, 2003, 2008 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-dI -M" } */ + +/* Test -dI -M does not fail. It should print just + the Makefile rule with dependencies. */ + +#define foo bar +#include "cmdlne-dI-M.h" +#define funlike(like) fun like +int variable; + +/* { dg-final { scan-file-not cmdlne-dI-M.i "(^|\\n)#define foo bar($|\\n)" } } + { dg-final { scan-file-not cmdlne-dI-M.i "variable" } } + { dg-final { scan-file cmdlne-dI-M.i "(^|\\n)cmdlne-dI-M\[^\\n\]*:( *\\\\\\n)?\[^\\n\]*cmdlne-dI-M.c" } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dI-M.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dI-M.h new file mode 100644 index 000000000..cbaf810a5 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dI-M.h @@ -0,0 +1,2 @@ +#define baz baz +int othervar; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dM-M.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dM-M.c new file mode 100644 index 000000000..0cd901104 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dM-M.c @@ -0,0 +1,15 @@ +/* Copyright (C) 2002, 2003, 2008 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-dM -M" } */ + +/* Test -dM -M does not fail. It should print both the + #define lines and a Makefile rule with dependencies. */ + +#define foo bar +#define funlike(like) fun like +int variable; + +/* { dg-final { scan-file cmdlne-dM-M.i "(^|\\n)#define foo bar($|\\n)" } } + { dg-final { scan-file-not cmdlne-dM-M.i "variable" } } + { dg-final { scan-file cmdlne-dM-M.i "(^|\\n)cmdlne-dM-M\[^\\n\]*:( *\\\\\\n)?\[^\\n\]*cmdlne-dM-M.c"} } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dM-dD.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dM-dD.c new file mode 100644 index 000000000..66ec7dd9b --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dM-dD.c @@ -0,0 +1,14 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-dM -dD" } */ + +/* Test -dM -dD does not fail. It should give the same output + as plain -dD. */ + +#define foo bar +#define funlike(like) fun like +int variable; + +/* { dg-final { scan-file cmdlne-dM-dD.i "(^|\\n)#define foo bar($|\\n)" } } + { dg-final { scan-file cmdlne-dM-dD.i "variable" } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dM.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dM.c new file mode 100644 index 000000000..98660f8f5 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dM.c @@ -0,0 +1,12 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options -dM } */ + +/* Test -dM does not fail. */ + +#define objlike obj like +#define funlike(like) fun like +#define funlike2(fun, like) fun ## like +#define varargs(x, ...) x #x #__VA_ARGS__ __VA_ARGS__ +#define gnu_varargs(x, y...) #y x ## y y diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dN-M.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dN-M.c new file mode 100644 index 000000000..2182e370c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dN-M.c @@ -0,0 +1,15 @@ +/* Copyright (C) 2002, 2003, 2008 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-dN -M" } */ + +/* Test -dN -M does not fail. It should print just + the Makefile rule with dependencies. */ + +#define foo bar +#define funlike(like) fun like +int variable; + +/* { dg-final { scan-file-not cmdlne-dN-M.i "(^|\\n)#define foo" } } + { dg-final { scan-file-not cmdlne-dN-M.i "variable" } } + { dg-final { scan-file cmdlne-dN-M.i "(^|\\n)cmdlne-dN-M\[^\\n\]*:( *\\\\\\n)?\[^\\n\]*cmdlne-dN-M.c" } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-1.c new file mode 100644 index 000000000..129e48bf8 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-1.c @@ -0,0 +1,5 @@ +/* { dg-do preprocess } */ +/* { dg-options "-nostdinc -P -dU" } */ +/* { dg-final { scan-file cmdlne-dU-1.i "^\n*#undef A\n*$" } } */ +#ifdef A +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-10.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-10.c new file mode 100644 index 000000000..31398a762 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-10.c @@ -0,0 +1,7 @@ +/* { dg-do preprocess } */ +/* { dg-options "-nostdinc -P -dU" } */ +/* { dg-final { scan-file cmdlne-dU-10.i "^\n*C\n+#define B C\n+#define A B\n*$" } } */ +/* This file deliberately has no final newline. */ +#define A B +#define B C +A diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-11.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-11.c new file mode 100644 index 000000000..1c0128bb4 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-11.c @@ -0,0 +1,7 @@ +/* { dg-do preprocess } */ +/* { dg-options "-nostdinc -P -dU" } */ +/* { dg-final { scan-file cmdlne-dU-11.i "^\n*\n*$" } } */ +#define A B +#if 0 +A +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-12.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-12.c new file mode 100644 index 000000000..54620a57e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-12.c @@ -0,0 +1,6 @@ +/* { dg-do preprocess } */ +/* { dg-options "-nostdinc -P -dU" } */ +/* { dg-final { scan-file cmdlne-dU-12.i "^\n*#define A 1\n*$" } } */ +#define A 1 +#if A +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-13.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-13.c new file mode 100644 index 000000000..45ce532b2 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-13.c @@ -0,0 +1,7 @@ +/* { dg-do preprocess } */ +/* { dg-options "-nostdinc -P -dU" } */ +/* { dg-final { scan-file cmdlne-dU-13.i "^\n*#undef A\n*$" } } */ +#ifdef A +#endif +#ifdef A +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-14.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-14.c new file mode 100644 index 000000000..4fe96a4d7 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-14.c @@ -0,0 +1,6 @@ +/* { dg-do preprocess } */ +/* { dg-options "-nostdinc -P -dU" } */ +/* { dg-final { scan-file cmdlne-dU-14.i "^\n*B\n+#define A B\n+B\n*$" } } */ +#define A B +A +A diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-15.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-15.c new file mode 100644 index 000000000..2df0b62f9 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-15.c @@ -0,0 +1,5 @@ +/* { dg-do preprocess } */ +/* { dg-options "-nostdinc -P -dU" } */ +/* { dg-final { scan-file cmdlne-dU-15.i "^\n*\n*$" } } */ +#if A +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-16.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-16.c new file mode 100644 index 000000000..41a9a9110 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-16.c @@ -0,0 +1,6 @@ +/* { dg-do preprocess } */ +/* { dg-options "-nostdinc -P -dU" } */ +/* { dg-options "-nostdinc -P -dU -std=c89" { target *-*-solaris2.* } } */ +/* { dg-final { scan-file cmdlne-dU-16.i "^\n*#define __STDC__ 1\n*$" } } */ +#ifdef __STDC__ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-17.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-17.c new file mode 100644 index 000000000..fd608e1d4 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-17.c @@ -0,0 +1,5 @@ +/* { dg-do preprocess } */ +/* { dg-options "-nostdinc -P -dU" } */ +/* { dg-options "-nostdinc -P -dU -std=c89" { target *-*-solaris2.* } } */ +/* { dg-final { scan-file cmdlne-dU-17.i "^\n*1\n+#define __STDC__ 1\n*$" } } */ +__STDC__ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-18.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-18.c new file mode 100644 index 000000000..97104845d --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-18.c @@ -0,0 +1,5 @@ +/* { dg-do preprocess } */ +/* { dg-options "-nostdinc -P -dU" } */ +/* { dg-final { scan-file cmdlne-dU-18.i "^\n*x 1 y\n+#define A 1\n*$" } } */ +#define A 1 +x A y diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-19.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-19.c new file mode 100644 index 000000000..c6c3af356 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-19.c @@ -0,0 +1,8 @@ +/* { dg-do preprocess } */ +/* { dg-options "-nostdinc -P -dU" } */ +/* { dg-final { scan-file cmdlne-dU-19.i "^\n*B\n+#define A B\n+#undef A\n*$" } } */ +#define A B +A +#undef A +#ifdef A +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-2.c new file mode 100644 index 000000000..dffdd2ba9 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-2.c @@ -0,0 +1,6 @@ +/* { dg-do preprocess } */ +/* { dg-options "-nostdinc -P -dU" } */ +/* { dg-final { scan-file cmdlne-dU-2.i "^\n*#define A *\n*$" } } */ +#define A +#ifdef A +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-20.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-20.c new file mode 100644 index 000000000..065b807ef --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-20.c @@ -0,0 +1,5 @@ +/* { dg-do preprocess } */ +/* { dg-options "-nostdinc -P -dU" } */ +/* { dg-final { scan-file cmdlne-dU-20.i "^\n*A B\n*$" } } */ +#define A(x) x +A B diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-21.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-21.c new file mode 100644 index 000000000..1fefe542c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-21.c @@ -0,0 +1,9 @@ +/* { dg-do preprocess } */ +/* { dg-options "-nostdinc -P -dU" } */ +/* { dg-final { scan-file cmdlne-dU-21.i "^\n*hello There\n+#define ASTRING There\n+#define MACROARGS\\(A\\) A\n+#undef BSTRING\n*$" } } */ +#define ASTRING There +#define MACROARGS(A) A +MACROARGS(hello) ASTRING +#ifdef BSTRING +bye +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-22.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-22.c new file mode 100644 index 000000000..fe100ceb0 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-22.c @@ -0,0 +1,14 @@ +/* { dg-do preprocess } */ +/* { dg-options "-nostdinc -P -dU" } */ +/* { dg-final { scan-file cmdlne-dU-22.i "^\n*#undef AAA\n+AAA is undefined\n+#undef BBB\n+BBB is undefined\n+#undef CCC\n+CCC is undefined\n*$" } } */ +#ifndef AAA +AAA is undefined +#endif + +#ifndef BBB +BBB is undefined +#endif + +#ifndef CCC +CCC is undefined +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-23.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-23.c new file mode 100644 index 000000000..c99a43b08 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-23.c @@ -0,0 +1,5 @@ +/* { dg-do preprocess } */ +/* { dg-options "-P -dU" } */ +/* { dg-final { scan-file-not cmdlne-dU-23.i "__FILE__" } } */ +#ifdef __FILE__ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-3.c new file mode 100644 index 000000000..a26fc9881 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-3.c @@ -0,0 +1,6 @@ +/* { dg-do preprocess } */ +/* { dg-options "-nostdinc -P -dU" } */ +/* { dg-final { scan-file cmdlne-dU-3.i "^\n*#define A B\n*$" } } */ +#define A B +#ifndef A +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-4.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-4.c new file mode 100644 index 000000000..aa3d853a0 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-4.c @@ -0,0 +1,5 @@ +/* { dg-do preprocess } */ +/* { dg-options "-nostdinc -P -dU" } */ +/* { dg-final { scan-file cmdlne-dU-4.i "^\n*#undef A\n*$" } } */ +#if defined(A) +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-5.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-5.c new file mode 100644 index 000000000..bfae850de --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-5.c @@ -0,0 +1,7 @@ +/* { dg-do preprocess } */ +/* { dg-options "-nostdinc -P -dU" } */ +/* { dg-final { scan-file cmdlne-dU-5.i "^\n*#undef A\n*$" } } */ +#ifdef A +#ifdef B +#endif +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-6.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-6.c new file mode 100644 index 000000000..e2c801df3 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-6.c @@ -0,0 +1,8 @@ +/* { dg-do preprocess } */ +/* { dg-options "-nostdinc -P -dU" } */ +/* { dg-final { scan-file cmdlne-dU-6.i "^\n*#undef A\n+#define A *\n*$" } } */ +#ifdef A +#endif +#define A +#ifdef A +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-7.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-7.c new file mode 100644 index 000000000..030917844 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-7.c @@ -0,0 +1,8 @@ +/* { dg-do preprocess } */ +/* { dg-options "-nostdinc -P -dU" } */ +/* { dg-final { scan-file cmdlne-dU-7.i "^\n*B\n+#define A B\n+C\n+#define A C\n*$" } } */ +#define A B +A +#undef A +#define A C +A diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-8.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-8.c new file mode 100644 index 000000000..da97fabed --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-8.c @@ -0,0 +1,6 @@ +/* { dg-do preprocess } */ +/* { dg-options "-nostdinc -P -dU" } */ +/* { dg-final { scan-file cmdlne-dU-8.i "^\n*B D\n+#define A\\(x\\) B x\n+#define C D\n*$" } } */ +#define A(x) B x +#define C D +A(C) diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-9.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-9.c new file mode 100644 index 000000000..bd0f0edfe --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cmdlne-dU-9.c @@ -0,0 +1,6 @@ +/* { dg-do preprocess } */ +/* { dg-options "-nostdinc -P -dU" } */ +/* { dg-final { scan-file cmdlne-dU-9.i "^\n*C\n+#define B C\n+#define A B\n*$" } } */ +#define A B +#define B C +A diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/counter-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/counter-1.c new file mode 100644 index 000000000..80d8b7892 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/counter-1.c @@ -0,0 +1,20 @@ +/* Copyright (C) 2007 Free Software Foundation + Contributed by Ollie Wild <aaw@google.com> */ + +/* { dg-do preprocess } */ + +/* Tests __COUNTER__ macro is correctly expanded. */ + +#define counter __COUNTER__ + +#if __COUNTER__ != 0 +#error __COUNTER__ != 0 +#endif + +#if counter != 1 +#error counter != 1 +#endif + +#if __COUNTER__ != 2 +#error __COUNTER__ != 2 +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/counter-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/counter-2.c new file mode 100644 index 000000000..7d6578d9c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/counter-2.c @@ -0,0 +1,14 @@ +/* Copyright 2007 Free Software Foundation, Inc. + Contributed by Ollie Wild <aaw@google.com>. */ + +/* { dg-do preprocess } */ +/* { dg-options -fdirectives-only } */ + +/* Tests __COUNTER__ macro expansion is disabled inside directives with + -fdirectives-only. */ + +#ifdef __COUNTER__ /* Macro not expanded. */ +#endif + +#if __COUNTER__ == 0 /* { dg-error "__COUNTER__ expanded inside directive with -fdirectives-only" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/counter-3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/counter-3.c new file mode 100644 index 000000000..3b1824f25 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/counter-3.c @@ -0,0 +1,10 @@ +/* Copyright 2007 Free Software Foundation, Inc. + Contributed by Ollie Wild <aaw@google.com>. */ + +/* { dg-do preprocess } */ +/* { dg-options "-fdirectives-only -fpreprocessed" } */ + +/* Tests __COUNTER__ macro expansion is enabled outside directives with + -fdirectives-only. */ + +int zero = __COUNTER__; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cpp.exp b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cpp.exp new file mode 100644 index 000000000..2f96a5fdb --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cpp.exp @@ -0,0 +1,48 @@ +# Copyright (C) 1997-2013 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# GCC testsuite that uses the `dg.exp' driver. + +# There's a bunch of headers we need. +if [is_remote host] { + foreach header [glob -nocomplain $srcdir/$subdir/*.{h,def} ] { + remote_download host $header + } +} + +# Load support procs. +load_lib gcc-dg.exp + +# If a testcase doesn't have special options, use these. +global DEFAULT_CFLAGS +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS " -ansi -pedantic-errors" +} + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{c,S} ]] \ + "" $DEFAULT_CFLAGS + +# C/C++ common tests. +dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cpp/*.{c,S} ]] \ + " -Wc++-compat " "" + + +# All done. +dg-finish diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cxxcom1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cxxcom1.c new file mode 100644 index 000000000..8e254ff75 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cxxcom1.c @@ -0,0 +1,11 @@ +/* { dg-do preprocess } */ +/* { dg-options "-pedantic -std=gnu89" } */ + +/* You can't do this in your own code... */ +// C++ comment is not in C89 { dg-warning "style comment|reported only once" "good warning" } + +/* ...but we don't bitch about it more than once. */ +// C++ comment is not in C89 { dg-bogus "style comment" "bad warning" } + +/* { dg-final { scan-file-not cxxcom1.i "is not in C89" } } */ + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cxxcom2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cxxcom2.c new file mode 100644 index 000000000..0dbb8f2fe --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cxxcom2.c @@ -0,0 +1,7 @@ +/* { dg-do preprocess } */ +/* { dg-options "-pedantic -std=c89 -Wall" } */ + +#include "cxxcom2.h" + +/* { dg-final { scan-file-not cxxcom2.i "is not in C89" } } */ + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cxxcom2.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cxxcom2.h new file mode 100644 index 000000000..546b8fd92 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/cxxcom2.h @@ -0,0 +1,4 @@ +/* A system header may contain C++ comments irrespective of mode. */ +#pragma GCC system_header +// C++ comment is not in C89 { dg-bogus "style comment" "bad warning" } + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/defined.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/defined.c new file mode 100644 index 000000000..9a60bdd5d --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/defined.c @@ -0,0 +1,85 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Tests behavior of the defined operator. */ + +/* Source: Neil Booth, 29 Oct 2000, Zack Weinberg 11 Dec 2000. */ + +#define defined /* { dg-error "defined" } */ + +/* No diagnostics, though you could argue there should be. */ +#if defined defined +#error defined is defined! +#endif + +#define is_Z_defined defined Z + +#if defined Z +#error Z is not defined +#endif + +/* The behavior of "defined" when it comes from a macro expansion is + now documented. */ +#if is_Z_defined +#error Macro expanding into defined operator test 1 +#endif + +#define Z + +#if !defined Z +#error Z is defined +#endif + +#if !is_Z_defined +#error Macro expanding into defined operator test 2 +#endif + +#undef is_Z_defined +#undef Z + +/* Do all the tests over again with the () form of defined. */ + +/* No diagnostics, though you could argue there should be. */ +#if defined(defined) +#error defined is defined! +#endif + +#define is_Z_defined defined ( Z ) + +#if defined(Z) +#error Z is not defined +#endif + +/* The behavior of "defined" when it comes from a macro expansion is + now documented. */ +#if is_Z_defined +#error Macro expanding into defined operator test 1 +#endif + +#define Z + +#if !defined(Z) +#error Z is defined +#endif + +#if !is_Z_defined +#error Macro expanding into defined operator test 2 +#endif + +/* Use of defined in different contexts. */ + +#define bad1 defined +#if !bad1 Z /* { dg-warning "may not be portable" } */ +#error Z is defined +#endif + +#if !bad1 (Z) /* { dg-warning "may not be portable" } */ +#error Z is defined +#endif + +#define bad2 defined (Z +#if !bad2) /* { dg-warning "may not be portable" } */ +#error Z is defined +#endif + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/digraph1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/digraph1.c new file mode 100644 index 000000000..e098d68da --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/digraph1.c @@ -0,0 +1,17 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:199409" } */ + +/* Just simple check that digraphs are on under c94, for both + preprocessor and compiler. digraphs.c is the general test. */ + +%:define glue +#ifndef glue +#error glue not defined! +#endif + +int main (int argc, char *argv<::>) +<% + return 0; +%> diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/digraph2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/digraph2.c new file mode 100644 index 000000000..293cafa49 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/digraph2.c @@ -0,0 +1,19 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ +/* { dg-options "-std=c89" } */ + +/* Just simple check that digraphs are not on in c89, for both + preprocessor and compiler. digraphs.c is the general test. */ + +int main (int argc, char *argv[]) +{ + return 0; +%> /* { dg-error "parse error|syntax error|expected" } */ + +/* Place this after main () so we get to test both the compiler above + and the preprocessor below. */ +%:define glue /* { dg-error "expected declaration" } */ +#ifdef glue +#error glue is defined! +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/digraphs.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/digraphs.c new file mode 100644 index 000000000..49a1bcd86 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/digraphs.c @@ -0,0 +1,31 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do run } */ +/* { dg-options "-std=c99" } */ + +/* Fully test the 6 digraphs under c99 assumptions. Four are pasted, + to check that digraph pasting works. */ + +extern int strcmp (const char *, const char *); +extern void abort (void); +extern int puts (const char *); +#define err(str) do { puts(str); abort(); } while (0) + +%:define glue(x, y) x %:%: y /* #define glue(x, y) x ## y. */ +#ifndef glue +#error glue not defined! +#endif +%:define str(x) %:x /* #define str(x) #x */ + +int main (int argc, char *argv<::>) /* argv[] */ +glue (<, %) /* { */ + /* di_str[] = */ + const char di_str glue(<, :)glue(:, >) = str(%:%:<::><%%>%:); + + /* Check the glue macro actually pastes, and that the spelling of + all digraphs is preserved. */ + if (glue(str, cmp) (di_str, "%:%:<::><%%>%:")) + err ("Digraph spelling not preserved!"); + + return 0; +glue (%, >) /* } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-1.c new file mode 100644 index 000000000..3c2261683 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-1.c @@ -0,0 +1,73 @@ +/* Copyright 2007 Free Software Foundation, Inc. + Contributed by Ollie Wild <aaw@google.com>. */ + +/* { dg-do preprocess } */ +/* { dg-options -fdirectives-only } */ + +/* Tests scan_translation_unit_directives_only()'s handling of corner cases. */ + +/* Ignore directives inside block comments... +#error directive inside block comment +*/ + +// Escaped newline doesn't terminate line comment \ +#error directive inside line comment + +/* A comment canot start inside a string. */ +const char *c1 = "/*"; +#define NOT_IN_COMMENT +const char *c2 = "*/"; +#ifndef NOT_IN_COMMENT +#error Comment started inside a string literal +#endif + +/* Escaped newline handling. */ +int i; \ +#error ignored escaped newline + \ + \ +#define BOL +#ifndef BOL +#error escaped newline did not preserve beginning of line +#endif + +/* Handles \\ properly at the end of a string. */ +"string ends in \\"/* +#error Missed string terminator. +*/ + +/* Handles macro expansion in preprocessing directives. */ +#define HEADER "dir-only-1.h" +#include HEADER +#ifndef GOT_HEADER +#error Failed to include header. +#endif + +/\ +* +#define IN_COMMENT +*/ +#ifdef IN_COMMENT +#error Escaped newline breaks block comment initiator. +#endif + +/* +*\ +/ +#define NOT_IN_COMMENT2 +/**/ +#ifndef NOT_IN_COMMENT2 +#error Escaped newline breaks block comment terminator. +#endif + +/* Test escaped newline inside character escape sequence. */ +"\\ +\"/* +#error Missed string terminator +*/ + +/* Block comments don't mask trailing preprocessing + directive. */ #define NOT_MASKED +#ifndef NOT_MASKED +#error Comment masks trailing directive. +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-1.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-1.h new file mode 100644 index 000000000..96dbcc048 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-1.h @@ -0,0 +1,3 @@ +/* Copyright 2007 Free Software Foundation, Inc. + Contributed by Ollie Wild <aaw@google.com>. */ +#define GOT_HEADER diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-2.c new file mode 100644 index 000000000..489b4d6ee --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-2.c @@ -0,0 +1,12 @@ +/* Copyright 2007 Free Software Foundation, Inc. + Contributed by Ollie Wild <aaw@google.com>. */ + +/* { dg-do preprocess } */ +/* { dg-options "-fpreprocessed -fdirectives-only -DNOT_SET" } */ + +/* Tests -fdirectives-only + -fpreprocessed. */ + +/* Check this is not defined. */ +#ifdef NOT_SET +#error Command line macro not disabled. +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-3.c new file mode 100644 index 000000000..e6eaa0180 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-3.c @@ -0,0 +1,13 @@ +/* Copyright 2007 Free Software Foundation, Inc. + Contributed by Ollie Wild <aaw@google.com>. */ + +/* { dg-do preprocess } */ +/* { dg-options "-fdirectives-only -H" } */ +/* { dg-message "dir-only-3a\.h\n\[^\n\]*dir-only-3b\.h\n\[^\n\]*dir-only-3a\.h\n" "include guard check" { target *-*-* } 0 } */ + +/* Tests include guards. */ + +#include "dir-only-3a.h" +#include "dir-only-3b.h" +#include "dir-only-3b.h" +#include "dir-only-3a.h" diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-3a.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-3a.h new file mode 100644 index 000000000..6644bbfb0 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-3a.h @@ -0,0 +1,8 @@ +/* Copyright 2007 Free Software Foundation, Inc. + Contributed by Ollie Wild <aaw@google.com>. */ + +extern int outside_guard + +#ifndef DIR_ONLY_3A_H +#define DIR_ONLY_3A_H +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-3b.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-3b.h new file mode 100644 index 000000000..4edaa7b6b --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-3b.h @@ -0,0 +1,9 @@ +/* Copyright 2007 Free Software Foundation, Inc. + Contributed by Ollie Wild <aaw@google.com>. */ + +#ifndef DIR_ONLY_3B_H +#define DIR_ONLY_3B_H + +extern int inside guard; + +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-4.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-4.c new file mode 100644 index 000000000..a7b5f048f --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-4.c @@ -0,0 +1,6 @@ +/* Copyright 2007 Free Software Foundation, Inc. + Contributed by Ollie Wild <aaw@google.com>. */ + +/* { dg-do preprocess } */ +/* { dg-options "-fdirectives-only -Wunused-macros" } */ +/* { dg-error "-fdirectives-only is incompatible with -Wunused_macros\n" "-Wunused-macros check" { target *-*-* } 0 } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-5.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-5.c new file mode 100644 index 000000000..643a4d7ad --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-5.c @@ -0,0 +1,6 @@ +/* Copyright 2007 Free Software Foundation, Inc. + Contributed by Ollie Wild <aaw@google.com>. */ + +/* { dg-do preprocess } */ +/* { dg-options "-fdirectives-only -traditional" } */ +/* { dg-error "-fdirectives-only is incompatible with -traditional\n" "-traditional check" { target *-*-* } 0 } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-6.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-6.c new file mode 100644 index 000000000..0023205fa --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/dir-only-6.c @@ -0,0 +1,7 @@ +/* Copyright 2007 Free Software Foundation, Inc. + Contributed by Ollie Wild <aaw@google.com>. */ + +/* { dg-do preprocess } */ +/* { dg-options -fdirectives-only } */ + +/* { dg-error "unterminated comment" } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/direct2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/direct2.c new file mode 100644 index 000000000..1ce40bfb5 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/direct2.c @@ -0,0 +1,48 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + Contributed by Nathan Sidwell 8 May 2001 <nathan@codesourcery.com> */ + +/* Test of prohibition on directives which result from macro expansion. + See also direct2s.c */ + +/* + { dg-options "-ftrack-macro-expansion=0" } + { dg-do compile } */ + +#define HASH # +#define HASHDEFINE #define +#define HASHINCLUDE #include + +HASH include "somerandomfile" /*{ dg-error "stray" "non-include" }*/ +/*{ dg-bogus "No such" "don't execute non-include" { target *-*-* } 15 }*/ +int resync_parser_1; /*{ dg-error "parse|syntax|expected" "" { target *-*-* } 15 }*/ + +HASHINCLUDE <somerandomfile> /*{ dg-error "stray|expected" "non-include 2" }*/ +/*{ dg-bogus "No such" "don't execute non-include 2" { target *-*-* } 19 }*/ +int resync_parser_2; + +void g1 () +{ +HASH define X 1 /* { dg-error "stray|unknown|expected" "# from macro" } */ + int resync_parser_3; +} + +void g2 () +{ +HASHDEFINE Y 1 /* { dg-error "stray|unknown|expected" "#define from macro" } */ + int resync_parser_4; +} + +#pragma GCC dependency "direct2.c" +# + +void f () +{ + int i = X; /* { dg-error "undeclared|for each" "no macro X" } */ + int j = Y; /* { dg-error "undeclared|for each" "no macro Y" } */ +} + +#define slashstar /##* +#define starslash *##/ + +slashstar starslash /* { dg-error "parse error|syntax error|expected" "not a comment" } */ +/* { dg-error "does not give" "paste warning(s)" { target *-*-* } 47 } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/direct2s.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/direct2s.c new file mode 100644 index 000000000..592321419 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/direct2s.c @@ -0,0 +1,44 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + Contributed by Nathan Sidwell 8 May 2001 <nathan@codesourcery.com> */ + +/* Test of prohibition on directives which result from macro + expansion. Same as direct2.c, with -save-temps applied; results + should be identical. */ + +/* { dg-do compile } */ +/* { dg-options "-save-temps -ansi -pedantic-errors -ftrack-macro-expansion=0" } */ + +#define HASH # +#define HASHDEFINE #define +#define HASHINCLUDE #include + +HASH include "somerandomfile" /*{ dg-error "stray" "non-include" }*/ +/*{ dg-bogus "No such" "don't execute non-include" { target *-*-* } 15 }*/ +int resync_parser_1; /*{ dg-error "parse|syntax|expected" "" { target *-*-* } 15 }*/ + +HASHINCLUDE <somerandomfile> /*{ dg-error "stray|expected" "non-include 2" }*/ +/*{ dg-bogus "No such" "don't execute non-include 2" { target *-*-* } 18 }*/ +int resync_parser_2; + +void g1 () +{ +HASH define X 1 /* { dg-error "stray|unknown|expected" "# from macro" } */ + int resync_parser_3; +} + +void g2 () +{ +HASHDEFINE Y 1 /* { dg-error "stray|unknown|expected" "#define from macro" } */ + int resync_parser_4; +} + +#pragma GCC dependency "direct2.c" +# + +void f () +{ + int i = X; /* { dg-error "undeclared|for each" "no macro X" } */ + int j = Y; /* { dg-error "undeclared|for each" "no macro Y" } */ +} + +/* { dg-final { cleanup-saved-temps } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/directiv.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/directiv.c new file mode 100644 index 000000000..aafe2ec10 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/directiv.c @@ -0,0 +1,35 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options -pedantic } */ + +/* Tests general directive syntax, and directive error recovery. */ + + +/* Test directive name is not expanded. */ +#define foo define +#foo EMPTY /* { dg-error "invalid" } */ + +/* Test # must be first on line. */ +EMPTY #define bar +#ifdef bar +#error bar is defined +#endif + +/* Test form feed and vertical tab warn pedantically, see 6.10 + paragraph 5. Tab is OK. */ +#define something /* { dg-warning "form feed" } */ +#define something_else /* { dg-warning "vertical tab" } */ +#define some thing /* Tab OK, as is form feed before #. */ + +/* Our friend the null directive OK? */ +# + +/* Check newlines end directives, even in function-like macro + invocations. 6.10 paragraph 1. + + Note that the #if is still treated as a conditional, so there + should be no errors about #endif without #if. */ +#define func(x) x +#if func ( /* { dg-error "unterminated argument" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/empty-include.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/empty-include.c new file mode 100644 index 000000000..6b6c0753f --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/empty-include.c @@ -0,0 +1,14 @@ +/* + * Copyright 2004 Free Software Foundation, Inc. + * Contributed and written by Nathanael Nerode. + * + * GCC 3.4 would attempt to open stdin as the included file + * (PR 17610), causing a sort of hang. + * + * We should get an error. + */ + +/* { dg-do preprocess } */ +/* { dg-options "-fshow-column" } */ +#include "" /* { dg-error "10:empty" "error on empty filename in include" } */ +int x; /* Otherwise we have an empty file and get more errors. */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/endif-pedantic1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/endif-pedantic1.c new file mode 100644 index 000000000..c97e32907 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/endif-pedantic1.c @@ -0,0 +1,17 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-pedantic -Wno-endif-labels" } */ + +/* Tests combinations of -pedantic and -Wno-endif-labels; see extratokens2.c + for more general tests. */ + +/* Source: Phil Edwards, 25 Mar 2002. Copied from extratokens2.c and + modified. */ + +#if 1 +#if 0 +#else foo /* { dg-bogus "extra tokens" "bad warning" } */ +#endif / /* { dg-bogus "extra tokens" "bad warning" } */ +#endif + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/endif-pedantic2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/endif-pedantic2.c new file mode 100644 index 000000000..55cc5eb66 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/endif-pedantic2.c @@ -0,0 +1,17 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-Wno-endif-labels -pedantic-errors" } */ + +/* Tests combinations of -pedantic and -Wno-endif-labels; see extratokens2.c + for more general tests. */ + +/* Source: Phil Edwards, 25 Mar 2002. Copied from endif-pedantic1.c and + modified. */ + +#if 1 +#if 0 +#else foo /* { dg-error "extra tokens" "tokens after #else" } */ +#endif / /* { dg-error "extra tokens" "tokens after #endif" } */ +#endif + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/endif.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/endif.c new file mode 100644 index 000000000..efea52c46 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/endif.c @@ -0,0 +1,14 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Test case for PR preprocessor/6386 by Andreas Schwab. We'd back up + over the CPP_EOF token (indicating not a funlike macro invocation) + in the header file, which would then be passed through as a real + EOF, leading to an early exit (and therefore bogus complaint about + unterminated #if). */ + +#define S(x) +#if 1 +#include "endif.h" +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/endif.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/endif.h new file mode 100644 index 000000000..37622491d --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/endif.h @@ -0,0 +1 @@ +S diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/error-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/error-1.c new file mode 100644 index 000000000..1bc6a3f6e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/error-1.c @@ -0,0 +1,5 @@ +/* Test that error messages include "error:" in the text. */ +/* Origin: Joseph Myers <jsm@polyomino.org.uk> */ +/* { dg-do preprocess } */ + +/* { dg-error "unterminated comment" } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/escape-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/escape-1.c new file mode 100644 index 000000000..0f5c11e9a --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/escape-1.c @@ -0,0 +1,39 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ + +/* This tests various diagnostics about escape sequences, for both + the preprocessor and the compiler. + + Neil Booth, 22 May 2001. */ + +#if '\x' /* { dg-error "no following" "\x with no digits" } */ +#endif +#if '\x400' /* { dg-error "out of range" "\x out of range" } */ +#endif +#if '\x0ff' /* { dg-bogus "out of range" "\x out of range" } */ +#endif +#if '\400' /* { dg-error "out of range" "\x out of range" } */ +#endif +#if '\377' /* { dg-bogus "out of range" "bogus \x out of range" } */ +#endif +#if '\177' != 0x7f /* { dg-bogus "out of range" "bogus \x out of range" } */ +#error bad octal /* { dg-bogus "bad" "bad octal evaluation" } */ +#endif +#if '\0377' /* { dg-warning "multi" "too long octal" } */ +#endif +#if '\p' /* { dg-error "unknown escape" "unknown escape seq" } */ +#endif + +void foo () +{ + int c; + + c = '\x'; /* { dg-error "no following" "\x with no digits" } */ + c = '\x100'; /* { dg-error "out of range" "\x out of range" } */ + c = '\x0ff'; /* { dg-bogus "out of range" "\x out of range" } */ + c = '\400'; /* { dg-error "out of range" "\x out of range" } */ + c = '\377'; /* { dg-bogus "out of range" "bogus \x out of range" } */ + c = '\0377'; /* { dg-warning "multi" "too long octal" } */ + c = '\p'; /* { dg-error "unknown escape" "unknown escape seq" } */ +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/escape-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/escape-2.c new file mode 100644 index 000000000..902fad3a2 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/escape-2.c @@ -0,0 +1,20 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ +/* { dg-options "-pedantic -std=c99" } */ + +/* This tests various diagnostics with -pedantic about escape + sequences, for both the preprocessor and the compiler. + + Neil Booth, 22 May 2001. */ + +#if '\e' /* { dg-warning "non-ISO" "non-ISO \\e" } */ +#endif +#if L'\u00a0' /* { dg-bogus "unknown" "\\u is known in C99" } */ +#endif + +void foo () +{ + int c = '\E'; /* { dg-warning "non-ISO" "non-ISO \\E" } */ + c = L'\u00a0'; /* { dg-bogus "unknown" "\\u is known in C99" } */ +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/escape.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/escape.c new file mode 100644 index 000000000..e7d5e08dd --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/escape.c @@ -0,0 +1,25 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ +/* { dg-options "-Wtraditional -std=c89" } */ + +/* This tests various diagnostics with -Wtraditioanl about escape + sequences, for both the preprocessor and the compiler. + + Neil Booth, 22 May 2001. */ + +#if '\a' /* { dg-warning "traditional" "traditional bell" } */ +#endif +#if '\x1a' != 26 /* { dg-warning "traditional" "traditional hex" } */ + #error bad hex /* { dg-bogus "bad" "bad hexadecimal evaluation" } */ +#endif +#if L'\u00a1' /* { dg-warning "only valid" "\u is unknown in C89" } */ +#endif + +void foo () +{ + int c = '\a'; /* { dg-warning "traditional" "traditional bell" } */ + + c = '\xa1'; /* { dg-warning "traditional" "traditional hex" } */ + c = L'\u00a1'; /* { dg-warning "only valid" "\u is unknown in C89" } */ +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/expr.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/expr.c new file mode 100644 index 000000000..532bd6812 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/expr.c @@ -0,0 +1,17 @@ +/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Test we get signedness of ?: operator correct. We would skip + evaluation of one argument, and might therefore not transfer its + unsignedness to the result. */ + +/* Neil Booth, 19 Jul 2002. */ + +#if (1 ? -2: 0 + 1U) < 0 +#error /* { dg-bogus "error" } */ +#endif + +#if (0 ? 0 + 1U: -2) < 0 +#error /* { dg-bogus "error" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/extratokens.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/extratokens.c new file mode 100644 index 000000000..11d094af5 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/extratokens.c @@ -0,0 +1,38 @@ +/* Copyright (C) 2000, 2008 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-Wno-deprecated" } */ + +/* Tests all directives that do not permit excess tokens at the end of + the line. */ + +/* Source: Neil Booth, 4 Dec 2000. The combination of separate test + cases. */ + +#ifdef foo bar /* { dg-warning "extra tokens" "tokens after #ifdef" } */ +#endif + +#ifndef foo bar /* { dg-warning "extra tokens" "tokens after #ifndef" } */ +#endif + +#if 1 +#if 0 +#else foo /* { dg-warning "extra tokens" "tokens after #else" } */ +#endif / /* { dg-warning "extra tokens" "tokens after #endif" } */ +#endif + +#undef foo bar /* { dg-warning "extra tokens" "tokens after #undef" } */ + +#assert foo(bar) bar /* { dg-warning "extra tokens" "tokens after #assert" } */ + +#unassert foo(bar) b /* { dg-warning "extra tokens" "tokens after #unassert" } */ + +#include "mi1c.h" bar /* { dg-warning "extra tokens" "tokens after #include" } */ + +#ident "something" bar /* { dg-warning "extra tokens" "tokens after #ident" } */ + +# 36 "file.c" 3 + +/* ... but in a system header, it's acceptable. */ +#ifdef KERNEL +#endif KERNEL /* { dg-bogus "extra tokens" "bad warning" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/extratokens2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/extratokens2.c new file mode 100644 index 000000000..8e69a96c5 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/extratokens2.c @@ -0,0 +1,22 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-Wno-endif-labels" } */ + +/* Tests that -Wno-endif-labels correctly disables the checks done by + default (and tested in extratokens.c). */ + +/* Source: Phil Edwards, 21 Mar 2002. Copied from extratokens.c and + modified. */ + +#if 1 +#if 0 +#else foo /* { dg-bogus "extra tokens" "bad warning" } */ +#endif / /* { dg-bogus "extra tokens" "bad warning" } */ +#endif + +# 36 "file.c" 3 + +/* ... but in a system header, it's acceptable. */ +#ifdef KERNEL +#endif KERNEL /* { dg-bogus "extra tokens" "bad warning" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/fpreprocessed.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/fpreprocessed.c new file mode 100644 index 000000000..53d298f53 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/fpreprocessed.c @@ -0,0 +1,10 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options -fpreprocessed } */ + +/* Source: Jason Merrill, 19 Nov 2001. We'd try and back up a token + and move to a non-existent token run with -fpreprocessed on a file + without a leading # line. */ + +foo diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/A.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/A.h new file mode 100644 index 000000000..557372951 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/A.h @@ -0,0 +1 @@ +#import <OneSub/C.h> diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/B.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/B.h new file mode 100644 index 000000000..557372951 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/B.h @@ -0,0 +1 @@ +#import <OneSub/C.h> diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/C.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/C.h new file mode 100644 index 000000000..5afd8050c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/C.h @@ -0,0 +1,4 @@ +#ifdef ONESUB_C_INCLUDED +#error should only be imported once +#endif +#define ONESUB_C_INCLUDED 1 diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/frame/one.framework/Headers/one-includeSubs.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/frame/one.framework/Headers/one-includeSubs.h new file mode 100644 index 000000000..adaeb95ad --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/frame/one.framework/Headers/one-includeSubs.h @@ -0,0 +1,2 @@ +#import <OneSub/A.h> +#import <OneSub/B.h> diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/gnuc89-pedantic.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/gnuc89-pedantic.c new file mode 100644 index 000000000..2749ad739 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/gnuc89-pedantic.c @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=gnu89 -pedantic" } */ + +/* This file is for testing the preprocessor in -std=gnu89 -pedantic mode. + Neil Booth, 2 Dec 2000. */ + +#if 1LL /* { dg-warning "long long" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/gnuc89.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/gnuc89.c new file mode 100644 index 000000000..b655ead02 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/gnuc89.c @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=gnu89" } */ + +/* This file is for testing the preprocessor in -std=gnu89 mode. + Neil Booth, 2 Dec 2000. */ + +#if 1LL +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/gnuc99-pedantic.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/gnuc99-pedantic.c new file mode 100644 index 000000000..9e3550d3e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/gnuc99-pedantic.c @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=gnu99 -pedantic" } */ + +/* This file is for testing the preprocessor in -std=gnu99 -pedantic mode. + Neil Booth, 2 Dec 2000. */ + +#if 1LL +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/gnuc99.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/gnuc99.c new file mode 100644 index 000000000..5e2ee29c3 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/gnuc99.c @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=gnu99" } */ + +/* This file is for testing the preprocessor in -std=gnu99 mode. + Neil Booth, 2 Dec 2000. */ + +#if 1LL +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/hash1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/hash1.c new file mode 100644 index 000000000..a4c4b3516 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/hash1.c @@ -0,0 +1,9 @@ +/* Test for proper handling of # in object-like macros. + From Linux kernel. */ +/* { dg-do preprocess } */ + +#define FIXUP .section ".fixup",#alloc,#execinstr + +FIXUP + +/* { dg-bogus "not followed by" "object-like #" { target *-*-* } 3 } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ident-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ident-1.c new file mode 100644 index 000000000..da6e516d2 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ident-1.c @@ -0,0 +1,8 @@ +/* { dg-do preprocess } */ +/* { dg-options "-Wno-deprecated" } */ /* shut off -pedantic */ + +/* Based on PR 16999 */ + +#ident "this is an ident" + +/* { dg-final { scan-file "ident-1.i" "(^|\\n)#ident \"this is an ident\"($|\\n)" } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ident.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ident.c new file mode 100644 index 000000000..5477cbe10 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ident.c @@ -0,0 +1,7 @@ +/* Test #ident. */ +/* { dg-do compile } */ +/* { dg-options "-Wno-deprecated" } */ /* shut off -pedantic */ + +#ident "this is an ident" + +int dummy(void) { return 12; } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-1.c new file mode 100644 index 000000000..c30f21561 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-1.c @@ -0,0 +1,41 @@ +/* { dg-do preprocess } */ +/* { dg-options "-pedantic-errors" } */ + +#if 0xa != 10 +#error 0xa != 10 /* { dg-bogus "#error" "normal conversion" } */ +#endif + +#if 077 != 63 +#error 077 != 63 /* { dg-bogus "#error" "normal conversion" } */ +#endif + +#if 12wrt /* { dg-error "invalid suffix" "invalid number" } */ +#endif + +#if 0abc /* { dg-error "invalid suffix" "invalid number" } */ +#endif + +#if 42abc /* { dg-error "invalid suffix" "invalid number" } */ +#endif + +#if 0xabc != 2748 +#error 0xabc /* { dg-bogus "#error" "normal conversion" } */ +#endif + +#if 1.2 /* { dg-error "loating constant" "floating point in #if" } */ +#endif + +#if 4uu /* { dg-error "invalid suffix" "too many suffixes" } */ +#endif + +#if 124123231lll /* { dg-error "invalid suffix" "too many suffixes" } */ +#endif + +#if 1234lul /* { dg-error "invalid suffix" "u between ls" } */ +#endif + +#if 099 /* { dg-error "invalid digit" "decimal in octal constant" } */ +#endif + +#if 0xfffffffffffffffff /* { dg-error "integer constant" "range error" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-2.c new file mode 100644 index 000000000..dc136b456 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-2.c @@ -0,0 +1,28 @@ +/* { dg-do preprocess } */ +/* { dg-options -pedantic-errors } */ + +#if 'a' != 'a' || '\001' != 1 || '\x12' != 0x12 +#error a,1,0x12 /* { dg-bogus "#error" "basic charconst recognition" } */ +#endif + +#if 'a' != L'a' +#error L'a' /* { dg-bogus "error" "wide charconst recognition 1" } */ +#endif + +#if L'\xfeed' != 0xfeed && L'\xfeed' != (0xfeed - 0x10000) +#error 0xfeed /* { dg-bogus "error" "wide charconst recognition 2" } */ +#endif + +#if L'\x1234' != 0x1234 +#error 0x1234 /* { dg-bogus "error" "wide charconst recognition 3" } */ +#endif + +/* The 'character constant (is )?too long' message is produced by 16-bit targets. */ +#if 'abcd' /* { dg-warning "(multi-character character constant)|(character constant (is )?too long)" "multi-character charconst" } */ +#endif + +#if 'abcdefghi' /* { dg-warning "character constant (is )?too long" "charconst too long" } */ +#endif + +#if '' /* { dg-error "empty character constant" "empty charconst" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-4.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-4.c new file mode 100644 index 000000000..fbab9efc1 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-4.c @@ -0,0 +1,8 @@ +/* Regression test for proper error message. The token name isn't + NUL terminated, so we would print garbage after it. */ +/* { dg-do compile } */ + +#if 1 += 2 /* { dg-error "is not valid" "+= in if" } */ +syntax_error +#endif +int foo; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-5.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-5.c new file mode 100644 index 000000000..8238a12ae --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-5.c @@ -0,0 +1,9 @@ +/* Regression test: #ifdef 0 should not crash. Problem noted by + Jakub Jelinek <jakub@redhat.com>. */ +/* { dg-do preprocess } */ + +#ifdef 0 /* { dg-error "macro names" } */ +#endif + +#ifndef 0 /* { dg-error "macro names" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-cexp.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-cexp.c new file mode 100644 index 000000000..1ebd11929 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-cexp.c @@ -0,0 +1,14 @@ +/* { dg-do preprocess } */ + +/* Test the ? : opearator, for precedence and both true and false. */ + +#if 1 ? 1 ? 2 : 0 : 0 +#error OK /* { dg-error "OK" "nested ? :" } */ +#endif + +#if ((0) ? (1) ? (2) : (3) : (4) ? (5): (6)) == 5 +#error OK /* { dg-error "OK" "nested ? : with parens" } */ +#endif + +#if 2: /* { dg-error "':' without" "immediate :" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-div.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-div.c new file mode 100644 index 000000000..4e4216812 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-div.c @@ -0,0 +1,6 @@ +/* { dg-do preprocess } */ + +/* Test that this preprocesses without error. */ + +#if (-1)/2 +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-mop.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-mop.c new file mode 100644 index 000000000..119c7392e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-mop.c @@ -0,0 +1,31 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Source: Neil Booth. */ + +/* Various illegal expressions with missing components. */ + +#if /* { dg-error "no expression" "empty #if" } */ +#endif + +#if ~ /* { dg-error "no right op" "no unary operand" } */ +#endif + +#if 3 + * 6 + 4 /* { dg-error "no right op" "no right operand" } */ +#endif + +#if 2 ~2 /* { dg-error "missing bin" "no binary operator" } */ +#endif + +#if 1 + 2 (3) /* { dg-error "missing bin" "immediate then open paren" } */ +#endif + +#if (2) 4 * 2 /* { dg-error "missing bin" "close paren then immediate" } */ +#endif + +#if == 2 /* { dg-error "no left op" } */ +#endif + +#if (==2) /* { dg-error "no left op" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-mpar.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-mpar.c new file mode 100644 index 000000000..45dd78b1e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-mpar.c @@ -0,0 +1,29 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* Test various combinations of missing parentheses give the correct + missing parenthesis message. */ + +/* { dg-do preprocess } */ +#if (1 /* { dg-error "5:missing '\\)'" "missing ')' no. 1" } */ +#endif + +#if 2 * (3 + 4 /* { dg-error "9:missing '\\)'" "missing ')' no. 2" } */ +#endif + +#if (2)) /* { dg-error "8:missing '\\('" "missing '(' no. 1" } */ +#endif + +#if ) /* { dg-error "5:missing '\\('" "missing '(' no. 2" } */ +#endif + +#if 4) /* { dg-error "6:missing '\\('" "missing '(' no. 3" } */ +#endif + +#if ( /* { dg-error "5:missing '\\)'" "missing ')' no. 3" } */ +#endif + +#if ((2 + 3) + 5 /* { dg-error "5:missing '\\)'" "missing ')' no. 3" } */ +#endif + +#if ((2 + 3 + 5 /* { dg-error "6:missing '\\)'" "missing ')' no. 3" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-oppr.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-oppr.c new file mode 100644 index 000000000..a46a815cf --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-oppr.c @@ -0,0 +1,92 @@ +/* Copyright (C) 2000, 2008 Free Software Foundation, Inc. */ + +/* Test the full range of preprocessor operator precedence. Each + operator is tested with one of immediately higher precedence to + verify it is of strictly lower precedence. To avoid complications, + each test uses just those two operators. Occasionally this assumes + correct operation of if-then-else, so the first tests verify this. */ + +/* { dg-do preprocess } */ + +/* Ensure correct functioning of if-then-else. */ +#if 1 +#else +#error #else block evaluated for true conditional +#endif + +#if 0 +#error #if block evaluated for false conditional +#else +#endif + +/* : strictly higher than ?. This would give a syntax error otherwise. */ +#if 0 ? 0 : 1 ? 1 : 1 +#endif + +/* || strictly higher than ?:. */ +#if 1 ? 0: 0 || 1 +#error operator ?: has higher precedence than operator || +#endif + +/* && strictly higher than ||. */ +#if 1 || 0 && 0 +#else +#error operator || has higher precedence than operator && +#endif + +/* | strictly higher than &&. */ +#if 0 && 0 | 1 +#error operator && has higher precedence than operator | +#endif + +/* ^ strictly higher than |. */ +#if 1 | 0 ^ 1 +#else +#error operator | has higher precedence than operator ^ +#endif + +/* & strictly higher than ^. */ +#if 1 ^ 0 & 0 +#else +#error operator ^ has higher precedence than operator & +#endif + +/* == (!=) strictly higher than &. */ +#if 0 & 0 == 0 +#error operator & has higher precedence than operator == +#endif + +/* < (>, <=, >=) strictly higher than == (!=). */ + +#if 0 == 0 < 0 +#else +#error operator == has higher precedence than operator < +#endif + +/* << (>>) strictly higher than < (>, <=, >=). */ +#if 1 < 1 << 1 +#else +#error operator < has higher precedence than operator << +#endif + +/* Binary + (-) strictly higher than << (>>). */ +#if 0 << 0 + 1 +#error operator << has higher precedence than binary + +#endif + +/* Binary * (/, %) strictly higher than binary + (-). */ +#if 1 + 0 * 0 +#else +#error binary + has higher precedence than binary * +#endif + +/* Unary operators (!, ~, -, +) strictly higher than binary * (/, %). + Equality is hard to detect because of right-associativity. */ +#if ~1 * 0 +#error binary * has higher precedence than operator ~ +#endif + +/* () > Unary. Unfortunately this requires an additional operator. */ +#if -(1 - 1) +#error unary - has higher precedence than operator () +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-oppr2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-oppr2.c new file mode 100644 index 000000000..bcfe7cca2 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-oppr2.c @@ -0,0 +1,10 @@ +/* Copyright (C) 2008 Free Software Foundation, Inc. */ + +/* Another test of operator precedence. */ + +/* { dg-do preprocess } */ +/* { dg-options "" } */ + +#if 1 ? 2 : 3 , 0 +#error +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-paren.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-paren.c new file mode 100644 index 000000000..407a302b2 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-paren.c @@ -0,0 +1,31 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* These now use "!=" rather than "<" to increase chance of failure. */ +#if 16 * (1) + 4 != 20 +#error /* { dg-bogus "error" "with paren" } */ +#endif + +#if 16 * 1 + 4 != 20 +#error /* { dg-bogus "error" "without paren" } */ +#endif + +#if () /* { dg-error "expression between" "empty paren" } */ +#endif + +#if (1) == 1 +#error /* { dg-error "" "simple parens no. 1" } */ +#endif + +#if (2) +#error /* { dg-error "" "simple parens no. 2" } */ +#endif + +#if 3 == (3) +#error /* { dg-error "" "simple parens no. 3" } */ +#endif + +#if (((-1) + 8)) == ((+2) * ((3)) - -1) +#error /* { dg-error "" "nested parentheses" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-sc.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-sc.c new file mode 100644 index 000000000..1607669f0 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-sc.c @@ -0,0 +1,26 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Test that all operators correctly short circuit. */ + +#if (2 || 3 / 0) != 1 +#error /* { dg-bogus "error" "|| short circuit" } */ +#endif + +#if 0 && 3 / 0 +#error /* { dg-bogus "error" "&& short circuit" } */ +#endif + +#if 1 ? 0 : 3 / 0 +#error /* { dg-bogus "error" "? : right short circuit" } */ +#endif + +#if 0 ? 3 / 0 : 2 +#else +#error /* { dg-bogus "error" "? : left short circuit" } */ +#endif + +#if -1 ? 0 && 3 / 0 : 3 / 0 + 5 == 5 +#error /* { dg-bogus "error" "nested short circuiting" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-shift.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-shift.c new file mode 100644 index 000000000..a55420a79 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-shift.c @@ -0,0 +1,22 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Test shift operators. */ + +#if 1 << 4 != 16 +#error /* { dg-bogus "error" "<< +ve shift" } */ +#endif + +#if 19 >> 2 != 4 +#error /* { dg-bogus "error" ">> +ve shift" } */ +#endif + +#if 17 << -2 != 17 >> 2 +#error /* { dg-bogus "error" "<< -ve shift" } */ +#endif + +#if 25 >> -2 != 25 << 2 +#error /* { dg-bogus "error" ">> -ve shift" } */ +#endif + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-unary.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-unary.c new file mode 100644 index 000000000..f5442afe8 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/if-unary.c @@ -0,0 +1,32 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Test the various unary operators. */ + +#if 1 + + + 1 /* allow multiple unary sign operators :) */ +#endif + +#if 8 - +3 != +4 + +1 +#error /* { dg-bogus "error" "unary +" } */ +#endif + +#if -2 - -1 != -1 +#error /* { dg-bogus "error" "unary -" } */ +#endif + +#if ~0 != -1 +#error /* { dg-bogus "error" "unary ~" } */ +#endif + +#if !0 && (!1 == 0) && !!1 != 1 +#error /* { dg-bogus "error" "unary !" } */ +#endif + +#if ~~8 != 8 +#error /* { dg-bogus "error" "double unary ~" } */ +#endif + +#if 5 + +!-4 != 5 +#error /* { dg-bogus "error" "compound unary +, !, -" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/import1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/import1.c new file mode 100644 index 000000000..07130f014 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/import1.c @@ -0,0 +1,16 @@ +/* Copyright (C) 2003, 2008 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-Wno-deprecated" } */ + +/* This tests that our eagerness to apply the multiple include guard + optimization to the #import doesn't stop us marking the file + once-only. + + Neil Booth, 2 August 2003. */ + +#include "import1.h" +#import "import1.h" +#undef IMPORT1_H +#define BUG +#include "import1.h" diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/import1.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/import1.h new file mode 100644 index 000000000..936c525eb --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/import1.h @@ -0,0 +1,6 @@ +#ifndef IMPORT1_H +#define IMPORT1_H +#ifdef BUG +#error Should not happen +#endif +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/import2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/import2.c new file mode 100644 index 000000000..99b987551 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/import2.c @@ -0,0 +1,11 @@ +/* Copyright (C) 2003, 2008 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-Wno-deprecated" } */ + +/* This tests that the file is only included once + Neil Booth, 2 August 2003. */ + +#include "import2.h" +#import "import2.h" +#include "import2.h" diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/import2.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/import2.h new file mode 100644 index 000000000..c6a0fa597 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/import2.h @@ -0,0 +1,4 @@ +#ifdef BUG +#error Should not happen! +#endif +#define BUG diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/inc/foo.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/inc/foo.h new file mode 100644 index 000000000..ec770476c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/inc/foo.h @@ -0,0 +1 @@ +extern int a; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/inc/pr20348-aux.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/inc/pr20348-aux.h new file mode 100644 index 000000000..1f04c7569 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/inc/pr20348-aux.h @@ -0,0 +1 @@ +#include "pr20348.h" diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/inc/pr20348.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/inc/pr20348.h new file mode 100644 index 000000000..810bb36d7 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/inc/pr20348.h @@ -0,0 +1,9 @@ +#ifndef MIDDLE +# ifndef INC_PR20348_H_SEEN +# define INC_PR20348_H_SEEN +# else +# error inc/pr20348.h included twice before MIDDLE definition +# endif +#else +# error inc/pr20348.h included after MIDDLE definition +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/inc/pr20356-aux.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/inc/pr20356-aux.h new file mode 100644 index 000000000..3f4a67f8e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/inc/pr20356-aux.h @@ -0,0 +1 @@ +#include "pr20356.h" diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/inc/pr20356.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/inc/pr20356.h new file mode 100644 index 000000000..582925739 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/inc/pr20356.h @@ -0,0 +1,6 @@ +#ifndef INC_PR20356_H +# define INC_PR20356_H +#endif +#ifndef PR20356_H +# include_next <pr20356.h> +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/inc/pragma-once-1a.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/inc/pragma-once-1a.h new file mode 100644 index 000000000..7de641216 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/inc/pragma-once-1a.h @@ -0,0 +1,6 @@ +#ifndef _A_H_ +#define _A_H_ + +#include "../pragma-once-1b.h" + +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/include1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/include1.c new file mode 100644 index 000000000..a0a54e005 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/include1.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Tests that "#include MACRO" works. */ + +/* Source: Neil Booth, 29 Oct 2000. */ + +#define MACRO "mi1c.h" +#include MACRO +#ifndef CPP_MIC_H +#error #include MACRO does not work +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/include2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/include2.c new file mode 100644 index 000000000..de34255ec --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/include2.c @@ -0,0 +1,15 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Tests that #include does not allow the terminating '>' or '"' to be + escaped, as per the standard. */ + +/* Source: Neil Booth, 4 Nov 2000. */ + +#include <silly\>> /* { dg-error "extra tokens" "" } */ + +/* These error is No such file or directory, just once. However, this + message is locale-dependent, so don't test for it. */ +/* { dg-error "silly" "" { target *-*-* } 0 } */ +/* { dg-message "terminated" "" { target *-*-* } 0 } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/include2a.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/include2a.c new file mode 100644 index 000000000..9370d0944 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/include2a.c @@ -0,0 +1,16 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Tests that #include does not allow the terminating '>' or '"' to be + escaped, as per the standard. */ + +/* Source: Neil Booth, 4 Nov 2000. */ + +#include "silly\"" /* { dg-error "extra tokens" "" } */ + +/* These error is No such file or directory, just once. However, this + message is locale-dependent, so don't test for it. */ +/* { dg-error "silly" "silly" { target *-*-* } 0 } */ +/* { dg-error "missing" "missing" { target *-*-* } 0 } */ +/* { dg-message "terminated" "terminated" { target *-*-* } 0 } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/include3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/include3.c new file mode 100644 index 000000000..8bea2b78e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/include3.c @@ -0,0 +1,7 @@ +/* Unpatched, this file would include "inc/ foo.h" (note the space) */ + +#define PREINC_XSTR(str) #str +#define PREINC_STR(str) PREINC_XSTR(str) +#define COMP_INC(comp,file) PREINC_STR(comp/file) + +#include COMP_INC(inc, foo.h) diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/include4.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/include4.c new file mode 100644 index 000000000..d5e7fee88 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/include4.c @@ -0,0 +1,14 @@ +/* Preprocessing tokens are always formed according to a greedy algorithm, + so "#include <stddef.h" must be interpreted as a sequence of tokens, + of which the "h" then gets macro expanded. Likewise the other + examples. */ + +#define h h> +#include <stddef.h +#undef h + +#define foo stddef.h> +#include <foo + +#include <foo /* +> */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/include5.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/include5.c new file mode 100644 index 000000000..9bbc2878d --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/include5.c @@ -0,0 +1,9 @@ +/* Test #include directives with macros expanding to empty. */ + +#define EMPTY_OBJ +#define EMPTY_FUNC() + +#include <stddef.h> EMPTY_OBJ +#include <stddef.h> EMPTY_FUNC() +#include "stddef.h" EMPTY_OBJ +#include "stddef.h" EMPTY_FUNC() diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/include6.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/include6.c new file mode 100644 index 000000000..c76a3fe71 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/include6.c @@ -0,0 +1,14 @@ +/* { dg-do preprocess } */ +/* { dg-options "-std=gnu99" } */ + +#include <stddef.h> +#include "stddef.h" +#include L"stddef.h" /* { dg-error "include expects" } */ +#include u"stddef.h" /* { dg-error "include expects" } */ +#include U"stddef.h" /* { dg-error "include expects" } */ +#include u8"stddef.h" /* { dg-error "include expects" } */ +#include R"(stddef.h)" /* { dg-error "include expects" } */ +#include LR"(stddef.h)" /* { dg-error "include expects" } */ +#include uR"(stddef.h)" /* { dg-error "include expects" } */ +#include UR"(stddef.h)" /* { dg-error "include expects" } */ +#include u8R"(stddef.h)" /* { dg-error "include expects" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/include7.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/include7.c new file mode 100644 index 000000000..0e95601f7 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/include7.c @@ -0,0 +1,3 @@ +/* { dg-do compile } */ +/* { dg-options "-I \"\"" } */ + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/isysroot-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/isysroot-1.c new file mode 100644 index 000000000..7263ce415 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/isysroot-1.c @@ -0,0 +1,10 @@ +/* { dg-options "-isysroot ${srcdir}/gcc.dg/cpp" } */ +/* { dg-do compile { target *-*-darwin* } } */ + +#include <stdio.h> +int main() +{ + /* Special stdio.h supplies function foo. */ + void (*x)(void) = foo; + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/isysroot-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/isysroot-2.c new file mode 100644 index 000000000..346d4093c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/isysroot-2.c @@ -0,0 +1,10 @@ +/* { dg-options "-isysroot ${srcdir}/gcc.dg/cpp" } */ +/* { dg-do compile { target *-*-darwin* } } */ + +#include <Carbon/Carbon.h> +int main() +{ + /* Special Carbon.h supplies function foo. */ + void (*x)(void) = foo; + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/lexident.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/lexident.c new file mode 100644 index 000000000..fdf54a2e2 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/lexident.c @@ -0,0 +1,25 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-trigraphs -fdollars-in-identifiers" } */ + +/* Test lexing of identifiers. */ + +/* Escaped newlines, _ and $ in identifiers. */ +#def\ +\ +ine foo_ + +#d\ +ef??/ +in\ +e b\ +a$r + +#ifndef foo_ +#error foo_ +#endif + +#ifndef ba$r +#error ba$r +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/lexnum.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/lexnum.c new file mode 100644 index 000000000..7df155408 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/lexnum.c @@ -0,0 +1,50 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do run } */ +/* { dg-options "-trigraphs" } */ + +/* Test lexing of numbers. */ + +extern int puts (const char *); +extern void abort (void); +#define err(str) do { puts(str); abort(); } while (0) + +/* Escaped newlines. */ +#define foo 12\ +3\ +\ +4??/ +5 + +#if foo != 12345 +#error foo +#endif + +int main (int argc, char *argv[]) +{ + double a = 5.; + double x = .5; + +/* Decimal points, including initially and immediately before and + after an escaped newline. */ + if (a != 5) + err ("a"); + if (x != .\ +5) + err ("x != .5"); + x = 25\ +.\ +6; + if (x != 25.6) + err ("x != 25.6"); + + /* Test exponentials and their signs. A buggy lexer is more likely + to fail the compile, but never mind. */ + if (250 != 25e+1 || 250 != 25e1 || 250 != 2500e-1) + err ("exponentials"); + + /* Todo: p exponentials, and how to test preprocessing number + tokenisation? */ + + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/lexstrng.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/lexstrng.c new file mode 100644 index 000000000..b03533003 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/lexstrng.c @@ -0,0 +1,67 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do run } */ +/* { dg-options "-trigraphs" } */ + +/* Test lexing of strings and character constants. */ + +#ifndef __WCHAR_TYPE__ +#define __WCHAR_TYPE__ int +#endif +typedef __WCHAR_TYPE__ wchar_t; + +extern int strcmp (const char *, const char *); +extern int puts (const char *); +extern void abort (void); +#define err(str) do { puts(str); abort(); } while (0) + +/* Escaped newlines. */ +const char *str1 = "s\ +t\ +\ +r??/ + 1"; + +const char x = '\ +??/ +b'; + +/* Test escaped terminators. */ +const char *term = "\"\\\"\\"; +const char termc = '\''; +const char *terms = "'"; + +/* Test wide strings and chars are lexed. */ +const wchar_t wchar = L'w'; +const wchar_t* wstring = L"wide string"; + +/* Test all 9 trigraphs embedded in a string. Test trigraphs do not + survive an embedded backslash newline. Test trigraphs preceded by + a '?' are still noticed. */ +const char *t = "??/\??<??>??=??)??\ +(??(??!??'??-???=???/ +?-"; + +int main (int argc, char *argv[]) +{ + if (strcmp (str1, "str 1")) + err ("str1"); + + if (x != 'b') + err ("b"); + + /* We have to split the string up to avoid trigraph replacement + here. Split the 2 trigraphs after both 1 and 2 ?s; just doing + this exposed a bug in the initial release of the tokenized lexer. */ + if (strcmp (t, "\\{}#]?" "?([|^~?#??" "-")) + err ("Embedded trigraphs"); + + if (term[0] != '"' || term[1] != '\\' || term[2] != '"' + || term[3] != '\\' || term[4] != '\0') + err ("Escaped string terminators"); + + if (termc != terms[0]) + err ("Escaped character constant terminator"); + + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/line1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/line1.c new file mode 100644 index 000000000..b13c1229d --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/line1.c @@ -0,0 +1,12 @@ +/* Copyright (C) 2000, 2003 Free Software Foundation. + + by Alexandre Oliva <oliva@lsd.ic.unicamp.br> */ + +/* { dg-do preprocess } */ + +/* The line number below must be just a few lines greater than the + actual line number. */ +#line 10 "baz" +wibble + +/* { dg-final { scan-file line1.i baz } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/line2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/line2.c new file mode 100644 index 000000000..5ee0e04be --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/line2.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2000 Free Software Foundation. + + by Alexandre Oliva <oliva@lsd.ic.unicamp.br> */ + +/* { dg-do preprocess } */ + +#line 1 +#line 0 +#line 2 +#line 32768 + +/* { dg-error "out of range" "line # too low" { target *-*-* } 1 } */ +/* { dg-error "out of range" "line # too high" { target *-*-* } 2 } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/line3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/line3.c new file mode 100644 index 000000000..4b40e4a6a --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/line3.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-Wwrite-strings" } */ +/* The purpose of this test is to ensure that line numbers in diagnostics + are accurate after macros whose arguments contain newlines and are + substituted multiple times. The semicolons are on separate lines because + #line can only correct numbering on line boundaries. */ +#define one(x) x +#define two(x) x x +#define four(x) two(x) two(x) + +int +main(void) +{ + char *A; + + A = "text"; /* { dg-warning "discards 'const' qualifier" "case zero" } */ + A = one("text" /* { dg-warning "discards 'const' qualifier" "case one" } */ + "text") + ; + A = two("text" /* { dg-warning "discards 'const' qualifier" "case two" } */ + "text") + ; + A = four("text" /* { dg-warning "discards 'const' qualifier" "case four" } */ + "text") + ; + + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/line4.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/line4.c new file mode 100644 index 000000000..84dbf9623 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/line4.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ + +/* Test #line with and without macros for the line number. */ + +extern void abort (void); + +#define L 90 + +#line 44 +enum { i = __LINE__ }; + +#line L +enum { j = __LINE__ }; + +#line 16 /* N.B. the _next_ line is line 16. */ + +char array1[i == 44 ? 1 : -1]; +char array2[j == 90 ? 1 : -1]; +char array3[__LINE__ == 19 ? 1 : -1]; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/line5.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/line5.c new file mode 100644 index 000000000..4cad6a171 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/line5.c @@ -0,0 +1,15 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-fpreprocessed" } */ + +/* Source: Neil Booth, 16 Sep 2001. + + This file, with an indented line marker, is not possible without + user editing of preprocessed output, or the user using + -fpreprocessed on raw source. Nevertheless, we should not + segfault. This is a test that we don't back up two tokens in + cpplib.c - one to back up over the number, and one when we + recognize that it's not a valid directive in preprocessed input. */ + + # 1 "foo.c" diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/line6.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/line6.c new file mode 100644 index 000000000..c59ea3af7 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/line6.c @@ -0,0 +1,7 @@ +/* PR 28079 */ +/* { dg-do preprocess } */ +/* { dg-options "" } */ + +#line 18446744073709551616 /* { dg-warning "line number out of range" } */ + +#line 12312312312435 /* { dg-warning "line number out of range" "" { target *-*-* } 0 } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/line7.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/line7.c new file mode 100644 index 000000000..754727e88 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/line7.c @@ -0,0 +1,19 @@ +/* Test #line syntax, including macro expansion and empty macros. PR + 39647. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=c99 -pedantic-errors" } */ + +#define EMPTY_OBJ +#define EMPTY_FUNC() + +#define A 12 "line7.c" +#line A + +#line EMPTY_OBJ /* { dg-error "unexpected end of file" } */ +#line X /* { dg-error "is not a positive integer" } */ +#line 16 16 /* { dg-error "is not a valid filename" } */ + +#line 18 "line7.c" EMPTY_OBJ +#line 19 "line7.c" EMPTY_FUNC() +#line 20 "line7.c" foo /* { dg-error "extra tokens at end" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/line8.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/line8.c new file mode 100644 index 000000000..5aeb26ca3 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/line8.c @@ -0,0 +1,10 @@ +/* Test that "" is not specially interpreted as "<stdin>" in a #line + directive. PR 39646. */ + +/* { dg-do compile } */ +/* { dg-options "-pedantic-errors" } */ + +extern int x; + +#line 24 "" +extern char z[sizeof __FILE__ == 1]; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mac-dir-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mac-dir-1.c new file mode 100644 index 000000000..002c47f5f --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mac-dir-1.c @@ -0,0 +1,34 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Source: Neil Booth, 26 Feb 2002. + + Test that we allow directives in macro arguments. */ + +/* { dg-do run } */ +/* { dg-options "" } */ + +#define f(x) x +extern void abort (void); + +int main () +{ + if (f ( +#if f(1) /* True. */ + 0)) /* False. */ +#else + 1)) +#endif + abort (); + + /* Outer f expands to original definition, f in argument expands + to new definition, so result is: if (1 != 2 - 1). */ + if (1 != f(2 +#undef f +#define f - 1 + f)) + abort (); + + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mac-dir-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mac-dir-2.c new file mode 100644 index 000000000..b31ab3bee --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mac-dir-2.c @@ -0,0 +1,16 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Source: Neil Booth, 26 Feb 2002. + + Test that we allow directives in macro arguments. */ + +/* { dg-do preprocess } */ + +#define f(x) x + +f ( +#if 1 /* { dg-error "not portable" } */ +1) +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mac-eol-at-eof.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mac-eol-at-eof.c new file mode 100644 index 000000000..6b0a279dc --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mac-eol-at-eof.c @@ -0,0 +1 @@ +/* Test no newline at eof warning when Mac line ending is used*/
/* { dg-do compile } */
int main() { return 0; }
\ No newline at end of file diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/maccom1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/maccom1.c new file mode 100644 index 000000000..2e01911c6 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/maccom1.c @@ -0,0 +1,14 @@ +/* { dg-do preprocess } */ +/* { dg-options "-CC" } */ + +/* This tests to make sure that comments are ignored between # and the + directive name when the -CC option is used. + + Jason R. Thorpe, 6 Apr 2002 */ + +#/**/define def passed + +def + +/* { dg-final { scan-file maccom1.i "(^|\\n)passed" } } */ + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/maccom2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/maccom2.c new file mode 100644 index 000000000..a448082e5 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/maccom2.c @@ -0,0 +1,14 @@ +/* { dg-do preprocess } */ +/* { dg-options "-CC" } */ + +/* This tests to make sure that comments between the #define directive + and the macro identifier are ignored (i.e. treated like whitespace) + when the -CC option is used. + + Jason R. Thorpe, 6 Apr 2002 */ + +#define/**/def passed + +def + +/* { dg-final { scan-file maccom2.i "(^|\n)passed" } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/maccom3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/maccom3.c new file mode 100644 index 000000000..580c52c06 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/maccom3.c @@ -0,0 +1,13 @@ +/* { dg-do preprocess } */ +/* { dg-options "-CC" } */ + +/* This tests to make sure that comments in the definition of a macro + parameter list are ignored when the -CC option is used. + + Jason R. Thorpe, 6 Apr 2002 */ + +#define def(x /**/, y) passed + +def(x,y) + +/* { dg-final { scan-file maccom3.i "(^|\n)passed" } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/maccom4.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/maccom4.c new file mode 100644 index 000000000..54806c154 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/maccom4.c @@ -0,0 +1,17 @@ +/* { dg-do preprocess } */ +/* { dg-options "-CC" } */ + +/* This tests to make sure the comment is saved in the macro and copied + to the output file when the macro is expanded when the -CC option is + used. + + Jason R. Thorpe, 6 Apr 2002 */ + +#define def /* passed */ + +def + +/* + /* The + in the regexp prevents it from matching itself. */ + { dg-final { scan-file maccom4.i "p+assed" } } +*/ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/maccom5.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/maccom5.c new file mode 100644 index 000000000..b01a045e0 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/maccom5.c @@ -0,0 +1,18 @@ +/* { dg-do preprocess } */ +/* { dg-options "-CC" } */ + +/* This tests to make sure that C++ comments are converted to C comments + when saved in the macro and copied to the output file when the macro + is expanded when the -CC option is used. + + Jason R. Thorpe, 6 Apr 2002 */ + +#define def // passed + +def: + +/* + /* The + in the regexp prevents it from matching itself. */ + { dg-final { scan-file maccom5.i "p+assed" } } + { dg-final { scan-file-not maccom5.i "p+assed:" } } +*/ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/maccom6.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/maccom6.c new file mode 100644 index 000000000..09ca87d4e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/maccom6.c @@ -0,0 +1,20 @@ +/* { dg-do preprocess } */ +/* { dg-options "-CC" } */ + +/* This tests to make sure that expressions function properly + when used with macros containing comments and the -CC option + is being used. + + Jason R. Thorpe, 6 Apr 2002 */ + +#define ONE 1 /* one */ +#define TWO 2 /* two */ +#define THREE 3 /* three */ + +#if (ONE + TWO) != THREE +failed +#else +passed +#endif + +/* { dg-final { scan-file maccom6.i "(^|\n)passed" } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-1.c new file mode 100644 index 000000000..28ef7955c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-1.c @@ -0,0 +1,19 @@ +/* + { dg-options "-ftrack-macro-expansion=1" } + { dg-do compile } +*/ + +#define OPERATE(OPRD1, OPRT, OPRD2) \ +do \ +{ \ + OPRD1 OPRT OPRD2; /* { dg-message "definition" }*/ \ +} while (0) + +#define SHIFTL(A,B) \ + OPERATE (A,<<,B) /* { dg-error "invalid operands" } */ + +void +foo () +{ + SHIFTL (0.1,0.2); /* { dg-message "in expansion of macro \[^\n\r\]SHIFTL" } */ +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-2.c new file mode 100644 index 000000000..2367765cc --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-2.c @@ -0,0 +1,20 @@ +/* + { dg-options "-ftrack-macro-expansion=1" } + { dg-do compile } +*/ + +#define OPERATE(OPRD1, OPRT, OPRD2) \ + OPRD1 OPRT OPRD2; /* { dg-message "in definition of macro 'OPERATE'" } */ + +#define SHIFTL(A,B) \ + OPERATE (A,<<,B) /* { dg-message "invalid operands to binary <<" } */ + +#define MULT(A) \ + SHIFTL (A,1) /* { dg-message "in expansion of macro 'SHIFTL'" } */ + +void +foo () +{ + MULT (1.0); /* { dg-message "in expansion of macro 'MULT'" } */ +} + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-3.c new file mode 100644 index 000000000..b47726d6b --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-3.c @@ -0,0 +1,12 @@ +/* + { dg-options "-fshow-column -ftrack-macro-expansion=1" } + { dg-do compile } + */ + +#define SQUARE(A) A * A /* { dg-message "in definition of macro 'SQUARE'" } */ + +void +foo() +{ + SQUARE (1 << 0.1); /* { dg-error "16:invalid operands to binary <<" } */ +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-4.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-4.c new file mode 100644 index 000000000..401b846cc --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-4.c @@ -0,0 +1,13 @@ +/* + { dg-options "-fshow-column -ftrack-macro-expansion=2" } + { dg-do compile } + */ + +#define SQUARE(A) A * A /* { dg-message "in definition of macro 'SQUARE'" } */ + +void +foo() +{ + SQUARE (1 << 0.1); /* { dg-message "13:invalid operands to binary <<" } */ +} + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-5.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-5.c new file mode 100644 index 000000000..abe456ceb --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro-exp-tracking-5.c @@ -0,0 +1,18 @@ +/* + { dg-options "-fshow-column -ftrack-macro-expansion" } + { dg-do compile } + */ + +#define PASTED var ## iable /* { dg-error "'variable' undeclared" } */ +#define call_foo(p1, p2) \ + foo (p1, \ + p2); /* { dg-message "in definition of macro 'call_foo'" } */ + +void foo(int, char); + +void +bar() +{ + call_foo(1,PASTED); /* { dg-message "in expansion of macro 'PASTED'" } */ +} + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro1.c new file mode 100644 index 000000000..e7235f577 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro1.c @@ -0,0 +1,128 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do run } */ + +/* Tests various macro abuse is correctly expanded. */ + +extern int puts (const char *); +extern void abort (void); +extern int strcmp(const char *s1, const char *s2); + +#define err(str) do { puts(str); abort(); } while (0) +#define j(x, y) x + y +#define k(x, y) j(x + 2, y + +#define glue(x, y) x ## y +#define xglue(x, y) glue(x, y) + +/* Functions called when macros are left unexpanded. */ +int q(int x) {return x + 40;} +int B(int x) {return x + 20;} +int foo(int x) {return x + 10;} +int bar(int x, int y) {return x + y;} +int baz(int x, int y) {return x + y;} +int toupper(int x) {return x + 32;} +int M(int x) {return x * 2;} + +int main (int argc, char *argv[]) +{ +#define q(x) x + if (q(q)(2) != 42) + err ("q"); + +#define A(x) B(x) + if (A(A(2)) != 42) + err ("A"); + +#define E(x) A x +#define F (22) + if (E(F) != 42) + err ("E(F)"); + +#define COMMA , +#define NASTY(a) j(a 37) + if (NASTY (5 COMMA) != 42) + err ("NASTY"); + +#define bar(x, y) foo(x(y, 0)) +#define apply(x, y) foo(x(y, 22)) +#define bam bar + if (bar(bar, 32) != 42) /* foo(bar(32, 0)). */ + err ("bar bar"); + if (bar(bam, 32) != 42) /* Same. */ + err ("bar bam"); + if (apply(bar, baz) != 42) /* foo(foo(baz(22, 0))). */ + err ("apply bar baz"); + + /* Taken from glibc. */ +#define __tobody(c, f) f (c) +#define toupper(c) __tobody (c, toupper) + if (toupper (10) != 42) /* toupper (10). */ + err ("toupper"); + + /* This tests that M gets expanded the right no. of times. Too many + times, and we get excess "2 +"s and the wrong sum. Derived from + nested stpcpy in dggettext.c. */ +#define M(x) 2 + M(x) +#define stpcpy(a) M(a) + if (stpcpy (stpcpy (9)) != 42) /* 2 + M (2 + M (9)) */ + err ("stpcpy"); + + /* Another test derived from nested stpcpy's of dggettext.c. Uses + macro A(x) and function B(x) as defined above. The problem was + the same - excess "1 +"s and the wrong sum. */ +#define B(x) 1 + B(x) +#define C(x) A(x) + if (C(B(0)) != 42) /* 1 + B (1 + B (0)) */ + err ("C"); + + /* More tests derived from gcc itself - the use of XEXP and COST. + These first two should both expand to the same thing. */ + { + int insn = 6, i = 2, b = 2; +#define XEXP(RTX, N) (RTX * N + 2) +#define PATTERN(INSN) XEXP(INSN, 3) + if (XEXP (PATTERN (insn), i) != 42) /* ((insn * 3 + 2) * i + 2) */ + err ("XEXP (PATTERN)"); + if (XEXP (XEXP (insn, 3), i) != 42) /* ((insn * 3 + 2) * i + 2) */ + err ("XEXP (XEXP)"); + +#define COST(X) XEXP (XEXP (X, 4), 4) + if (COST (b) != 42) /* ((b * 4 + 2) * 4 + 2) */ + err ("COST"); + } + + /* This tests macro recursion and expand-after-paste. */ +#define FORTYTWO "forty" +#define TWO TWO "-two" + if (strcmp (glue(FORTY, TWO), "forty")) + err ("glue"); + if (strcmp (xglue(FORTY, TWO), "forty-two")) + err ("xglue"); + + /* Test ability to call macro over multiple logical lines. */ + if (q + (42) != 42 + || q ( + 42) != 42 + || q (42 + ) != 42 + || q + ( + 42 + ) + != 42) + err ("q over multiple lines"); + + /* Corner case. Test that macro expansion is turned off for later + q, when not at start but at end of argument context, and supplied + with the '(' necessary for expansion. */ + if (q(1 + q)(1) != 42) /* 1 + q(1) */ + err ("Nested q"); + + /* This looks like it has too many ')', but it hasn't. */ + if (k(1, 4) 35) != 42) + err ("k"); + + /* Phew! */ + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro10.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro10.c new file mode 100644 index 000000000..20d4911e6 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro10.c @@ -0,0 +1,25 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Source: Neil Booth, 23 Sep 2001. + + A tricky, pathological corner case we used to get wrong. Expansion + should go as follows. The asterisk indicates the token has "blue + paint" can no longer be macro expanded. We used to lose that + information when parsing arguments and dropping to the lexer to get + the ')'. + + foo ) + bar foo* ) + func (foo* ) + foo* + + If we try and expand the final foo, we get an "unterminated + argument list invoking macro <func>" error. If we do the right + thing and leave it as is, no diagnostics are emitted. */ + +#define func(x) x +#define bar func( +#define foo bar foo +foo ) diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro11.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro11.c new file mode 100644 index 000000000..b131223b9 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro11.c @@ -0,0 +1,16 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Source: Neil Booth, 2 Oct 2001. + + Tests that we clear the disabled flag that is set by the + macro-defined-to-itself optimization (the optimization might not be + worth it). */ + +#define foo foo +#undef foo +#define foo 1 +#if !foo +#error foo still disabled! +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro2.c new file mode 100644 index 000000000..2265a2b4c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro2.c @@ -0,0 +1,14 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Tests the argument context get set at the lower level if we drop + contexts whilst parsing arguments. This would enter an infinite + loop in is_macro_disabled previously. */ + +#define A Something +#define B C +#define C K( +#define K(S) S +#define T B A ) +T /* Expands to <Something>. */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro3.c new file mode 100644 index 000000000..e6a5ffc1e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro3.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-options "-std=c99" } */ + +/* First two tests sourced from a bug report of Thomas Pornin. + Varargs test source Jamie Lokier. + All adapted for the testsuite by Neil Booth, Oct 2000. */ + +/* Tests various macro abuse is correctly expanded. */ +static int d = 4; +#define c(x) d +#define d(x) c(2) + +#if 0 +/* This macro chain above sucks up the whole file once it starts, so + I've commented it out. The example is left for idle amusement :-) */ +#define a(x) b( +#define b(x) a( +#endif + +#define apply(...) apply2 (__VA_ARGS__) +#define half(x) ((x) / 2) +#define apply2(f,x) f (x) + +extern void abort (void); +extern void exit (int); + +int main() +{ + /* Expands to c(2) then d. */ + if (c(c)(c) != 4) + abort (); + + if (apply (half, 200) != 100) + abort (); + + exit (0); +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro4.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro4.c new file mode 100644 index 000000000..ceaf8ddbf --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro4.c @@ -0,0 +1,13 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Test source Neil Booth. */ + +#define glue(x, y) x ## y +#define xglue(x, y) glue (x, y) + +/* Should expand to glue (1, 2), then 12. */ +#if glue (xgl, ue) (1, 2) != 12 +#error glue macro +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro5.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro5.c new file mode 100644 index 000000000..9e226b871 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro5.c @@ -0,0 +1,24 @@ +/* { dg-do preprocess } */ + +/* Test source Robert Lipe, with minor modifications for the testsuite + by Neil Booth. 29 Oct 2000. */ + +#define _VA_ARGS_0() 42 +#define _L_0() ( +#define _R_0() ) + +#define __VA_ARGLIST(argc,list) \ + _VA_ARGS_##argc list + +#define _CAT_LIST(argc,list1,list2) \ + _L_##argc list1 _R_##argc list2 + +#define _VA_ARGLIST(argc,list1,list2) \ + __VA_ARGLIST(argc, \ + _CAT_LIST(argc, list1, list2)) + +#define BLAH(a) _VA_ARGLIST(a, (), ()) + +#if BLAH (0) != 42 +#error Simulated varargs macros +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro6.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro6.c new file mode 100644 index 000000000..0fe52ee43 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro6.c @@ -0,0 +1,32 @@ +/* { dg-do run } */ + +/* Test that, when a macro expansion spills into the source file, we + expand macros we suck in from there, as the standard clearly states + they are not nested. + + Submitter: Neil Booth, with minor modifications to the originals. 3 + Dec 2000. + Source: PR 962 and Thomas Pornin. */ + +extern void abort (void); +int e = 10, f = 100; + +#define e(n) 4 + n +#define X e +#define f(x) x +#define h(x) x + f + +int +main () +{ + if (X(X) != 14) /* Should expand to "4 + e". */ + abort (); + + if (X(X(f)) != 108) /* Should expand to "4 + 4 + f". */ + abort (); + + if (h(e)(h(e)) != 120) /* Should expand to "e + e + f". */ + abort (); + + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro7.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro7.c new file mode 100644 index 000000000..6f2c67c10 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro7.c @@ -0,0 +1,10 @@ +/* { dg-do preprocess } */ + +/* Test we don't complain about directives in macro expansions when + looking for the '(' of a function-like macro. + + Submitter: Neil Booth. 3 Mar 2000. */ + +#define f(x) x +f +#define g diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro8.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro8.c new file mode 100644 index 000000000..f49b0be9e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro8.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options -std=gnu89 } */ + +/* GCC 2.95.2 used to get the following variable argument macro + expansions wrong. + + Source: Neil Booth, from PR 3852 with persmission. 31 Jul 2001. */ + +#define TEST_WORSE(args...) (5, ## args) +#define TEST_BAD(foo, args...) (2, (foo), ## args) + +extern void abort (); + +static int add (int a, int b) +{ + return a + b; +} + +int main () +{ + /* Would expand to a single closing parenthesis, maybe because of + the "no args requires space" brokenness. */ + if (TEST_WORSE () != 5) + abort (); + /* The macro would expand to (0, (0) with a missing closing parenthesis. */ + if (add TEST_BAD (5) != 7) + abort (); + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro9.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro9.c new file mode 100644 index 000000000..ef9e3697e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macro9.c @@ -0,0 +1,14 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ + +/* Source: Neil Booth, 15 Sep 2001. + + A silly test to check that if a function-like macro name is + immediately followed by a directive, then we process the directive + properly. */ + +#define main() +int main +#define mainbody () { return 0; } +mainbody diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macspace1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macspace1.c new file mode 100644 index 000000000..d8578448b --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macspace1.c @@ -0,0 +1,63 @@ +/* PR preprocessor/19475 */ +/* { dg-do preprocess } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +#define a! /* { dg-warning "missing whitespace" } */ +#define b" /* { dg-warning "missing whitespace" } */ +#define c# /* { dg-warning "missing whitespace" } */ +#define d% /* { dg-warning "missing whitespace" } */ +#define e& /* { dg-warning "missing whitespace" } */ +#define f' /* { dg-warning "missing whitespace" } */ +#define g) /* { dg-warning "missing whitespace" } */ +#define h* /* { dg-warning "missing whitespace" } */ +#define i+ /* { dg-warning "missing whitespace" } */ +#define j, /* { dg-warning "missing whitespace" } */ +#define k- /* { dg-warning "missing whitespace" } */ +#define l. /* { dg-warning "missing whitespace" } */ +#define m/ /* { dg-warning "missing whitespace" } */ +#define n: /* { dg-warning "missing whitespace" } */ +#define o; /* { dg-warning "missing whitespace" } */ +#define p< /* { dg-warning "missing whitespace" } */ +#define q= /* { dg-warning "missing whitespace" } */ +#define r> /* { dg-warning "missing whitespace" } */ +#define s? /* { dg-warning "missing whitespace" } */ +#define t[ /* { dg-warning "missing whitespace" } */ +#define u] /* { dg-warning "missing whitespace" } */ +#define v^ /* { dg-warning "missing whitespace" } */ +#define w{ /* { dg-warning "missing whitespace" } */ +#define x| /* { dg-warning "missing whitespace" } */ +#define y} /* { dg-warning "missing whitespace" } */ +#define z~ /* { dg-warning "missing whitespace" } */ +#define A>> /* { dg-warning "missing whitespace" } */ +#define B<< /* { dg-warning "missing whitespace" } */ +#define E&& /* { dg-warning "missing whitespace" } */ +#define F|| /* { dg-warning "missing whitespace" } */ +#define G== /* { dg-warning "missing whitespace" } */ +#define H!= /* { dg-warning "missing whitespace" } */ +#define I>= /* { dg-warning "missing whitespace" } */ +#define J<= /* { dg-warning "missing whitespace" } */ +#define K+= /* { dg-warning "missing whitespace" } */ +#define L-= /* { dg-warning "missing whitespace" } */ +#define M*= /* { dg-warning "missing whitespace" } */ +#define N/= /* { dg-warning "missing whitespace" } */ +#define O%= /* { dg-warning "missing whitespace" } */ +#define P&= /* { dg-warning "missing whitespace" } */ +#define Q|= /* { dg-warning "missing whitespace" } */ +#define R^= /* { dg-warning "missing whitespace" } */ +#define S>>= /* { dg-warning "missing whitespace" } */ +#define T<<= /* { dg-warning "missing whitespace" } */ +#define W... /* { dg-warning "missing whitespace" } */ +#define X++ /* { dg-warning "missing whitespace" } */ +#define Y-- /* { dg-warning "missing whitespace" } */ +#define Z-> /* { dg-warning "missing whitespace" } */ +#define aa:: /* { dg-warning "missing whitespace" } */ +#define ab->* /* { dg-warning "missing whitespace" } */ +#define ac.* /* { dg-warning "missing whitespace" } */ +#define ad\x /* { dg-warning "missing whitespace" } */ +#define ae\\x /* { dg-warning "missing whitespace" } */ +#define af'1' /* { dg-warning "missing whitespace" } */ +#define ag"abc" /* { dg-warning "missing whitespace" } */ + +int dummy; +/* { dg-error "missing terminating" "" { target *-*-* } 6 } */ +/* { dg-error "missing terminating" "" { target *-*-* } 10 } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macspace2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macspace2.c new file mode 100644 index 000000000..6e6be96b1 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macspace2.c @@ -0,0 +1,63 @@ +/* PR preprocessor/19475 */ +/* { dg-do preprocess } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +#define a! /* { dg-error "requires whitespace" } */ +#define b" /* { dg-error "requires whitespace" } */ +#define c# /* { dg-error "requires whitespace" } */ +#define d% /* { dg-error "requires whitespace" } */ +#define e& /* { dg-error "requires whitespace" } */ +#define f' /* { dg-error "requires whitespace" } */ +#define g) /* { dg-error "requires whitespace" } */ +#define h* /* { dg-error "requires whitespace" } */ +#define i+ /* { dg-error "requires whitespace" } */ +#define j, /* { dg-error "requires whitespace" } */ +#define k- /* { dg-error "requires whitespace" } */ +#define l. /* { dg-error "requires whitespace" } */ +#define m/ /* { dg-error "requires whitespace" } */ +#define n: /* { dg-error "requires whitespace" } */ +#define o; /* { dg-error "requires whitespace" } */ +#define p< /* { dg-error "requires whitespace" } */ +#define q= /* { dg-error "requires whitespace" } */ +#define r> /* { dg-error "requires whitespace" } */ +#define s? /* { dg-error "requires whitespace" } */ +#define t[ /* { dg-error "requires whitespace" } */ +#define u] /* { dg-error "requires whitespace" } */ +#define v^ /* { dg-error "requires whitespace" } */ +#define w{ /* { dg-error "requires whitespace" } */ +#define x| /* { dg-error "requires whitespace" } */ +#define y} /* { dg-error "requires whitespace" } */ +#define z~ /* { dg-error "requires whitespace" } */ +#define A>> /* { dg-error "requires whitespace" } */ +#define B<< /* { dg-error "requires whitespace" } */ +#define E&& /* { dg-error "requires whitespace" } */ +#define F|| /* { dg-error "requires whitespace" } */ +#define G== /* { dg-error "requires whitespace" } */ +#define H!= /* { dg-error "requires whitespace" } */ +#define I>= /* { dg-error "requires whitespace" } */ +#define J<= /* { dg-error "requires whitespace" } */ +#define K+= /* { dg-error "requires whitespace" } */ +#define L-= /* { dg-error "requires whitespace" } */ +#define M*= /* { dg-error "requires whitespace" } */ +#define N/= /* { dg-error "requires whitespace" } */ +#define O%= /* { dg-error "requires whitespace" } */ +#define P&= /* { dg-error "requires whitespace" } */ +#define Q|= /* { dg-error "requires whitespace" } */ +#define R^= /* { dg-error "requires whitespace" } */ +#define S>>= /* { dg-error "requires whitespace" } */ +#define T<<= /* { dg-error "requires whitespace" } */ +#define W... /* { dg-error "requires whitespace" } */ +#define X++ /* { dg-error "requires whitespace" } */ +#define Y-- /* { dg-error "requires whitespace" } */ +#define Z-> /* { dg-error "requires whitespace" } */ +#define aa:: /* { dg-error "requires whitespace" } */ +#define ab->* /* { dg-error "requires whitespace" } */ +#define ac.* /* { dg-error "requires whitespace" } */ +#define ad\x /* { dg-error "requires whitespace" } */ +#define ae\\x /* { dg-error "requires whitespace" } */ +#define af'1' /* { dg-error "requires whitespace" } */ +#define ag"abc" /* { dg-error "requires whitespace" } */ + +int dummy; +/* { dg-error "missing terminating" "missing-terminating" { target *-*-* } 6 } */ +/* { dg-error "missing terminating" "missing-terminating" { target *-*-* } 10 } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macsyntx.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macsyntx.c new file mode 100644 index 000000000..495921efa --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/macsyntx.c @@ -0,0 +1,72 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-pedantic -std=gnu99" } */ + +/* Tests macro syntax, for both definition and invocation, including:- + + o Full range of macro definition semantics. + o No. of arguments supplied to function-like macros. + o Odd GNU rest args behavior. + o Macro arguments do not flow into the rest of the file. */ + + +/* Test basic macro definition syntax. The macros are all called + "foo" deliberately to provoke an (excess) redefinition warning in + case the macros succeed in being entered in the macro hash table + despite being an error. + + Split a couple of the lines to check that the errors appear on the + right line (i.e. are associated with the correct token). */ + +#define ; /* { dg-error "identifier" } */ +#define SEMI; /* { dg-warning "space" } */ +#define foo(X /* { dg-error "missing" } */ +#define foo\ +(X,) /* { dg-error "parameter name" } */ +#define foo(, X) /* { dg-error "parameter name" } */ +#define foo(X, X) /* { dg-error "duplicate" } */ +#define foo(X Y) /* { dg-error "comma" } */ +#define foo(() /* { dg-error "may not appear" } */ +#define foo(..., X) /* { dg-error "missing" } */ +#define foo \ +__VA_ARGS__ /* { dg-warning "__VA_ARGS__" } */ +#define goo(__VA_ARGS__) /* { dg-warning "__VA_ARGS__" } */ +#define hoo(...) __VA_ARGS__ /* OK. */ +#define __VA_ARGS__ /* { dg-warning "__VA_ARGS__" } */ +__VA_ARGS__ /* { dg-warning "__VA_ARGS__" } */ + +/* test # of supplied arguments. */ +#define none() +#define one(x) +#define two(x, y) +#define var0(...) +#define var1(x, ...) +none() /* OK. */ +none(ichi) /* { dg-error "passed 1" } */ +one() /* OK. */ +one(ichi) /* OK. */ +one(ichi\ +, ni) /* { dg-error "passed 2" } */ +two(ichi) /* { dg-error "requires 2" } */ +var0() /* OK. */ +var0(ichi) /* OK. */ +var1() /* { dg-warning "rest arguments to be used" } */ +var1(ichi) /* { dg-warning "rest arguments to be used" } */ +var1(ichi, ni) /* OK. */ + +/* This tests two oddities of GNU rest args - omitting a comma is OK, + and backtracking a token on pasting an empty rest args. */ +#define rest(x, y...) x ## y /* { dg-warning "ISO C" } */ +rest(ichi,) /* OK. */ +rest(ichi) /* { dg-warning "rest arguments to be used" } */ +#if 23 != rest(2, 3) /* OK, no warning. */ +#error 23 != 23 !! +#endif + +/* Test that we don't allow arguments to flow into the rest of the + file. */ +#define half_invocation do_nowt(2 +#define do_nowt(x) x +half_invocation ) /* OK. */ +do_nowt (half_invocation)) /* { dg-error "unterminated argument" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi1.c new file mode 100644 index 000000000..0cfedad2f --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi1.c @@ -0,0 +1,39 @@ +/* Test "ignore redundant include" facility. + + We must test with C and C++ comments, and null directives, outside + the guard conditional; also, we test guarding with #ifndef and #if + !defined. -H is used because cpp might confuse the issue by + optimizing out #line markers. This test only passes if each of the + headers is read exactly once. + + The disgusting regexp in the dg-error line, when stuck into + dg.exp's compiler-output regexp, matches the correct -H output and + only the correct -H output. It has to be all on one line because + otherwise it will not be interpreted all in one unit. */ + +/* { dg-do compile } + { dg-options "-H" } + { dg-message "mi1c\.h\n\[^\n\]*mi1cc\.h\n\[^\n\]*mi1nd\.h\n\[^\n\]*mi1ndp\.h\n\[^\n\]*mi1x\.h" "redundant include check" { target *-*-* } 0 } */ + +#include "mi1c.h" +#include "mi1c.h" +#include "mi1c.h" + +#include "mi1cc.h" +#include "mi1cc.h" + +#include "mi1nd.h" +#include "mi1nd.h" + +#include "mi1ndp.h" +#include "mi1ndp.h" + +#define MIX_H +#include "mi1x.h" +#include "mi1x.h" + +int +main (void) +{ + return a + b + c + d; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi1c.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi1c.h new file mode 100644 index 000000000..2956286eb --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi1c.h @@ -0,0 +1,12 @@ +/* Redundant header include test with C comments at top. */ +# /* And a null directive at the top. */ + +#ifndef CPP_MIC_H +#define CPP_MIC_H + +int a; + +#endif + +# /* And at the end, too! */ +/* And at the end too! */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi1cc.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi1cc.h new file mode 100644 index 000000000..46a38cded --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi1cc.h @@ -0,0 +1,10 @@ +// Redundant header include test with C comments at top. + +#ifndef CPP_MICC_H +#define CPP_MICC_H + +int b; + +#endif + +// And at the end too! diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi1nd.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi1nd.h new file mode 100644 index 000000000..c14c1a3c6 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi1nd.h @@ -0,0 +1,8 @@ +/* Redundant include check with #if !defined. */ + +#if !defined CPP_MIND_H +#define CPP_MIND_H + +int c; + +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi1ndp.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi1ndp.h new file mode 100644 index 000000000..b84202c6d --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi1ndp.h @@ -0,0 +1,7 @@ +#if !defined ( CPP_MINDP_H) +#define CPP_MINDP_H + +/* Redundant include check with #if !defined and parentheses. */ +int d; + +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi1x.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi1x.h new file mode 100644 index 000000000..a317cf852 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi1x.h @@ -0,0 +1,9 @@ +/* This header is never to have its contents visible, but it should + still receive the optimization. */ + +#ifndef MIX_H +#define MIX_H + +#define main wibble + +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi2.c new file mode 100644 index 000000000..916d5a949 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi2.c @@ -0,0 +1,12 @@ +/* Test for overly eager multiple include optimization. + Problem distilled from glibc 2.0.7's time.h, sys/time.h, timebits.h. + Problem noted by Tom Tromey <tromey@cygnus.com>. */ +/* { dg-do compile } */ + +#include "mi2a.h" +#include "mi2b.h" + +int main (void) +{ + return x; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi2a.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi2a.h new file mode 100644 index 000000000..e3f53b6cb --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi2a.h @@ -0,0 +1,5 @@ +/* Test for overly eager multiple include optimization. + Problem distilled from glibc 2.0.7's time.h, sys/time.h, timebits.h. + Problem noted by Tom Tromey <tromey@cygnus.com>. */ + +#include "mi2c.h" diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi2b.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi2b.h new file mode 100644 index 000000000..1d9a8b9b1 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi2b.h @@ -0,0 +1,6 @@ +/* Test for overly eager multiple include optimization. + Problem distilled from glibc 2.0.7's time.h, sys/time.h, timebits.h. + Problem noted by Tom Tromey <tromey@cygnus.com>. */ + +#define need_x +#include "mi2c.h" diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi2c.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi2c.h new file mode 100644 index 000000000..521792bee --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi2c.h @@ -0,0 +1,15 @@ +/* Test for overly eager multiple include optimization. + Problem distilled from glibc 2.0.7's time.h, sys/time.h, timebits.h. + Problem noted by Tom Tromey <tromey@cygnus.com>. */ +#ifdef need_x +#undef need_x +#ifndef have_x +#define have_x +extern int x; +#endif +#endif + +#ifndef t_h +#define t_h +extern int y; +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi3.c new file mode 100644 index 000000000..f33fd7887 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi3.c @@ -0,0 +1,20 @@ +/* Another test case for over-eager multiple include optimization. + This one distilled from glibc's setlocale.c and categories.def. */ +/* { dg-do compile } */ + +#define X a +#include "mi3.def" +#undef X + +#define X b +#include "mi3.def" +#undef X + +#include "mi3.h" +#include "mi3.h" /* The second include declares variable c. */ + +int +main(void) +{ + return a + b + c; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi3.def b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi3.def new file mode 100644 index 000000000..375d9c7fe --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi3.def @@ -0,0 +1,10 @@ +/* Another test case for over-eager multiple include optimization. + This one distilled from glibc's setlocale.c and categories.def. + The #ifdef block doesn't cover the entire file, so it must not be + taken for a reinclude guard. */ + +#ifndef NO_POSTLOAD +#define NO_POSTLOAD NULL +#endif + +int X; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi3.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi3.h new file mode 100644 index 000000000..8774fcf48 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi3.h @@ -0,0 +1,7 @@ +/* Another test case for over-eager multiple include optimization. */ + +#ifndef GUARD +#define GUARD +#elif 1 /* #elif kills optimisation */ +int c; +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi4.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi4.c new file mode 100644 index 000000000..c886cc2c8 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi4.c @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Undefining a macro guard and re-including the file used to confuse + file caching in cppfiles.c, and attempt to open a bad fd. */ + +#include "mi1c.h" +#undef CPP_MIC_H +#include "mi1c.h" diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi5.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi5.c new file mode 100644 index 000000000..09f4f5c0d --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi5.c @@ -0,0 +1,13 @@ +/* Test "ignore redundant include" facility, with -C on. + + The disgusting regexp in the dg-error line, when stuck into + dg.exp's compiler-output regexp, matches the correct -H output and + only the correct -H output. It has to be all on one line because + otherwise it will not be interpreted all in one unit. */ + +/* { dg-do preprocess } + { dg-options "-nostdinc -H -C" } + { dg-message "mi1c\.h" "redundant include check with -C" { target *-*-* } 0 } */ + +#include "mi1c.h" +#include "mi1c.h" diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi6.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi6.c new file mode 100644 index 000000000..c3af2d3f2 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi6.c @@ -0,0 +1,61 @@ +/* Another test case for over-eager multiple include optimization, + where the leading "#if !defined" expression is obtained partially, + or wholly, from macros. Neil Booth, 30 Sep 2001. */ + +/* { dg-do compile } */ +/* { dg-options "" } */ + +extern void abort (void); + +/* Each include file should not be subject to MI optimisation, since + macro definitions can change. Each header increments the variable + VAR if it is defined. + + The first set of inclusions gets the headers into CPP's cache, but + does nothing since VAR is not defined. The second set should each + increment VAR, since none of the initial set should have been + flagged as optimizable. */ + +#define EMPTYL +#define EMPTYR +#define NOT ! +#define DEFINED defined (guard) +#define NOT_DEFINED ! defined (guard) + +#include "mi6a.h" +#include "mi6b.h" +#include "mi6c.h" +#include "mi6d.h" +#include "mi6e.h" + +/* Define the macro guard, and redefine the macros to something that + forces compilation of the conditional blocks. */ +#define guard +#undef EMPTYL +#define EMPTYL 1 || +#undef EMPTYR +#define EMPTYR || 1 +#undef NOT +#define NOT +#undef DEFINED +#define DEFINED 0 +#undef NOT_DEFINED +#define NOT_DEFINED 1 + +#define VAR five + +int +main(void) +{ + unsigned int five = 0; + +#include "mi6a.h" +#include "mi6b.h" +#include "mi6c.h" +#include "mi6d.h" +#include "mi6e.h" + + if (five != 5) + abort (); + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi6a.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi6a.h new file mode 100644 index 000000000..68a2fce47 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi6a.h @@ -0,0 +1,5 @@ +#if NOT_DEFINED + #ifdef VAR + VAR++; + #endif +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi6b.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi6b.h new file mode 100644 index 000000000..d2fe8be17 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi6b.h @@ -0,0 +1,5 @@ +#if NOT defined (guard) + #ifdef VAR + VAR++; + #endif +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi6c.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi6c.h new file mode 100644 index 000000000..d19cb5433 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi6c.h @@ -0,0 +1,5 @@ +#if !DEFINED + #ifdef VAR + VAR++; + #endif +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi6d.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi6d.h new file mode 100644 index 000000000..a1eabba8e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi6d.h @@ -0,0 +1,5 @@ +#if EMPTYL !defined (guard) + #ifdef VAR + VAR++; + #endif +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi6e.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi6e.h new file mode 100644 index 000000000..26ba71514 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi6e.h @@ -0,0 +1,5 @@ +#if !defined (guard) EMPTYR + #ifdef VAR + VAR++; + #endif +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi7.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi7.c new file mode 100644 index 000000000..415186cba --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi7.c @@ -0,0 +1,19 @@ +/* Test "ignore redundant include" facility. + + -H is used because cpp might confuse the issue by optimizing out + #line markers. This test only passes if the headers is read + twice. + + The disgusting regexp in the dg-error line, when stuck into + dg.exp's compiler-output regexp, matches the correct -H output and + only the correct -H output. It has to be all on one line because + otherwise it will not be interpreted all in one unit. */ + +/* { dg-do preprocess } + { dg-options "-H" } + { dg-message "mi7a\.h\n\[^\n\]*mi7a\.h\n\[^\n\]*mi7b\.h\n\[^\n\]*mi7b\.h" "redundant include check" { target *-*-* } 0 } */ + +#include "mi7a.h" +#include "mi7a.h" +#include "mi7b.h" +#include "mi7b.h" diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi7a.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi7a.h new file mode 100644 index 000000000..0c701d7e6 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi7a.h @@ -0,0 +1,4 @@ +: +#ifndef GUARD1 +#define GUARD1 +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi7b.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi7b.h new file mode 100644 index 000000000..1747e5482 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi7b.h @@ -0,0 +1,4 @@ +#ifndef GUARD2 +#define GUARD2 +#endif +: diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi8.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi8.c new file mode 100644 index 000000000..1999918de --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi8.c @@ -0,0 +1,8 @@ +/* Test multiple include guards suggestions. */ + +/* { dg-do preprocess } + { dg-options "-H" } + { dg-message "mi8a\.h\n\[^\n\]*mi8c\.h\n\[^\n\]*mi8b\.h\n\[^\n\]*mi8d\.h\nMultiple include guards may be useful for:\n\[^\n\]*mi8a\.h\n\[^\n\]*mi8d\.h\n" "" { target *-*-* } 0 } */ + +#include "mi8a.h" +#include "mi8b.h" diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi8a.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi8a.h new file mode 100644 index 000000000..893d9ff13 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi8a.h @@ -0,0 +1 @@ +#include "mi8c.h" diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi8b.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi8b.h new file mode 100644 index 000000000..8e3482ce7 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi8b.h @@ -0,0 +1,4 @@ +#ifndef GUARDB +#define GUARDB +#include "mi8d.h" +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi8c.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi8c.h new file mode 100644 index 000000000..08c5cab94 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi8c.h @@ -0,0 +1,4 @@ +#ifndef GUARDC +#define GUARDC +/* Empty */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi8d.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi8d.h new file mode 100644 index 000000000..710cecca9 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/mi8d.h @@ -0,0 +1 @@ +/* Empty */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/missing-header-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/missing-header-1.c new file mode 100644 index 000000000..a597a4696 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/missing-header-1.c @@ -0,0 +1,10 @@ +/* Test that missing headers are fatal errors. PR 15638. */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +#include "nonexistent.h" +/* { dg-message "nonexistent.h" "nonexistent.h" { target *-*-* } 0 } */ +/* { dg-message "terminated" "terminated" { target *-*-* } 0 } */ + +/* This declaration should not receive any diagnostic. */ +foo bar; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/missing-header-MD.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/missing-header-MD.c new file mode 100644 index 000000000..793fb179b --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/missing-header-MD.c @@ -0,0 +1,10 @@ +/* Test that missing user headers are fatal errors with -MD. PR 28435. */ +/* { dg-do compile } */ +/* { dg-options "-MD" } */ + +#include "nonexistent.h" +/* { dg-message "nonexistent.h" "nonexistent.h" { target *-*-* } 0 } */ +/* { dg-message "terminated" "terminated" { target *-*-* } 0 } */ + +/* This declaration should not receive any diagnostic. */ +foo bar; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/missing-header-MMD.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/missing-header-MMD.c new file mode 100644 index 000000000..bba85ede9 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/missing-header-MMD.c @@ -0,0 +1,10 @@ +/* Test that missing user headers are fatal errors with -MMD. PR 28435. */ +/* { dg-do compile } */ +/* { dg-options "-MMD" } */ + +#include "nonexistent.h" +/* { dg-message "nonexistent.h" "nonexistent.h" { target *-*-* } 0 } */ +/* { dg-message "terminated" "terminated" { target *-*-* } 0 } */ + +/* This declaration should not receive any diagnostic. */ +foo bar; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/missing-sysheader-MD.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/missing-sysheader-MD.c new file mode 100644 index 000000000..2983f2d58 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/missing-sysheader-MD.c @@ -0,0 +1,10 @@ +/* Test that missing system headers are fatal errors with -MD. PR 28435. */ +/* { dg-do compile } */ +/* { dg-options "-MD" } */ + +#include <nonexistent.h> +/* { dg-message "nonexistent.h" "nonexistent.h" { target *-*-* } 0 } */ +/* { dg-message "terminated" "terminated" { target *-*-* } 0 } */ + +/* This declaration should not receive any diagnostic. */ +foo bar; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/missing-sysheader-MMD.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/missing-sysheader-MMD.c new file mode 100644 index 000000000..351228661 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/missing-sysheader-MMD.c @@ -0,0 +1,10 @@ +/* Test that missing system headers are fatal errors with -MMD. PR 28435. */ +/* { dg-do compile } */ +/* { dg-options "-MMD" } */ + +#include <nonexistent.h> +/* { dg-message "nonexistent.h" "nonexistent.h" { target *-*-* } 0 } */ +/* { dg-message "terminated" "terminated" { target *-*-* } 0 } */ + +/* This declaration should not receive any diagnostic. */ +foo bar; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/multiline-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/multiline-2.c new file mode 100644 index 000000000..6a674b4dc --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/multiline-2.c @@ -0,0 +1,14 @@ +/* Copyright (C) 2000, 2003 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ + +/* Test that multi-line tokens are rejected by the compiler. Source: + Neil Booth. */ + +const char *p = "line 1 +" +""; /* The compiler front end sees this. */ + +/* { dg-error "missing term" "multiline strings" { target *-*-* } 8 } */ +/* { dg-error "missing term" "multiline strings" { target *-*-* } 9 } */ + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/multiline.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/multiline.c new file mode 100644 index 000000000..970cf2faa --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/multiline.c @@ -0,0 +1,25 @@ +/* Copyright (C) 2000, 2003 Free Software Foundation, Inc. */ +/* { dg-do preprocess } */ +/* { dg-options "-nostdinc -C" } */ +/* Test that multi-line tokens are recognized by cpp0 as being + multiline . Source: Neil Booth, 17 Dec 2000. */ +/* Line 1 + Line 2 + Line 3 + Line 4 +*/ +"line 1 + line 2 + line 3 + line 4" +L"line 1 + line 2 + line 3 + line 4" +/* Nowhere in the output of this file should there be a blank line. + We check for that in the .i file. + { dg-final { scan-file-not multiline.i "(^|\\n)\\n" } } */ +/* { dg-warning "missing term" "multiline strings" { target *-*-* } 11 } */ +/* { dg-warning "missing term" "multiline strings" { target *-*-* } 14 } */ +/* { dg-warning "missing term" "multiline strings" { target *-*-* } 15 } */ +/* { dg-warning "missing term" "multiline strings" { target *-*-* } 18 } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/normalize-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/normalize-1.c new file mode 100644 index 000000000..b20f235ee --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/normalize-1.c @@ -0,0 +1,34 @@ +/* { dg-do preprocess } */ +/* { dg-options "-std=c99 -fextended-identifiers" } */ + +\u00AA +\u00B7 +\u0F43 /* { dg-warning "not in NFC" } */ +a\u05B8\u05B9\u05B9\u05BBb + a\u05BB\u05B9\u05B8\u05B9b /* { dg-warning "not in NFC" } */ +\u09CB +\u09C7\u09BE /* { dg-warning "not in NFC" } */ +\u0B4B +\u0B47\u0B3E /* { dg-warning "not in NFC" } */ +\u0BCA +\u0BC6\u0BBE /* { dg-warning "not in NFC" } */ +\u0BCB +\u0BC7\u0BBE /* { dg-warning "not in NFC" } */ +\u0CCA +\u0CC6\u0CC2 /* { dg-warning "not in NFC" } */ +\u0D4A +\u0D46\u0D3E /* { dg-warning "not in NFC" } */ +\u0D4B +\u0D47\u0D3E /* { dg-warning "not in NFC" } */ + +K +\u212A /* { dg-warning "not in NFC" } */ + +\u03AC +\u1F71 /* { dg-warning "not in NFC" } */ + +\uAC00 +\u1100\u1161 /* { dg-warning "not in NFC" } */ +\uAC01 +\u1100\u1161\u11A8 /* { dg-warning "not in NFC" } */ +\uAC00\u11A8 /* { dg-warning "not in NFC" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/normalize-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/normalize-2.c new file mode 100644 index 000000000..6f2f49564 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/normalize-2.c @@ -0,0 +1,34 @@ +/* { dg-do preprocess } */ +/* { dg-options "-std=c99 -fextended-identifiers -Wnormalized=nfkc" } */ + +\u00AA /* { dg-warning "not in NFKC" } */ +\u00B7 +\u0F43 /* { dg-warning "not in NFC" } */ +a\u05B8\u05B9\u05B9\u05BBb + a\u05BB\u05B9\u05B8\u05B9b /* { dg-warning "not in NFC" } */ +\u09CB +\u09C7\u09BE /* { dg-warning "not in NFC" } */ +\u0B4B +\u0B47\u0B3E /* { dg-warning "not in NFC" } */ +\u0BCA +\u0BC6\u0BBE /* { dg-warning "not in NFC" } */ +\u0BCB +\u0BC7\u0BBE /* { dg-warning "not in NFC" } */ +\u0CCA +\u0CC6\u0CC2 /* { dg-warning "not in NFC" } */ +\u0D4A +\u0D46\u0D3E /* { dg-warning "not in NFC" } */ +\u0D4B +\u0D47\u0D3E /* { dg-warning "not in NFC" } */ + +K +\u212A /* { dg-warning "not in NFC" } */ + +\u03AC +\u1F71 /* { dg-warning "not in NFC" } */ + +\uAC00 +\u1100\u1161 /* { dg-warning "not in NFC" } */ +\uAC01 +\u1100\u1161\u11A8 /* { dg-warning "not in NFC" } */ +\uAC00\u11A8 /* { dg-warning "not in NFC" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/normalize-4.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/normalize-4.c new file mode 100644 index 000000000..0040c03aa --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/normalize-4.c @@ -0,0 +1,34 @@ +/* { dg-do preprocess } */ +/* { dg-options "-std=c99 -fextended-identifiers -Wnormalized=none" } */ + +\u00AA +\u00B7 +\u0F43 +a\u05B8\u05B9\u05B9\u05BBb + a\u05BB\u05B9\u05B8\u05B9b +\u09CB +\u09C7\u09BE +\u0B4B +\u0B47\u0B3E +\u0BCA +\u0BC6\u0BBE +\u0BCB +\u0BC7\u0BBE +\u0CCA +\u0CC6\u0CC2 +\u0D4A +\u0D46\u0D3E +\u0D4B +\u0D47\u0D3E + +K +\u212A + +\u03AC +\u1F71 + +\uAC00 +\u1100\u1161 +\uAC01 +\u1100\u1161\u11A8 +\uAC00\u11A8 diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste1.c new file mode 100644 index 000000000..7b07f740c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste1.c @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Test operator ## semantics. */ + +#define bad1 ## owt /* { dg-error "cannot" "## at objlike start" } */ +#define bad2 owt ## /* { dg-error "cannot" "## at objlike end" } */ +#define bad3(x) ## x /* { dg-error "cannot" "## at funlike start" } */ +#define bad4(x) x ## /* { dg-error "cannot" "## at funlike end" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste10.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste10.c new file mode 100644 index 000000000..ab3cb9050 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste10.c @@ -0,0 +1,15 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "" } */ + +/* This testcase used to produce a bogus "invalid paste" warning, owing + to not clearing a PASTE_LEFT flag. */ + +#define strcpy(src) __strcpy_small (src) + +#define __strcpy_small(src) src + +#define tprintf(format, args...) sprintf(format, ## args) + +strcpy(tprintf("<%s>", test)) diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste11.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste11.c new file mode 100644 index 000000000..e3860ebb7 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste11.c @@ -0,0 +1,15 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Test correct pasting of identifiers and numbers. We can paste any + number, as long as no '.', '-' or '+' appears in its spelling. */ + +#define glue(x, y) x ## y + +glue (ident, 12) /* OK. */ +glue (ident, 12e3) /* OK. */ +glue (ident, 12e+3) /* { dg-error "valid preprocessing tok" } */ +glue (ident, 12e-3) /* { dg-error "valid preprocessing tok" } */ +glue (ident, 1.2) /* { dg-error "valid preprocessing tok" } */ +glue (ident, .12) /* { dg-error "valid preprocessing tok" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste12-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste12-2.c new file mode 100644 index 000000000..6e2e4f105 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste12-2.c @@ -0,0 +1,11 @@ +/* + { dg-options "-ftrack-macro-expansion=2" } + { dg-do preprocess } + */ + +/* Test correct diagnostics when pasting in #include. + Source: PR preprocessor/6780. */ + +#define inc2(a,b) <##a.b> /* { dg-error "pasting \"<\" and \"stdio\" does not" } */ +#define INC(X) inc2(X,h) +#include INC(stdio) diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste12.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste12.c new file mode 100644 index 000000000..3e0f7b959 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste12.c @@ -0,0 +1,11 @@ +/* + { dg-options "-ftrack-macro-expansion=0" } + { dg-do preprocess } +*/ + +/* Test correct diagnostics when pasting in #include. + Source: PR preprocessor/6780. */ + +#define inc2(a,b) <##a.b> +#define INC(X) inc2(X,h) +#include INC(stdio) /* { dg-error "pasting \"<\" and \"stdio\" does not" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste13.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste13.c new file mode 100644 index 000000000..f0f4fd894 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste13.c @@ -0,0 +1,12 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* + { dg-options "-ftrack-macro-expansion=0" } + { dg-do preprocess } +*/ + +/* This used to be recognized as a comment when lexing after pasting + spellings. Neil Booth, 9 Oct 2002. */ + +#define a /##/= +a /* { dg-error "valid preprocessing tok" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste14-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste14-2.c new file mode 100644 index 000000000..3b23ada3d --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste14-2.c @@ -0,0 +1,11 @@ +/* PR preprocessor/28709 */ +/* + { dg-options "-ftrack-macro-expansion=2" } + { dg-do preprocess } +*/ + +#define foo - ## >> /* { dg-error "pasting \"-\" and \">>\"" } */ +foo +#define bar = ## == /* { dg-error "pasting \"=\" and \"==\"" } */ +bar + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste14.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste14.c new file mode 100644 index 000000000..043d5e580 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste14.c @@ -0,0 +1,10 @@ +/* PR preprocessor/28709 */ +/* + { dg-options "-ftrack-macro-expansion=0" } + { dg-do preprocess } +*/ + +#define foo - ## >> +foo /* { dg-error "pasting \"-\" and \">>\"" } */ +#define bar = ## == +bar /* { dg-error "pasting \"=\" and \"==\"" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste15.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste15.c new file mode 100644 index 000000000..9d4ec3631 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste15.c @@ -0,0 +1,15 @@ +/* PR preprocessor/20077 */ +/* { dg-do preprocess } */ + +#define a a ## ## /* { dg-error "end of a macro expansion" } */ +#define b() b ## ## /* { dg-error "end of a macro expansion" } */ +#define c c ## /* { dg-error "end of a macro expansion" } */ +#define d() d ## /* { dg-error "end of a macro expansion" } */ + + +#define e ## ## e /* { dg-error "end of a macro expansion" } */ +#define f() ## ## f /* { dg-error "end of a macro expansion" } */ +#define g ## g /* { dg-error "end of a macro expansion" } */ +#define h() ## h /* { dg-error "end of a macro expansion" } */ +#define i ## /* { dg-error "end of a macro expansion" } */ +#define j() ## /* { dg-error "end of a macro expansion" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste16.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste16.c new file mode 100644 index 000000000..11aca2b60 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste16.c @@ -0,0 +1,6 @@ +/* Test multiple consecutive ## tokens. */ +/* { dg-do compile } */ +/* { dg-options "" } */ +#define cat(x,y) x##########y +int abcd; +int *p = &cat(ab,cd); diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste17.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste17.c new file mode 100644 index 000000000..9c6506ff8 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste17.c @@ -0,0 +1,8 @@ + /* { dg-options "-ftrack-macro-expansion=2" } */ +/* { dg-do preprocess } */ + +#define do_paste 1.0e ## -1 + +do_paste + +/* { dg-final {scan-file paste17.i "1.0e- 1" } }*/ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste18.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste18.c new file mode 100644 index 000000000..2888144cb --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste18.c @@ -0,0 +1,16 @@ +/* + { dg-options "-ftrack-macro-expansion=2" } + { dg-do compile } + */ + +struct x { + int i; +}; +struct x x; + +#define TEST(X) x.##X /* { dg-error "pasting\[^\n\r\]*does not give\[^\n\r\]*token" } */ + +void foo (void) +{ + TEST(i) = 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste2.c new file mode 100644 index 000000000..788e4eb51 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste2.c @@ -0,0 +1,118 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do run } */ +/* { dg-options "-std=c99 -pedantic-errors" } */ + +/* Test ## behavior and corner cases thoroughly. The macro expander + failed many of these during development. */ + +#ifndef __WCHAR_TYPE__ +#define __WCHAR_TYPE__ int +#endif +typedef __WCHAR_TYPE__ wchar_t; + +extern int strcmp (const char *, const char *); +extern int puts (const char *); +extern void abort (void); +#define err(str) do { puts(str); abort(); } while (0) + +#define EMPTY +#define str(x) #x +#define xstr(x) str(x) +#define glue(x, y) x ## y +#define xglue(x, y) glue (x, y) +#define glue3(x, y, z) x ## y ## z +#define glue_var(x, ...) x ## __VA_ARGS__ + +#define __muldi3 __NDW(mul, 3 = 50) +#define __NDW(a,b) __ ## a ## di ## b +#define m3 NDW() +#define NDW(x) m3 ## x = 50 +#define five 5 +#define fifty int fif ## ty + +/* Defines a function called glue, returning what it is passed. */ +int glue (glue,) (int x) +{ + return x; +} + +int main () +{ + /* m3 and __muldi3 would sometimes cause an infinite loop. Ensure + we only expand fifty once. */ + fifty = 50, m3, __muldi3; + + /* General glue and macro expanding test. */ + int five0 = xglue (glue (fi, ve), 0); + + /* Tests only first and last tokens are pasted, and pasting to form + the != operator. Should expand to: if (five0 != 50). */ + if (glue3 (fi, ve0 !,= glue (EMPTY 5, 0))) + err ("five0 != 50"); + + /* Test varags pasting, and pasting to form the >> operator. */ + if (glue_var(50 >, > 1 != 25)) + err ("Operator >> pasting"); + + /* The LHS should not attempt to expand twice, and thus becomes a + call to the function glue. */ + if (glue (gl, ue) (12) != 12) + err ("Recursive macros"); + + /* Test placemarker pasting. The glued lines should all appear + neatly in the same column and below each other, though we don't + test that here. */ + { + int glue3(a, b, ) = 1, glue3(a,,) = 1; + glue3(a, , b)++; + glue3(, a, b)++; + glue3(,a,)++; + glue3(,,a)++; + if (a != 3 || ab != 3 glue3(,,)) + err ("Placemarker pasting"); + } + + /* Test that macros in arguments are not expanded. */ + { + int glue (EMPTY,1) = 123, glue (T, EMPTY) = 123; + if (EMPTY1 != 123 || TEMPTY != 123) + err ("Pasted arguments macro expanding"); + } + + /* Test various paste combinations. */ + { + const wchar_t* wc_array = glue(L, "wide string"); + wchar_t wc = glue(L, 'w'); + const char * hh = xstr(xglue(glue(%, :), glue(%, :))); + int array glue (<, :) 1 glue (:, >) = glue(<, %) 1 glue(%, >); + int x = 4; + + if (array[0] != 1) + err ("Digraph pasting"); + + x glue (>>, =) 1; /* 2 */ + x glue (<<, =) 1; /* 4 */ + x glue (*, =) 2; /* 8 */ + x glue (+, =) 100; /* 108 */ + x glue (-, =) 50; /* 58 */ + x glue (/, =) 2; /* 29 */ + x glue (%, =) 20; /* 9 */ + x glue (&, =) 254; /* 8 */ + x glue (|, =) 16; /* 24 */ + x glue (^, =) 18; /* 10 */ + + if (x != 10 || 0 glue (>, =) 1 glue (|, |) 1 glue (<, =) 0) + err ("Various operator pasting"); + if (strcmp (hh, "%:%:")) + err ("Pasted digraph spelling"); + if ((glue (., 1) glue (!, =) .1)) + err ("Pasted numbers 1"); + /* glue3 here will only work if we paste left-to-right. If a + future implementation does not do this, change the test. */ + if (glue3 (1.0e, +, 1) != 10.0) + err ("Pasted numbers 2"); + } + + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste3.c new file mode 100644 index 000000000..0c9c52de3 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste3.c @@ -0,0 +1,14 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ + +#define plus + + +void foo() +{ + int a, b = 1; + + /* The correct "a = 1 + ++b" will compile. + The incorrect "a = 1 +++b" won't. */ + a = 1 plus++b; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste4.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste4.c new file mode 100644 index 000000000..dfc455ded --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste4.c @@ -0,0 +1,18 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ +/* { dg-do compile } */ +/* { dg-options -save-temps } */ + +/* Since 1.0e and + form the pasted token, 1 is a separate token and + so should be output with a preceding space. The old preprocessor + gets this wrong. We use -save-temps to avoid direct use of the + integrated preprocessor. */ + +#define glue(x, y) x ## y + +int main () +{ + double d = glue (1.0e, +1); /* { dg-error "exponent|parse error|syntax error|expected" } */ + return 0; +} + +/* { dg-final { cleanup-saved-temps } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste5.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste5.c new file mode 100644 index 000000000..fd0406674 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste5.c @@ -0,0 +1,24 @@ +/* Regression test for bug in convoluted situation involving token paste + plus function-like macros used outside function context. It may be + easier to understand if you mentally replace 'struct' with 'A' + throughout this file; 'struct' is used only to get the code to compile + when preprocessed correctly. + + The original problem was seen in the Linux kernel and reported by + Jakub Jelinek <jakub@redhat.com>; this test is synthetic. */ + +/* { dg-do compile } */ + +#define glue(a,b) a##b +#define struct(x) B(x) +#define E(x) struct x +#define FG (22) + +extern void B(int); + +void foo(void) +{ + E(glue(F,*)) dummy; /* { dg-error "valid preprocessing token" } */ + + E(glue(F,G)) ; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste6.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste6.c new file mode 100644 index 000000000..a4e70e450 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste6.c @@ -0,0 +1,15 @@ +/* Regression test for paste appearing at the beginning of a set of + actual arguments. Original bug exposed by Linux kernel. Problem + reported by Jakub Jelinek <jakub@redhat.com>. */ + +/* + { dg-options "-ftrack-macro-expansion=0" } + { dg-do compile } +*/ + +extern int foo(int x); + +#define bar(x) foo(x) +#define baz(x) bar(##x) + +int quux(int y) { return baz(y); } /* { dg-error "valid preprocessing" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste7.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste7.c new file mode 100644 index 000000000..ce29db847 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste7.c @@ -0,0 +1,19 @@ +/* { dg-do run } */ + +#define D_2 1, 2 +#define C_2(X, I0, I1) X##_a = I0, X##_b = I1 +#define B_2(X, I) C_2(X, I) +#define A(N, X) B_##N (X, D_##N) + +extern void abort(void); +extern void exit(int); + +int x_a, x_b; + +int main(void) +{ + A(2, x); + if (x_a != 1 || x_b != 2) + abort(); + exit(0); +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste8-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste8-2.c new file mode 100644 index 000000000..c037e99e6 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste8-2.c @@ -0,0 +1,15 @@ +/* { dg-do preprocess } */ +/* { dg-options "-ftrack-macro-expansion=2" } */ + +int foo(int, ...); + +#define a(x, y...) foo(x, ##y) +a(1) +a(1, 2, 3) +#define b(x, y, z...) foo(x, ##y) /* { dg-error "valid preprocessing token" } */ +b(1, 2, 3) +#define c(x, y, z...) foo(x, ##z) +c(1, 2) +c(1, 2, 3) +#define d(x) fo(##x) /* { dg-error "valid preprocessing token" } */ +d(1) diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste8.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste8.c new file mode 100644 index 000000000..db1416c12 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste8.c @@ -0,0 +1,15 @@ +/* { dg-do preprocess } */ +/* { dg-options "-ftrack-macro-expansion=0" } */ + +int foo(int, ...); + +#define a(x, y...) foo(x, ##y) +a(1) +a(1, 2, 3) +#define b(x, y, z...) foo(x, ##y) +b(1, 2, 3) /* { dg-error "valid preprocessing token" } */ +#define c(x, y, z...) foo(x, ##z) +c(1, 2) +c(1, 2, 3) +#define d(x) fo(##x) +d(1) /* { dg-error "valid preprocessing token" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste9.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste9.c new file mode 100644 index 000000000..35c86b4e8 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/paste9.c @@ -0,0 +1,23 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do run } */ +/* { dg-options "" } */ + +/* Apparently older preprocessors used to fail this test. */ + +#include <string.h> + +extern void abort (void); + +#define S(str, args...) " " str "\n", ##args + +int +main() +{ + const char *s = S("foo"); + + if (strchr (s, '\n') == NULL) + abort (); + + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/poison.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/poison.c new file mode 100644 index 000000000..f85405c09 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/poison.c @@ -0,0 +1,24 @@ +/* { dg-do preprocess } */ + +#pragma GCC poison foo +foo /* { dg-error "foo" "use of foo" } */ +#pragma GCC poison foo2 foo3 +foo2 /* { dg-error "foo2" "use of foo2" } */ +foo3 /* { dg-error "foo3" "use of foo3" } */ +#pragma GCC poison foo4 foo5 +foo4 /* { dg-error "foo4" "use of foo4" } */ +foo5 /* { dg-error "foo5" "use of foo5" } */ +#pragma GCC poison +++ /* { dg-error "invalid" "poison non-identifier" } */ +#define foo6 123 +#pragma GCC poison foo6 /* { dg-warning "foo6" "poison defined macro" } */ +#define foo6 345 /* { dg-error "foo6" "def of foo6" } */ +#define foo6 456 /* { dg-error "foo6" "redef of foo6" } */ +#ifdef foo6 /* { dg-error "foo6" "#ifdef foo6" } */ +#error hey! foo6 defined! +#endif +#if defined(foo6) /* { dg-error "foo6" "#if defined foo6" } */ +#error foo6 still defined! +#else +foo6 /* { dg-error "foo6" "use of foo6" } */ +#endif +#pragma GCC poison diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr20348.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr20348.c new file mode 100644 index 000000000..f75f14290 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr20348.c @@ -0,0 +1,16 @@ +/* PR preprocessor/20348 */ +/* { dg-do compile } */ +/* { dg-options "-I$srcdir/gcc.dg/cpp -I$srcdir/gcc.dg/cpp/inc" } */ + +#include <pr20348-aux.h> +#define MIDDLE +#include <pr20348.h> + +#ifndef PR20348_H_SEEN +# error pr20348.h not included after MIDDLE definition +#endif +#ifndef INC_PR20348_H_SEEN +# error inc/pr20348.h not included before MIDDLE definition +#endif + +int i; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr20348.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr20348.h new file mode 100644 index 000000000..97ef80edb --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr20348.h @@ -0,0 +1,9 @@ +#ifdef MIDDLE +# ifndef PR20348_H_SEEN +# define PR20348_H_SEEN +# else +# error pr20348.h included twice after MIDDLE definition +# endif +#else +# error pr20348.h included before MIDDLE definition +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr20356.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr20356.c new file mode 100644 index 000000000..469ab0c0f --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr20356.c @@ -0,0 +1,14 @@ +/* PR preprocessor/20356 */ +/* { dg-do compile } */ +/* { dg-options "-I$srcdir/gcc.dg/cpp -I$srcdir/gcc.dg/cpp/inc" } */ + +#include <pr20356-aux.h> + +#ifndef PR20356_H +# error PR20356_H not defined +#endif +#ifndef INC_PR20356_H +# error INC_PR20356_H not defined +#endif + +int i; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr20356.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr20356.h new file mode 100644 index 000000000..a3f289145 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr20356.h @@ -0,0 +1,5 @@ +#ifndef PR20356_H +# define PR20356_H +#else +# include_next <pr20356.h> +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr22168-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr22168-2.c new file mode 100644 index 000000000..c1e308dfc --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr22168-2.c @@ -0,0 +1,12 @@ +/* Copyright (C) 2008 Free Software Foundation, Inc. */ +/* PR preprocessor/22168 */ + +/* { dg-do preprocess } + { dg-options -Wdeprecated } */ +#if #foo(bar) /* { dg-warning "deprecated" } */ +int x; +#else +int y; +#endif +#assert zzz(a) /* { dg-warning "deprecated" } */ +#unassert yyy /* { dg-warning "deprecated" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr22168.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr22168.c new file mode 100644 index 000000000..fecb972f7 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr22168.c @@ -0,0 +1,12 @@ +/* Copyright (C) 2008 Free Software Foundation, Inc. */ +/* PR preprocessor/22168 */ + +/* { dg-do preprocess } + { dg-options -pedantic } */ +#if #foo(bar) /* { dg-warning "GCC extension" } */ +int x; +#else +int y; +#endif +#assert zzz(a) /* { dg-warning "GCC extension" } */ +#unassert yyy /* { dg-warning "GCC extension" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr27777.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr27777.c new file mode 100644 index 000000000..89258b95e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr27777.c @@ -0,0 +1,8 @@ +/* PR preprocessor/27777 */ +/* { dg-do preprocess } */ +/* { dg-options { -trigraphs -Wall } } */ + +#error "BUG??!" + +/* { dg-error "BUG" "" { target *-*-* } 5 } */ +/* { dg-warning "trigraph" "" { target *-*-* } 5 } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr28165.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr28165.c new file mode 100644 index 000000000..71c7c1dba --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr28165.c @@ -0,0 +1,6 @@ +/* Copyright (C) 2007 Free Software Foundation, Inc. */ +/* PR preprocessor/28165 */ + +/* { dg-do preprocess } */ +#pragma GCC system_header /* { dg-warning "system_header" "ignored" } */ +_Pragma ("GCC system_header") /* { dg-warning "system_header" "ignored" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr28227.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr28227.c new file mode 100644 index 000000000..3b70dd539 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr28227.c @@ -0,0 +1,10 @@ +/* Copyright (C) 2007 Free Software Foundation, Inc. */ +/* PR preprocessor/28227 */ + +/* { dg-do preprocess } */ +#ifdef defined +#endif +#ifndef defined +#endif + +int x; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr28709.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr28709.c new file mode 100644 index 000000000..25d7cc297 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr28709.c @@ -0,0 +1,10 @@ +/* Copyright (C) 2006 Free Software Foundation, Inc. */ +/* PR preprocessor/28709 */ + +/* { dg-options "-ftrack-macro-expansion=0" } + { dg-do compile } */ + +#define foo - ## >> +foo; +/* { dg-error "expected identifier.*'-'" "expected" { target *-*-* } 8 } */ +/* { dg-error pasting "pasting" { target *-*-* } 8 } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr29612-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr29612-1.c new file mode 100644 index 000000000..f840c3823 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr29612-1.c @@ -0,0 +1,15 @@ +/* PR preprocessor/29612 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +# 6 "pr29612-1.c" + +int foo (void) { return 'ab'; } /* { dg-warning "multi-character" } */ + +# 1 "foo.h" 1 3 + +int bar (void) { return 'ab'; } /* No warning in system header. */ + +# 14 "pr29612-1.c" 2 + +int baz (void) { return 'ab'; } /* { dg-warning "multi-character" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr29612-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr29612-2.c new file mode 100644 index 000000000..fff10a843 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr29612-2.c @@ -0,0 +1,18 @@ +/* PR preprocessor/29612 */ +/* { dg-do preprocess } */ +/* { dg-options "-Wtraditional" } */ + +# 6 "pr29612-2.c" + +#if 1U /* { dg-warning "traditional C rejects" "numeric constant suffix" } */ +#endif + +# 1 "foo.h" 1 3 + +#if 1U +#endif /* No warning in system header. */ + +# 16 "pr29612-2.c" 2 + +#if 1U /* { dg-warning "traditional C rejects" "numeric constant suffix" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr30786.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr30786.c new file mode 100644 index 000000000..2c3610847 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr30786.c @@ -0,0 +1,9 @@ +/* PR preprocessor/30786 - _Pragma at end of file should not ICE */ +/* { dg-do compile } */ + +/* { dg-error "parenthesized" "parenthesized" { target *-*-* } 9 } */ +/* { dg-error "expected" "expected" { target *-*-* } 9 } */ + +int x; + +_Pragma diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr30805.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr30805.c new file mode 100644 index 000000000..bdfce45e3 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr30805.c @@ -0,0 +1,6 @@ +/* PR preprocessor/30805 - ICE while token pasting. */ +/* { dg-do preprocess } */ +/* { dg-options "-std=gnu89" } */ + +#define A(x,...) x##,##__VA_ARGS__ +A(1) diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr32868.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr32868.c new file mode 100644 index 000000000..ea896214c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr32868.c @@ -0,0 +1,6 @@ +/* PR preprocessor/32868. It is ok to redefine __STDC_FORMAT_MACROS. */ + +/* { dg-do preprocess } */ + +#define __STDC_FORMAT_MACROS 1 +#define __STDC_FORMAT_MACROS 1 diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr32974.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr32974.c new file mode 100644 index 000000000..cec6a9e0b --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr32974.c @@ -0,0 +1,6 @@ +/* PR preprocessor/32974 - don't warn for extra tokens in pragma dependency */ +/* { dg-do compile } */ + +#pragma GCC dependency "pr32974.c" extra tokens are ok + +int x; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr33415.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr33415.c new file mode 100644 index 000000000..28ffe2372 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr33415.c @@ -0,0 +1,6 @@ + /* Test case for PR 33415. Note that the first bytes of this file + are a UTF-8 BOM. */ + +/* { dg-do compile } */ + +int f(void) { return 5; } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr33466.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr33466.c new file mode 100644 index 000000000..8ddb37c8e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr33466.c @@ -0,0 +1,64 @@ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ + +/* Test various invalid constant float suffixes made up of letters of + valid suffixes. These are invalid regardless of whether the target + compiler supports decimal float or fixed-point types. */ + +long double rh = 0.5rh; /* { dg-error "invalid suffix" } */ +long double rl = 0.5rl; /* { dg-error "invalid suffix" } */ +long double rll = 0.5rll; /* { dg-error "invalid suffix" } */ +long double kh = 0.5kh; /* { dg-error "invalid suffix" } */ +long double kl = 0.5kl; /* { dg-error "invalid suffix" } */ +long double kll = 0.5kll; /* { dg-error "invalid suffix" } */ +long double ru = 0.5ru; /* { dg-error "invalid suffix" } */ +long double urh = 0.5urh; /* { dg-error "invalid suffix" } */ +long double hur = 0.5hur; /* { dg-error "invalid suffix" } */ +long double hru = 0.5hru; /* { dg-error "invalid suffix" } */ +long double ruh = 0.5ruh; /* { dg-error "invalid suffix" } */ +long double rhu = 0.5rhu; /* { dg-error "invalid suffix" } */ +long double url = 0.5url; /* { dg-error "invalid suffix" } */ +long double lur = 0.5lur; /* { dg-error "invalid suffix" } */ +long double lru = 0.5lru; /* { dg-error "invalid suffix" } */ +long double rul = 0.5rul; /* { dg-error "invalid suffix" } */ +long double rlu = 0.5rlu; /* { dg-error "invalid suffix" } */ +long double urll = 0.5urll; /* { dg-error "invalid suffix" } */ +long double llur = 0.5llur; /* { dg-error "invalid suffix" } */ +long double llru = 0.5llru; /* { dg-error "invalid suffix" } */ +long double rull = 0.5rull; /* { dg-error "invalid suffix" } */ +long double rllu = 0.5rllu; /* { dg-error "invalid suffix" } */ +long double ku = 0.5ku; /* { dg-error "invalid suffix" } */ +long double ukh = 0.5ukh; /* { dg-error "invalid suffix" } */ +long double huk = 0.5huk; /* { dg-error "invalid suffix" } */ +long double hku = 0.5hku; /* { dg-error "invalid suffix" } */ +long double kuh = 0.5kuh; /* { dg-error "invalid suffix" } */ +long double khu = 0.5khu; /* { dg-error "invalid suffix" } */ +long double ukl = 0.5ukl; /* { dg-error "invalid suffix" } */ +long double luk = 0.5luk; /* { dg-error "invalid suffix" } */ +long double lku = 0.5lku; /* { dg-error "invalid suffix" } */ +long double kul = 0.5kul; /* { dg-error "invalid suffix" } */ +long double klu = 0.5klu; /* { dg-error "invalid suffix" } */ +long double ukll = 0.5ukll; /* { dg-error "invalid suffix" } */ +long double lluk = 0.5lluk; /* { dg-error "invalid suffix" } */ +long double llku = 0.5llku; /* { dg-error "invalid suffix" } */ +long double kull = 0.5kull; /* { dg-error "invalid suffix" } */ +long double kllu = 0.5kllu; /* { dg-error "invalid suffix" } */ +long double ld = 0.5ld; /* { dg-error "invalid suffix" } */ +long double fd = 0.5fd; /* { dg-error "invalid suffix" } */ +long double dk = 0.5dk; /* { dg-error "invalid suffix" } */ +long double dr = 0.5dr; /* { dg-error "invalid suffix" } */ +long double ddw = 0.5ddw; /* { dg-error "invalid suffix" } */ +long double ddq = 0.5ddq; /* { dg-error "invalid suffix" } */ +long double ddl = 0.5ddl; /* { dg-error "invalid suffix" } */ +long double ddf = 0.5ddf; /* { dg-error "invalid suffix" } */ +long double ddd = 0.5ddd; /* { dg-error "invalid suffix" } */ +long double dw = 0.5dw; /* { dg-error "invalid suffix" } */ +long double dq = 0.5dq; /* { dg-error "invalid suffix" } */ +long double wd = 0.5wd; /* { dg-error "invalid suffix" } */ +long double qd = 0.5qd; /* { dg-error "invalid suffix" } */ +long double wdd = 0.5wdd; /* { dg-error "invalid suffix" } */ +long double qdd = 0.5qdd; /* { dg-error "invalid suffix" } */ +long double ldd = 0.5ldd; /* { dg-error "invalid suffix" } */ +long double fdd = 0.5fdd; /* { dg-error "invalid suffix" } */ +long double ddi = 0.5ddi; /* { dg-error "invalid suffix" } */ +long double idd = 0.5idd; /* { dg-error "invalid suffix" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr34602.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr34602.c new file mode 100644 index 000000000..343c0917a --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr34602.c @@ -0,0 +1,6 @@ +/* PR preprocessor/34602 - no internal error trying to spell EOF. */ +/* { dg-do preprocess } */ + +/* { dg-error "unexpected end" "" { target *-*-* } 6 } */ + +#line diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr34692.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr34692.c new file mode 100644 index 000000000..bcb0ca33d --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr34692.c @@ -0,0 +1,35 @@ +/* PR preprocessor/34692 */ +/* { dg-do compile } */ +/* { dg-options "" } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "vara" } } */ +/* { dg-final { scan-hidden "varb" } } */ +/* { dg-final { scan-hidden "varc" } } */ +/* { dg-final { scan-hidden "vard" } } */ +/* { dg-final { scan-assembler "a b cde f g h" } } */ + +#define FOO(y, x) y #x +#define BAR(x) x +#define BAZ(x) x +FOO (const char *vara =, +a +#pragma GCC visibility push(hidden) +b +#pragma GCC visibility push(hidden) +cde f g h); +int varb = 6; +#pragma GCC visibility pop +#pragma GCC visibility pop +FOO ( +BAR ( +#pragma GCC visibility push(hidden) +const) char *varc =,); +#pragma GCC visibility pop +FOO ( +BAR ( +BAZ ( +#pragma GCC visibility push(hidden) +#pragma GCC visibility push(hidden) +const) char) *vard =,); +#pragma GCC visibility pop +#pragma GCC visibility pop diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr34859.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr34859.c new file mode 100644 index 000000000..0fb90994e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr34859.c @@ -0,0 +1,10 @@ +/* PR c++/34859. + It is ok to redefine __STDC_CONSTANT_MACROS and __STDC_LIMIT_MACROS. */ + +/* { dg-do preprocess } */ + +#define __STDC_CONSTANT_MACROS 1 +#define __STDC_CONSTANT_MACROS 1 + +#define __STDC_LIMIT_MACROS 1 +#define __STDC_LIMIT_MACROS 1 diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr35313.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr35313.c new file mode 100644 index 000000000..e12636e0b --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr35313.c @@ -0,0 +1,11 @@ +/* Test two failing cases for libcpp parser. From PRs 35313, 36088*/ +/* { dg-do preprocess } */ +/* { dg-options "-std=c99 -pedantic-errors" } */ + +extern int x; + +#if 0 ? 3,4 : 2 +#endif + +#if 1 ? 0 : 1 ? 1/0 : 1/0 +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr35322.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr35322.c new file mode 100644 index 000000000..1af9605ea --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr35322.c @@ -0,0 +1,4 @@ +/* Test case for PR 35322 -- _Pragma ICE. */ + +/* { dg-do preprocess } */ +_Pragma("GCC dependency") /* { dg-error "#pragma dependency expects" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr36320.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr36320.c new file mode 100644 index 000000000..d136a69b6 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr36320.c @@ -0,0 +1,8 @@ +/* PR 36320 - #elif still requires valid expression. */ + +/* { dg-do preprocess } */ + +int z; +#if 1 +#elif /* { dg-error "with no expression" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr36674.i b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr36674.i new file mode 100644 index 000000000..9362d5a40 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr36674.i @@ -0,0 +1,12 @@ +/* PR cpp/36674 #include location is offset by one row in errors from preprocessed files */ +/* { dg-do compile } */ +/* { dg-options "-fshow-column" } */ +# 1 "gcc/testsuite/gcc.dg/pr36674.c" +# 1 "<built-in>" +# 1 "<command-line>" +# 1 "gcc/testsuite/gcc.dg/pr36674.c" +# 1 "gcc/testsuite/gcc.dg/pr36674.h" 1 +not_declared_yet(); +# 1 "gcc/testsuite/gcc.dg/pr36674.c" 2 +/* { dg-message "file included from \[^\n\]*pr36674.c:1:" "correct include line" { target *-*-* } 0 } */ +/* { dg-message "pr36674.h:1:1: warning: data definition has no type or storage class" "correct warning" { target *-*-* } 0 } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr43195.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr43195.c new file mode 100644 index 000000000..a239fc17b --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr43195.c @@ -0,0 +1,6 @@ +/* PR preprocessor/43195 */ +/* { dg-do preprocess } */ +/* { dg-options "-H" } */ +/* { dg-message "pr43195\.h\n" "" { target *-*-* } 0 } */ +#include "pr43195.h" + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr43195.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr43195.h new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr43195.h @@ -0,0 +1 @@ +#pragma once diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr7263-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr7263-2.c new file mode 100644 index 000000000..5ed10d020 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr7263-2.c @@ -0,0 +1,28 @@ +/* PR 7263: __extension__ keyword doesn't suppress warning on LL or ULL constants. */ +/* { dg-do compile } */ +/* { dg-options "-std=c89 -pedantic-errors" } */ +#include "pr7263-2.h" +unsigned long long /* { dg-error "ISO C90 does not support .long long." } */ +bar () +{ + return BIG_EXT; +} + +unsigned long long /* { dg-error "ISO C90 does not support .long long." } */ +bar2 () +{ + return 0x1b27da572ef3cd86ULL; /* { dg-error "use of C99 long long integer constant" } */ +} + + +unsigned long long /* { dg-error "ISO C90 does not support .long long." } */ +bar3 () +{ + return __extension__ (0x1b27da572ef3cd86ULL); +} + +__extension__ unsigned long long +bar4 () +{ + return BIG; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr7263-2.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr7263-2.h new file mode 100644 index 000000000..54f1757c5 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr7263-2.h @@ -0,0 +1,4 @@ +#define BIG_EXT __extension__(0x1b27da572ef3cd86ULL) + +#define BIG 0x1b27da572ef3cd86ULL + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr7263-3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr7263-3.c new file mode 100644 index 000000000..225b65975 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr7263-3.c @@ -0,0 +1,19 @@ +/* PR 7263: __extension__ keyword doesn't suppress warning on LL or ULL constants. */ +/* { dg-do compile } */ +/* { dg-options "-std=c99 -pedantic-errors -ftrack-macro-expansion=0" } */ +#include "pr7263-3.h" +__complex__ bar () /* { dg-error "ISO C does not support plain .complex. meaning .double complex." } */ +{ + return _Complex_I_ext; +} + +__extension__ __complex__ +bar2 () +{ + return _Complex_I; +} + +__complex__ bar3 () /* { dg-error "ISO C does not support plain .complex. meaning .double complex." } */ +{ + return _Complex_I; /* { dg-error "imaginary constants are a GCC extension" } */ +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr7263-3.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr7263-3.h new file mode 100644 index 000000000..ad6690e2b --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pr7263-3.h @@ -0,0 +1,3 @@ +#define _Complex_I_ext (__extension__ 1.0iF) + +#define _Complex_I (1.0iF) diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-1.c new file mode 100644 index 000000000..7fab02541 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-1.c @@ -0,0 +1,13 @@ +/* Verify that preprocessor does not insert redundant newlines + after #pragma */ +/* { dg-do compile } */ +int +main () +{ +#pragma unknown + { + error; + /* { dg-error "undeclared" "undeclared-variable message" { target *-*-* } { 9 } } */ + /* { dg-message "function it appears in" "reminder message" { target *-*-* } { 9 } } */ + } +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-2.c new file mode 100644 index 000000000..921f4e5eb --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-2.c @@ -0,0 +1,16 @@ +/* Verify that preprocessor does not insert redundant newlines + after #pragma, also check this for #include, #define and #undef */ +/* { dg-do compile } */ +/* { dg-options "-dD" } */ +#include <stdio.h> + +#undef unknow_def + +int main () { + +#pragma unknown + {} + error; + /* { dg-error "undeclared" "undeclared-variable message" { target *-*-* } { 13 } } */ + /* { dg-message "function it appears in" "reminder message" { target *-*-* } { 13 } } */ +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-3.c new file mode 100644 index 000000000..53daee766 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-3.c @@ -0,0 +1,40 @@ +/* + { dg-options "-fopenmp" } + { dg-do preprocess } + { dg-require-effective-target fopenmp } + */ + +void foo (void) +{ + int i1, j1, k1; +#define p parallel +#define P(x) private (x##1) +#define S(x) shared (x##1) +#define F(x) firstprivate (x##1) +#pragma omp \ + p \ + P(i) \ + S(j) \ + F(k) + ; +} + +/* + The bug here was that we had a line like: + # 33554432 "../../gcc/testsuite/gcc.dg/cpp/pragma-3.c" + + Before line: + + #pragma omp parallel private (i1) shared (j1) firstprivate (k1) + + Note the very big integer there. Normally we should just have + this: + + # 13 "../../gcc/testsuite/gcc.dg/cpp/pragma-3.c" + #pragma omp parallel private (i1) shared (j1) firstprivate (k1) + + So let's check that we have no line with a number of 3 or more + digit after #: + + { dg-final { scan-file-not pragma-3.i "# \[0-9\]{3} \[^\n\r\]*pragma-3.c" } } +*/ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-diagnostic-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-diagnostic-1.c new file mode 100644 index 000000000..add7360c5 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-diagnostic-1.c @@ -0,0 +1,32 @@ +/* + { dg-options "-Wuninitialized -ftrack-macro-expansion=0" } + { dg-do compile } +*/ + +void f (unsigned); + +#define CODE_WITH_WARNING \ + int a; \ + f (a) + +#pragma GCC diagnostic ignored "-Wuninitialized" + +void +g (void) +{ + CODE_WITH_WARNING; +} + +#pragma GCC diagnostic push + +#pragma GCC diagnostic error "-Wuninitialized" + +void +h (void) +{ + CODE_WITH_WARNING; /* { dg-error "uninitialized" } */ +} + +/* + { dg-message "some warnings being treated as errors" "" {target *-*-*} 0 } +*/ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-diagnostic-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-diagnostic-2.c new file mode 100644 index 000000000..38fc77c47 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-diagnostic-2.c @@ -0,0 +1,28 @@ +/* + { dg-options "-Wuninitialized -ftrack-macro-expansion=2" } + { dg-do compile } +*/ + +void f (unsigned); + +#define CODE_WITH_WARNING \ + int a; /* { dg-message "was declared here" } */ \ + f (a) /* { dg-warning "used uninitialized" } */ + +#pragma GCC diagnostic ignored "-Wuninitialized" + +void +g (void) +{ + CODE_WITH_WARNING; +} + +#pragma GCC diagnostic push + +#pragma GCC diagnostic error "-Wuninitialized" + +void +h (void) +{ + CODE_WITH_WARNING; /* { dg-message "in expansion of macro 'CODE_WITH_WARNING'" } */ +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-float-const-decimal64-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-float-const-decimal64-1.c new file mode 100644 index 000000000..633383899 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-float-const-decimal64-1.c @@ -0,0 +1,5 @@ +/* { dg-do compile { target { ! dfp } } } */ +/* { dg-options "-std=gnu99 -Wunknown-pragmas" } */ + +#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-warning "not supported on this target" } */ +double d = 1.0; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-once-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-once-1.c new file mode 100644 index 000000000..23e24b8c3 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-once-1.c @@ -0,0 +1,8 @@ +/* PR preprocessor/15167 */ +/* Origin: Roland Meub <Roland.Meub@Tenovis.com> */ + +/* { dg-do compile } */ +/* { dg-options "-I." } */ + +#include "inc/pragma-once-1a.h" +#include "pragma-once-1d.h" diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-once-1b.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-once-1b.h new file mode 100644 index 000000000..9c17db4dd --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-once-1b.h @@ -0,0 +1,8 @@ +#ifndef _B_H_ +#define _B_H_ + +#pragma once + +#include "pragma-once-1c.h" + +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-once-1c.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-once-1c.h new file mode 100644 index 000000000..cd50024f6 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-once-1c.h @@ -0,0 +1,6 @@ +#ifndef _C_H_ +#define _C_H_ + +#include "pragma-once-1b.h" + +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-once-1d.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-once-1d.h new file mode 100644 index 000000000..0c5db2dc7 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-once-1d.h @@ -0,0 +1,6 @@ +#ifndef _D_H_ +#define _D_H_ + +#include "pragma-once-1b.h" + +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-pop_macro-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-pop_macro-1.c new file mode 100644 index 000000000..c9a904864 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/pragma-pop_macro-1.c @@ -0,0 +1,12 @@ +/* PR preprocessor/35061 */ +/* Do nothing if there is nothing on the macro stack to pop. */ + +/* { dg-do preprocess } */ + +#define X 1 +/* # pragma push_macro("X") */ +# undef X +# pragma pop_macro("X") +#ifdef X +#error X is defined +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/redef1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/redef1.c new file mode 100644 index 000000000..a5fe2bacc --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/redef1.c @@ -0,0 +1,19 @@ +/* Test for redefining macros with insignificant (i.e. whitespace) + differences. */ + +/* { dg-do preprocess } */ + +#define foo bar +#define /* x */ foo /* x */ bar /* x */ + +#define quux(thud) a one and a thud and a two +#define /**/ quux( thud ) /**/ a one and a /**/ thud /**/ and /**/ a two +#define quux(thud) a one and a thud and a two /* bah */ + +/* { dg-bogus "redefined" "foo redefined" { target *-*-* } 7 } */ +/* { dg-bogus "redefined" "quux redefined" { target *-*-* } 10 } */ +/* { dg-bogus "redefined" "quux redefined" { target *-*-* } 11 } */ + +/* { dg-bogus "previous def" "foo prev def" { target *-*-* } 6 } */ +/* { dg-bogus "previous def" "quux prev def" { target *-*-* } 9 } */ +/* { dg-bogus "previous def" "quux prev def" { target *-*-* } 10 } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/redef2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/redef2.c new file mode 100644 index 000000000..1dbc10033 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/redef2.c @@ -0,0 +1,31 @@ +/* Test for redefining macros with significant differences. */ + +/* { dg-do preprocess } + { dg-options "-ansi -Wall" } */ + +#define mac(a, b) (a) + (b) +#define mac(a, b) (a) * (b) +#define mac(a, b) (a) * (x) +#define mac(a, g) (a) * (x) + +#define ro(x) foo x bar +#define ro(x, b) foo x bar + +#define va(a...) a +#define va(...) __VA_ARGS__ + +#define foo(x) x +#define foo(x)x /* { dg-bogus "redefined" "redefined foo" } */ + +/* { dg-warning "redefined" "redef mac" { target *-*-* } 7 } + { dg-warning "redefined" "redef mac" { target *-*-* } 8 } + { dg-warning "redefined" "redef mac" { target *-*-* } 9 } + { dg-warning "redefined" "redef ro" { target *-*-* } 12 } + { dg-warning "redefined" "redef va" { target *-*-* } 15 } + + { dg-message "previous" "prev def mac" { target *-*-* } 6 } + { dg-message "previous" "prev def mac" { target *-*-* } 7 } + { dg-message "previous" "prev def mac" { target *-*-* } 8 } + { dg-message "previous" "prev def ro" { target *-*-* } 11 } + { dg-message "previous" "prev def va" { target *-*-* } 14 } +*/ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/redef3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/redef3.c new file mode 100644 index 000000000..1c541a45b --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/redef3.c @@ -0,0 +1,21 @@ +/* Test for redefining macros with mismatch token count (and the oddity). */ + +/* { dg-do preprocess } */ +/* { dg-options "-DC -DD=1 -DE" } */ + +#define A +#define A 1 +#define B 2 3 +#define B 2 +#define C 1 +#define D 1 2 +#define E + +/* { dg-warning "redefined" "redef A" { target *-*-* } 7 } + { dg-warning "redefined" "redef B" { target *-*-* } 9 } + { dg-warning "redefined" "redef D" { target *-*-* } 11 } + { dg-warning "redefined" "redef E" { target *-*-* } 12 } + { dg-message "previous" "prev def A" { target *-*-* } 6 } + { dg-message "previous" "prev def B" { target *-*-* } 8 } + { dg-message "previous" "prev def D/E" { target *-*-* } 0 } +*/ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/redef4.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/redef4.c new file mode 100644 index 000000000..b34635b2e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/redef4.c @@ -0,0 +1,499 @@ +/* Test redefinitions differing only in the spelling of paste and + stringify tokens, whitespace around them, or the number of + consecutive paste tokens. */ +/* { dg-do preprocess } */ +/* { dg-options "" } */ + +#define str(x) #x /* { dg-message "previous definition" } */ +#define str(x) %: x /* { dg-warning "redefined" } */ +#undef str +#define str(x) #x /* { dg-message "previous definition" } */ +#define str(x) # x /* { dg-warning "redefined" } */ +#undef str +#define str(x) #x /* { dg-message "previous definition" } */ +#define str(x) %: x /* { dg-warning "redefined" } */ +#undef str +#define str(x) %:x /* { dg-message "previous definition" } */ +#define str(x) #x /* { dg-warning "redefined" } */ +#undef str +#define str(x) %:x /* { dg-message "previous definition" } */ +#define str(x) %: x /* { dg-warning "redefined" } */ +#undef str +#define str(x) %:x /* { dg-message "previous definition" } */ +#define str(x) # x /* { dg-warning "redefined" } */ +#undef str +#define str(x) %:x /* { dg-message "previous definition" } */ +#define str(x) %: x /* { dg-warning "redefined" } */ +#undef str +#define str(x) # x /* { dg-message "previous definition" } */ +#define str(x) #x /* { dg-warning "redefined" } */ +#undef str +#define str(x) # x /* { dg-message "previous definition" } */ +#define str(x) %: x /* { dg-warning "redefined" } */ +#undef str +#define str(x) # x /* { dg-message "previous definition" } */ +#define str(x) %: x /* { dg-warning "redefined" } */ +#undef str +#define str(x) %: x /* { dg-message "previous definition" } */ +#define str(x) #x /* { dg-warning "redefined" } */ +#undef str +#define str(x) %: x /* { dg-message "previous definition" } */ +#define str(x) # x /* { dg-warning "redefined" } */ +#undef str + +#define str(x) #x +#define str(x) #x +#undef str +#define str(x) # x +#define str(x) # x +#undef str +#define str(x) %: x +#define str(x) %: x +#undef str +#define str(x) %: x +#define str(x) %: x +#undef str + +#define astr(x) a#x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a#x /* { dg-message "previous definition" } */ +#define astr(x) a# x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a#x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a#x /* { dg-message "previous definition" } */ +#define astr(x) a #x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a#x /* { dg-message "previous definition" } */ +#define astr(x) a %:x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a#x /* { dg-message "previous definition" } */ +#define astr(x) a # x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a#x /* { dg-message "previous definition" } */ +#define astr(x) a %: x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a%:x /* { dg-message "previous definition" } */ +#define astr(x) a#x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a%:x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a%:x /* { dg-message "previous definition" } */ +#define astr(x) a# x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a%:x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a%:x /* { dg-message "previous definition" } */ +#define astr(x) a #x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a%:x /* { dg-message "previous definition" } */ +#define astr(x) a %:x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a%:x /* { dg-message "previous definition" } */ +#define astr(x) a # x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a%:x /* { dg-message "previous definition" } */ +#define astr(x) a %: x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a# x /* { dg-message "previous definition" } */ +#define astr(x) a#x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a# x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a# x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a# x /* { dg-message "previous definition" } */ +#define astr(x) a #x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a# x /* { dg-message "previous definition" } */ +#define astr(x) a %:x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a# x /* { dg-message "previous definition" } */ +#define astr(x) a # x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a# x /* { dg-message "previous definition" } */ +#define astr(x) a %: x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a%: x /* { dg-message "previous definition" } */ +#define astr(x) a#x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a%: x /* { dg-message "previous definition" } */ +#define astr(x) a# x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a%: x /* { dg-message "previous definition" } */ +#define astr(x) a #x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a%: x /* { dg-message "previous definition" } */ +#define astr(x) a %:x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a%: x /* { dg-message "previous definition" } */ +#define astr(x) a # x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a%: x /* { dg-message "previous definition" } */ +#define astr(x) a %: x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a #x /* { dg-message "previous definition" } */ +#define astr(x) a#x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a #x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a #x /* { dg-message "previous definition" } */ +#define astr(x) a# x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a #x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a #x /* { dg-message "previous definition" } */ +#define astr(x) a %:x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a #x /* { dg-message "previous definition" } */ +#define astr(x) a # x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a #x /* { dg-message "previous definition" } */ +#define astr(x) a %: x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a %:x /* { dg-message "previous definition" } */ +#define astr(x) a#x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a %:x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a %:x /* { dg-message "previous definition" } */ +#define astr(x) a# x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a %:x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a %:x /* { dg-message "previous definition" } */ +#define astr(x) a #x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a %:x /* { dg-message "previous definition" } */ +#define astr(x) a # x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a %:x /* { dg-message "previous definition" } */ +#define astr(x) a %: x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a # x /* { dg-message "previous definition" } */ +#define astr(x) a#x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a # x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a # x /* { dg-message "previous definition" } */ +#define astr(x) a# x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a # x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a # x /* { dg-message "previous definition" } */ +#define astr(x) a #x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a # x /* { dg-message "previous definition" } */ +#define astr(x) a %:x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a # x /* { dg-message "previous definition" } */ +#define astr(x) a %: x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a %: x /* { dg-message "previous definition" } */ +#define astr(x) a#x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a %: x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a %: x /* { dg-message "previous definition" } */ +#define astr(x) a# x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a %: x /* { dg-message "previous definition" } */ +#define astr(x) a%: x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a %: x /* { dg-message "previous definition" } */ +#define astr(x) a #x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a %: x /* { dg-message "previous definition" } */ +#define astr(x) a %:x /* { dg-warning "redefined" } */ +#undef astr +#define astr(x) a %: x /* { dg-message "previous definition" } */ +#define astr(x) a # x /* { dg-warning "redefined" } */ +#undef astr + +#define astr(x) a#x +#define astr(x) a#x +#undef astr +#define astr(x) a# x +#define astr(x) a# x +#undef astr +#define astr(x) a%: x +#define astr(x) a%: x +#undef astr +#define astr(x) a%: x +#define astr(x) a%: x +#undef astr +#define astr(x) a #x +#define astr(x) a #x +#undef astr +#define astr(x) a %:x +#define astr(x) a %:x +#undef astr +#define astr(x) a # x +#define astr(x) a # x +#undef astr +#define astr(x) a %: x +#define astr(x) a %: x +#undef astr + +#define cat(x,y) x##y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x##y /* { dg-message "previous definition" } */ +#define cat(x,y) x## y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x##y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x##y /* { dg-message "previous definition" } */ +#define cat(x,y) x ##y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x##y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%:y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x##y /* { dg-message "previous definition" } */ +#define cat(x,y) x ## y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x##y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%: y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x%:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x##y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x%:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x%:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x## y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x%:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x%:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x ##y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x%:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%:y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x%:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x ## y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x%:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%: y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x## y /* { dg-message "previous definition" } */ +#define cat(x,y) x##y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x## y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x## y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x## y /* { dg-message "previous definition" } */ +#define cat(x,y) x ##y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x## y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%:y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x## y /* { dg-message "previous definition" } */ +#define cat(x,y) x ## y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x## y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%: y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x%:%: y /* { dg-message "previous definition" } */ +#define cat(x,y) x##y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x%:%: y /* { dg-message "previous definition" } */ +#define cat(x,y) x## y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x%:%: y /* { dg-message "previous definition" } */ +#define cat(x,y) x ##y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x%:%: y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%:y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x%:%: y /* { dg-message "previous definition" } */ +#define cat(x,y) x ## y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x%:%: y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%: y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x ##y /* { dg-message "previous definition" } */ +#define cat(x,y) x##y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x ##y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x ##y /* { dg-message "previous definition" } */ +#define cat(x,y) x## y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x ##y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x ##y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%:y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x ##y /* { dg-message "previous definition" } */ +#define cat(x,y) x ## y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x ##y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%: y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x %:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x##y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x %:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x %:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x## y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x %:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x %:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x ##y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x %:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x ## y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x %:%:y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%: y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x ## y /* { dg-message "previous definition" } */ +#define cat(x,y) x##y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x ## y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x ## y /* { dg-message "previous definition" } */ +#define cat(x,y) x## y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x ## y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x ## y /* { dg-message "previous definition" } */ +#define cat(x,y) x ##y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x ## y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%:y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x ## y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%: y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x %:%: y /* { dg-message "previous definition" } */ +#define cat(x,y) x##y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x %:%: y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x %:%: y /* { dg-message "previous definition" } */ +#define cat(x,y) x## y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x %:%: y /* { dg-message "previous definition" } */ +#define cat(x,y) x%:%: y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x %:%: y /* { dg-message "previous definition" } */ +#define cat(x,y) x ##y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x %:%: y /* { dg-message "previous definition" } */ +#define cat(x,y) x %:%:y /* { dg-warning "redefined" } */ +#undef cat +#define cat(x,y) x %:%: y /* { dg-message "previous definition" } */ +#define cat(x,y) x ## y /* { dg-warning "redefined" } */ +#undef cat + +#define cat(x,y) x##y +#define cat(x,y) x##y +#undef cat +#define cat(x,y) x## y +#define cat(x,y) x## y +#undef cat +#define cat(x,y) x%:%: y +#define cat(x,y) x%:%: y +#undef cat +#define cat(x,y) x%:%: y +#define cat(x,y) x%:%: y +#undef cat +#define cat(x,y) x ##y +#define cat(x,y) x ##y +#undef cat +#define cat(x,y) x %:%:y +#define cat(x,y) x %:%:y +#undef cat +#define cat(x,y) x ## y +#define cat(x,y) x ## y +#undef cat +#define cat(x,y) x %:%: y +#define cat(x,y) x %:%: y +#undef cat + +#define cat3(x,y,z) x##y##z /* { dg-message "previous definition" } */ +#define cat3(x,y,z) x##y####z /* { dg-warning "redefined" } */ +#undef cat3 + +#define cat3(x,y,z) x##y####z /* { dg-message "previous definition" } */ +#define cat3(x,y,z) x####y##z /* { dg-warning "redefined" } */ +#undef cat3 + +#define cat3(x,y,z) x##y####z /* { dg-message "previous definition" } */ +#define cat3(x,y,z) x##y## ##z /* { dg-warning "redefined" } */ +#undef cat3 + +#define cat3(x,y,z) x##y####z /* { dg-message "previous definition" } */ +#define cat3(x,y,z) x##y##%:%:z /* { dg-warning "redefined" } */ +#undef cat3 + +#define cat3(x,y,z) x##y######## ####z /* { dg-message "previous definition" } */ +#define cat3(x,y,z) x##y############z /* { dg-warning "redefined" } */ +#undef cat3 + +#define cat3(x,y,z) x##y############z /* { dg-message "previous definition" } */ +#define cat3(x,y,z) x##y########%:%:##z /* { dg-warning "redefined" } */ +#undef cat3 + +#define cat3(x,y,z) x##y##z +#define cat3(x,y,z) x##y##z +#undef cat3 + +#define cat3(x,y,z) x##y####z +#define cat3(x,y,z) x##y####z +#undef cat3 + +#define cat3(x,y,z) x####y##z +#define cat3(x,y,z) x####y##z +#undef cat3 + +#define cat3(x,y,z) x##y## ##z +#define cat3(x,y,z) x##y## ##z +#undef cat3 + +#define cat3(x,y,z) x##y##%:%:z +#define cat3(x,y,z) x##y##%:%:z +#undef cat3 + +#define cat3(x,y,z) x##y######## ####z +#define cat3(x,y,z) x##y######## ####z +#undef cat3 + +#define cat3(x,y,z) x##y############z +#define cat3(x,y,z) x##y############z +#undef cat3 + +#define cat3(x,y,z) x##y########%:%:##z +#define cat3(x,y,z) x##y########%:%:##z +#undef cat3 diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/separate-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/separate-1.c new file mode 100644 index 000000000..33d910b3c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/separate-1.c @@ -0,0 +1,17 @@ +/* Copyright 2003 Free Software Foundation. */ + +/* { dg-do compile } */ +/* { dg-options "-save-temps" } */ + +/* Make sure we report errors in the right line, even if separate + preprocessing is used. */ + +#define FOO() + +int FOO( + ), bar; /* { dg-error "parse error|syntax error|expected" "error on this line" } */ + +int baz FOO /* { dg-error "parse error|syntax error|expected" "error on this line" } */ +; + +/* { dg-final { cleanup-saved-temps } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/skipping.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/skipping.c new file mode 100644 index 000000000..b8daa890b --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/skipping.c @@ -0,0 +1,25 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Tests expansion of macros whilst skipping false conditionals. */ + +/* Source: Neil Booth, 29 Oct 2000. */ + +#define F() +#define TRUE 1 + +#if 0 +F( /* No diagnostic: don't even try to expand it. */ +#endif + +#if 0 +#elif TRUE /* Expand this, even though we were skipping. */ +#else +#error Macros not expanded in #elif +#endif + +/* Check we don't warn about bad identifiers when skipping. */ +#if 0 +#define foo __VA_ARGS__ /* { dg-bogus "warned about identifier" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/skipping2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/skipping2.c new file mode 100644 index 000000000..14dafc01e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/skipping2.c @@ -0,0 +1,14 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Tests that excess tokens in skipped conditional blocks don't warn. */ + +/* Source: Neil Booth, 25 Jul 2001. */ + +#if 0 +#if foo +#else foo /* { dg-bogus "extra tokens" "extra tokens in skipped block" } */ +#endif foo /* { dg-bogus "extra tokens" "extra tokens in skipped block" } */ +#endif bar /* { dg-error "extra tokens" "tokens after #endif" } */ + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/spacing1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/spacing1.c new file mode 100644 index 000000000..c21a6b515 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/spacing1.c @@ -0,0 +1,66 @@ +/* Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-P" } */ + +/* This tests correct spacing of macro expansion output, as well as + the line it falls on. This is quite subtle; it involves newlines + within macro arguments becoming spaces, but not if it turns out to + not be a macro invocation. Also, multiple macro invocations spread + across many lines. + + Neil Booth, 1 Dec 2000, 23 Sep 2001. */ + +/* The actual location of the expansion of a multi-line macro + invocation is not defined: we might consider them to be in the same + line as the initial token of the invocation, or as the final token + of the invocation, or even anything in between. We choose to make + it the initial token, such that everything that is in a logical + line ends up in a single line after preprocessing. + + Alexandre Oliva, Sept 13, 2003. */ + +#define str(x) #x +#define f(x) x +#define glue(x, y) x ## y +#define EMPTY +/* These are based on PR 4492, we mustn't lose padding tokens when + scanning ahead for a '(' and failing to find it. */ +#define A(x) B x +#define B(x) +#define C A +#define D() A + +/* The correct output is shown here. Note the spaces, and the way + everything after the invocation of f appears on the same line. + + 44 ; +B Q B Q A Q A: +f +bar +A +bad +g "1 2" bam baz + +*/ + +glue (EMPTY 4, 4) EMPTY; +A(Q) C(Q) D()Q D(): +f +bar +A +bad +f (g) str +( +1 +2 +) f +(bam) baz + +/* { dg-final { scan-file spacing1.i " 44 ;" } } + { dg-final { scan-file spacing1.i "B Q B Q A Q A:" } } + { dg-final { scan-file-not spacing1.i "f\[^\n\]*bar" } } + { dg-final { scan-file spacing1.i "(^|\n)bar" } } + { dg-final { scan-file spacing1.i "(^|\n)A($|\n)" } } + { dg-final { scan-file spacing1.i "(^|\n)bad($|\n)" } } + { dg-final { scan-file spacing1.i "g \"1 2\" bam baz" } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/spacing2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/spacing2.c new file mode 100644 index 000000000..6cfa5a3d3 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/spacing2.c @@ -0,0 +1,16 @@ +/* Copyright (C) 2001, 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* We used to output an unnecessary leading space, leading to Emacs + confusion with its Makefile abuse. + + Neil Booth, 12 Oct 2001. */ + +#define EMPTY +#define foo bar + +a = EMPTY +foo.. /* No leading space on output. */ + +/* { dg-final { scan-file spacing2.i "(^|\n)bar\.\." } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/strify1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/strify1.c new file mode 100644 index 000000000..35355401a --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/strify1.c @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Test operator # semantics. */ + +#define OK1 # /* No problem. */ +#define OK2(x) x#x /* No problem. */ +#define bad1(x) # /* { dg-error "followed by a macro parameter" "#1" } */ +#define bad2(x) #y /* { dg-error "followed by a macro parameter" "#2" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/strify2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/strify2.c new file mode 100644 index 000000000..c24220c70 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/strify2.c @@ -0,0 +1,56 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do run } */ +/* { dg-options "-std=c99 -pedantic-errors" } */ + +/* Tests a whole bunch of things are correctly stringified. */ + +extern int strcmp (const char *, const char *); +extern int puts (const char *); +extern void abort (void); +#define err(str) do { puts(str); abort(); } while (0) + +#define str(x) #x +#define xstr(x) str(x) +#define strvar(...) #__VA_ARGS__ + +#define glibc_str(x) glibc_str2 (w, x) +#define glibc_str2(w, x) #x +#define ver GLIBC_2.2 + +int main (int argc, char *argv[]) +{ + str (\); /* { dg-warning "valid string" "str(\\)" } */ + str (\\); /* OK. */ + str (\\\); /* { dg-warning "valid string" "str(\\\\\\)" } */ + + /* This also serves as a useful test of the value of __INCLUDE_LEVEL. */ + if (strcmp (xstr (__INCLUDE_LEVEL__), "0")) + err ("macro expansion"); + + if (strcmp(str (__INCLUDE_LEVEL__), "__INCLUDE_LEVEL__")) + err ("macro name"); + + if (strcmp(str(), "") || strcmp(str( ), "")) + err ("empty string"); + + if (strcmp(str ("s\n"), "\"s\\n\"")) + err ("quoted string"); + + if (strcmp (str (a € b), "a \200 b")) + err ("unprintable char"); + + if (strcmp (str ( a b@ c ), "a b@ c")) + err ("internal whitespace"); + + if (strcmp (str(a \n), "a \n")) + err ("backslash token"); + + if (strcmp (strvar (foo, bar), "foo, bar")) + err ("variable arguments"); + + if (strcmp (glibc_str (ver), "GLIBC_2.2")) + err ("whitespace"); + + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/strify3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/strify3.c new file mode 100644 index 000000000..5d76b5e75 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/strify3.c @@ -0,0 +1,29 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do run } */ + +/* Tests we stringify without inserting a space. GCC 2.95.x and + earlier would insert a bogus space before bar in the string, simply + because a space was there in the invocation. + + Neil Booth, 24 Sep 2001. */ + +extern int strcmp (const char *, const char *); +extern int puts (const char *); +extern void abort (void); +#define err(str) do { puts(str); abort(); } while (0) + +#define str(x) #x +#define xstr(x) str(x) +#define glibc_hack(x, y) x@y + +int main (int argc, char *argv[]) +{ + /* The space before "bar" here is vital. */ + char a[] = xstr(glibc_hack(foo, bar)); + + if (strcmp (a, "foo@bar")) + err ("stringification without spaces"); + + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/strify4.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/strify4.c new file mode 100644 index 000000000..b8b2f11e9 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/strify4.c @@ -0,0 +1,25 @@ +/* { dg-do run } */ +/* Tests we stringify without changing unprintable characts. + + Andrew Pinski */ + +extern int strcmp (const char *, const char *); +extern int puts (const char *); +extern void abort (void); +#define err(str) do { puts(str); abort(); } while (0) + + +#define S(X) S2(X) +#define S2(X) #X +#define TAB " " /* Note there is a tab character here. */ + +int main (int argc, char *argv[]) +{ + /* The space before "bar" here is vital. */ + char a[] = S(S(TAB)); + + if (strcmp (a, "\"\\\" \\\"\"")) + err ("stringification caused octal"); + + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/strify5.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/strify5.c new file mode 100644 index 000000000..f56468281 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/strify5.c @@ -0,0 +1,1260 @@ +/* Test handling of spaces and empty macro expansions in + stringifying. PR 31869. */ +/* { dg-do run } */ + +extern int strcmp (const char *, const char *); +extern int puts (const char *); +extern void abort (void); +extern void exit (int); +#define err(str) do { puts (str); abort (); } while (0) + +#define s(x) #x +#define v(x, r) if (strcmp (s(x), r)) err (#x) + +#define EOA /* empty */ +#define EFA() /* empty */ +#define EOB EFA()EFA() +#define EOC EFA()EOA +#define EFB() EFA()EFA() +#define EFC() EFA()EOA +#define ARG(x) x +#define SOA EOA EOA +#define SOB ARG(EFB() EOA) +#define SOC ARG(SOA) +#define SFA() EOA EOA +#define SFB() ARG(EFB() EOA) +#define SFC() ARG(SOA) +#define SAa(x) x EOA +#define SAb(x) x EOB +#define SAc(x) x EOC +#define SAd(x) x EFA() +#define SAe(x) x EFB() +#define SAf(x) x EFC() +#define SBa(x) EOA x +#define SBb(x) EOB x +#define SBc(x) EOC x +#define SBd(x) SFA()x +#define SBe(x) SFB()x +#define SBf(x) SFC()x + +void +check0 (void) +{ + v(||, "||"); + v(|EOA|, "||"); + v(|EOB|, "||"); + v(|EOC|, "||"); + v(|EFA()|, "||"); + v(|EFB()|, "||"); + v(|EFC()|, "||"); +} + +void +check1 (void) +{ + v(|SBa(|), "| |"); + v(|SBb(|), "| |"); + v(|SBc(|), "| |"); + v(|SBd(|), "| |"); + v(|SBe(|), "| |"); + v(|SBf(|), "| |"); + v(| |, "| |"); + v(| SBa(|), "| |"); + v(| SBb(|), "| |"); + v(| SBc(|), "| |"); + v(| SBd(|), "| |"); + v(| SBe(|), "| |"); + v(| SBf(|), "| |"); + v(|EFA()SBa(|), "| |"); + v(|EFA()SBb(|), "| |"); + v(|EFA()SBc(|), "| |"); + v(|EFA()SBd(|), "| |"); + v(|EFA()SBe(|), "| |"); + v(|EFA()SBf(|), "| |"); + v(|EFB()SBa(|), "| |"); + v(|EFB()SBb(|), "| |"); + v(|EFB()SBc(|), "| |"); + v(|EFB()SBd(|), "| |"); + v(|EFB()SBe(|), "| |"); + v(|EFB()SBf(|), "| |"); + v(|EFC()SBa(|), "| |"); + v(|EFC()SBb(|), "| |"); + v(|EFC()SBc(|), "| |"); + v(|EFC()SBd(|), "| |"); + v(|EFC()SBe(|), "| |"); + v(|EFC()SBf(|), "| |"); + v(| EOA|, "| |"); + v(| EOB|, "| |"); + v(| EOC|, "| |"); + v(| EFA()|, "| |"); + v(| EFA()SBa(|), "| |"); + v(| EFA()SBb(|), "| |"); + v(| EFA()SBc(|), "| |"); + v(| EFA()SBd(|), "| |"); + v(| EFA()SBe(|), "| |"); + v(| EFA()SBf(|), "| |"); + v(| EFB()|, "| |"); + v(| EFB()SBa(|), "| |"); + v(| EFB()SBb(|), "| |"); + v(| EFB()SBc(|), "| |"); + v(| EFB()SBd(|), "| |"); + v(| EFB()SBe(|), "| |"); + v(| EFB()SBf(|), "| |"); + v(| EFC()|, "| |"); + v(| EFC()SBa(|), "| |"); + v(| EFC()SBb(|), "| |"); + v(| EFC()SBc(|), "| |"); + v(| EFC()SBd(|), "| |"); + v(| EFC()SBe(|), "| |"); + v(| EFC()SBf(|), "| |"); + v(|EOA |, "| |"); + v(|EOA SBa(|), "| |"); + v(|EOA SBb(|), "| |"); + v(|EOA SBc(|), "| |"); + v(|EOA SBd(|), "| |"); + v(|EOA SBe(|), "| |"); + v(|EOA SBf(|), "| |"); + v(|EOB |, "| |"); + v(|EOB SBa(|), "| |"); + v(|EOB SBb(|), "| |"); + v(|EOB SBc(|), "| |"); + v(|EOB SBd(|), "| |"); + v(|EOB SBe(|), "| |"); + v(|EOB SBf(|), "| |"); + v(|EOC |, "| |"); + v(|EOC SBa(|), "| |"); + v(|EOC SBb(|), "| |"); + v(|EOC SBc(|), "| |"); + v(|EOC SBd(|), "| |"); + v(|EOC SBe(|), "| |"); + v(|EOC SBf(|), "| |"); + v(|EFA() |, "| |"); + v(|EFA() SBa(|), "| |"); + v(|EFA() SBb(|), "| |"); + v(|EFA() SBc(|), "| |"); + v(|EFA() SBd(|), "| |"); + v(|EFA() SBe(|), "| |"); + v(|EFA() SBf(|), "| |"); + v(|EFB() |, "| |"); + v(|EFB() SBa(|), "| |"); + v(|EFB() SBb(|), "| |"); + v(|EFB() SBc(|), "| |"); + v(|EFB() SBd(|), "| |"); + v(|EFB() SBe(|), "| |"); + v(|EFB() SBf(|), "| |"); + v(|EFC() |, "| |"); + v(|EFC() SBa(|), "| |"); + v(|EFC() SBb(|), "| |"); + v(|EFC() SBc(|), "| |"); + v(|EFC() SBd(|), "| |"); + v(|EFC() SBe(|), "| |"); + v(|EFC() SBf(|), "| |"); + v(| EOA |, "| |"); + v(| EOA SBa(|), "| |"); + v(| EOA SBb(|), "| |"); + v(| EOA SBc(|), "| |"); + v(| EOA SBd(|), "| |"); + v(| EOA SBe(|), "| |"); + v(| EOA SBf(|), "| |"); + v(| EOB |, "| |"); + v(| EOB SBa(|), "| |"); + v(| EOB SBb(|), "| |"); + v(| EOB SBc(|), "| |"); + v(| EOB SBd(|), "| |"); + v(| EOB SBe(|), "| |"); + v(| EOB SBf(|), "| |"); + v(| EOC |, "| |"); + v(| EOC SBa(|), "| |"); + v(| EOC SBb(|), "| |"); + v(| EOC SBc(|), "| |"); + v(| EOC SBd(|), "| |"); + v(| EOC SBe(|), "| |"); + v(| EOC SBf(|), "| |"); + v(| EFA() |, "| |"); + v(| EFA() SBa(|), "| |"); + v(| EFA() SBb(|), "| |"); + v(| EFA() SBc(|), "| |"); + v(| EFA() SBd(|), "| |"); + v(| EFA() SBe(|), "| |"); + v(| EFA() SBf(|), "| |"); + v(| EFB() |, "| |"); + v(| EFB() SBa(|), "| |"); + v(| EFB() SBb(|), "| |"); + v(| EFB() SBc(|), "| |"); + v(| EFB() SBd(|), "| |"); + v(| EFB() SBe(|), "| |"); + v(| EFB() SBf(|), "| |"); + v(| EFC() |, "| |"); + v(| EFC() SBa(|), "| |"); + v(| EFC() SBb(|), "| |"); + v(| EFC() SBc(|), "| |"); + v(| EFC() SBd(|), "| |"); + v(| EFC() SBe(|), "| |"); + v(| EFC() SBf(|), "| |"); +} + +void +check2 (void) +{ + v(SAa(|)|, "| |"); + v(SAa(|)SBa(|), "| |"); + v(SAa(|)SBb(|), "| |"); + v(SAa(|)SBc(|), "| |"); + v(SAa(|)SBd(|), "| |"); + v(SAa(|)SBe(|), "| |"); + v(SAa(|)SBf(|), "| |"); + v(SAa(|) |, "| |"); + v(SAa(|) SBa(|), "| |"); + v(SAa(|) SBb(|), "| |"); + v(SAa(|) SBc(|), "| |"); + v(SAa(|) SBd(|), "| |"); + v(SAa(|) SBe(|), "| |"); + v(SAa(|) SBf(|), "| |"); + v(SAa(|)EOA|, "| |"); + v(SAa(|)EOB|, "| |"); + v(SAa(|)EOC|, "| |"); + v(SAa(|)EFA()|, "| |"); + v(SAa(|)EFA()SBa(|), "| |"); + v(SAa(|)EFA()SBb(|), "| |"); + v(SAa(|)EFA()SBc(|), "| |"); + v(SAa(|)EFA()SBd(|), "| |"); + v(SAa(|)EFA()SBe(|), "| |"); + v(SAa(|)EFA()SBf(|), "| |"); + v(SAa(|)EFB()|, "| |"); + v(SAa(|)EFB()SBa(|), "| |"); + v(SAa(|)EFB()SBb(|), "| |"); + v(SAa(|)EFB()SBc(|), "| |"); + v(SAa(|)EFB()SBd(|), "| |"); + v(SAa(|)EFB()SBe(|), "| |"); + v(SAa(|)EFB()SBf(|), "| |"); + v(SAa(|)EFC()|, "| |"); + v(SAa(|)EFC()SBa(|), "| |"); + v(SAa(|)EFC()SBb(|), "| |"); + v(SAa(|)EFC()SBc(|), "| |"); + v(SAa(|)EFC()SBd(|), "| |"); + v(SAa(|)EFC()SBe(|), "| |"); + v(SAa(|)EFC()SBf(|), "| |"); + v(SAa(|) EOA|, "| |"); + v(SAa(|) EOB|, "| |"); + v(SAa(|) EOC|, "| |"); + v(SAa(|) EFA()|, "| |"); + v(SAa(|) EFA()SBa(|), "| |"); + v(SAa(|) EFA()SBb(|), "| |"); + v(SAa(|) EFA()SBc(|), "| |"); + v(SAa(|) EFA()SBd(|), "| |"); + v(SAa(|) EFA()SBe(|), "| |"); + v(SAa(|) EFA()SBf(|), "| |"); + v(SAa(|) EFB()|, "| |"); + v(SAa(|) EFB()SBa(|), "| |"); + v(SAa(|) EFB()SBb(|), "| |"); + v(SAa(|) EFB()SBc(|), "| |"); + v(SAa(|) EFB()SBd(|), "| |"); + v(SAa(|) EFB()SBe(|), "| |"); + v(SAa(|) EFB()SBf(|), "| |"); + v(SAa(|) EFC()|, "| |"); + v(SAa(|) EFC()SBa(|), "| |"); + v(SAa(|) EFC()SBb(|), "| |"); + v(SAa(|) EFC()SBc(|), "| |"); + v(SAa(|) EFC()SBd(|), "| |"); + v(SAa(|) EFC()SBe(|), "| |"); + v(SAa(|) EFC()SBf(|), "| |"); + v(SAa(|)EOA |, "| |"); + v(SAa(|)EOA SBa(|), "| |"); + v(SAa(|)EOA SBb(|), "| |"); + v(SAa(|)EOA SBc(|), "| |"); + v(SAa(|)EOA SBd(|), "| |"); + v(SAa(|)EOA SBe(|), "| |"); + v(SAa(|)EOA SBf(|), "| |"); + v(SAa(|)EOB |, "| |"); + v(SAa(|)EOB SBa(|), "| |"); + v(SAa(|)EOB SBb(|), "| |"); + v(SAa(|)EOB SBc(|), "| |"); + v(SAa(|)EOB SBd(|), "| |"); + v(SAa(|)EOB SBe(|), "| |"); + v(SAa(|)EOB SBf(|), "| |"); + v(SAa(|)EOC |, "| |"); + v(SAa(|)EOC SBa(|), "| |"); + v(SAa(|)EOC SBb(|), "| |"); + v(SAa(|)EOC SBc(|), "| |"); + v(SAa(|)EOC SBd(|), "| |"); + v(SAa(|)EOC SBe(|), "| |"); + v(SAa(|)EOC SBf(|), "| |"); + v(SAa(|)EFA() |, "| |"); + v(SAa(|)EFA() SBa(|), "| |"); + v(SAa(|)EFA() SBb(|), "| |"); + v(SAa(|)EFA() SBc(|), "| |"); + v(SAa(|)EFA() SBd(|), "| |"); + v(SAa(|)EFA() SBe(|), "| |"); + v(SAa(|)EFA() SBf(|), "| |"); + v(SAa(|)EFB() |, "| |"); + v(SAa(|)EFB() SBa(|), "| |"); + v(SAa(|)EFB() SBb(|), "| |"); + v(SAa(|)EFB() SBc(|), "| |"); + v(SAa(|)EFB() SBd(|), "| |"); + v(SAa(|)EFB() SBe(|), "| |"); + v(SAa(|)EFB() SBf(|), "| |"); + v(SAa(|)EFC() |, "| |"); + v(SAa(|)EFC() SBa(|), "| |"); + v(SAa(|)EFC() SBb(|), "| |"); + v(SAa(|)EFC() SBc(|), "| |"); + v(SAa(|)EFC() SBd(|), "| |"); + v(SAa(|)EFC() SBe(|), "| |"); + v(SAa(|)EFC() SBf(|), "| |"); + v(SAa(|) EOA |, "| |"); + v(SAa(|) EOA SBa(|), "| |"); + v(SAa(|) EOA SBb(|), "| |"); + v(SAa(|) EOA SBc(|), "| |"); + v(SAa(|) EOA SBd(|), "| |"); + v(SAa(|) EOA SBe(|), "| |"); + v(SAa(|) EOA SBf(|), "| |"); + v(SAa(|) EOB |, "| |"); + v(SAa(|) EOB SBa(|), "| |"); + v(SAa(|) EOB SBb(|), "| |"); + v(SAa(|) EOB SBc(|), "| |"); + v(SAa(|) EOB SBd(|), "| |"); + v(SAa(|) EOB SBe(|), "| |"); + v(SAa(|) EOB SBf(|), "| |"); + v(SAa(|) EOC |, "| |"); + v(SAa(|) EOC SBa(|), "| |"); + v(SAa(|) EOC SBb(|), "| |"); + v(SAa(|) EOC SBc(|), "| |"); + v(SAa(|) EOC SBd(|), "| |"); + v(SAa(|) EOC SBe(|), "| |"); + v(SAa(|) EOC SBf(|), "| |"); + v(SAa(|) EFA() |, "| |"); + v(SAa(|) EFA() SBa(|), "| |"); + v(SAa(|) EFA() SBb(|), "| |"); + v(SAa(|) EFA() SBc(|), "| |"); + v(SAa(|) EFA() SBd(|), "| |"); + v(SAa(|) EFA() SBe(|), "| |"); + v(SAa(|) EFA() SBf(|), "| |"); + v(SAa(|) EFB() |, "| |"); + v(SAa(|) EFB() SBa(|), "| |"); + v(SAa(|) EFB() SBb(|), "| |"); + v(SAa(|) EFB() SBc(|), "| |"); + v(SAa(|) EFB() SBd(|), "| |"); + v(SAa(|) EFB() SBe(|), "| |"); + v(SAa(|) EFB() SBf(|), "| |"); + v(SAa(|) EFC() |, "| |"); + v(SAa(|) EFC() SBa(|), "| |"); + v(SAa(|) EFC() SBb(|), "| |"); + v(SAa(|) EFC() SBc(|), "| |"); + v(SAa(|) EFC() SBd(|), "| |"); + v(SAa(|) EFC() SBe(|), "| |"); + v(SAa(|) EFC() SBf(|), "| |"); +} + +void +check3 (void) +{ + v(SAb(|)|, "| |"); + v(SAb(|)SBa(|), "| |"); + v(SAb(|)SBb(|), "| |"); + v(SAb(|)SBc(|), "| |"); + v(SAb(|)SBd(|), "| |"); + v(SAb(|)SBe(|), "| |"); + v(SAb(|)SBf(|), "| |"); + v(SAb(|) |, "| |"); + v(SAb(|) SBa(|), "| |"); + v(SAb(|) SBb(|), "| |"); + v(SAb(|) SBc(|), "| |"); + v(SAb(|) SBd(|), "| |"); + v(SAb(|) SBe(|), "| |"); + v(SAb(|) SBf(|), "| |"); + v(SAb(|)EOA|, "| |"); + v(SAb(|)EOB|, "| |"); + v(SAb(|)EOC|, "| |"); + v(SAb(|)EFA()|, "| |"); + v(SAb(|)EFA()SBa(|), "| |"); + v(SAb(|)EFA()SBb(|), "| |"); + v(SAb(|)EFA()SBc(|), "| |"); + v(SAb(|)EFA()SBd(|), "| |"); + v(SAb(|)EFA()SBe(|), "| |"); + v(SAb(|)EFA()SBf(|), "| |"); + v(SAb(|)EFB()|, "| |"); + v(SAb(|)EFB()SBa(|), "| |"); + v(SAb(|)EFB()SBb(|), "| |"); + v(SAb(|)EFB()SBc(|), "| |"); + v(SAb(|)EFB()SBd(|), "| |"); + v(SAb(|)EFB()SBe(|), "| |"); + v(SAb(|)EFB()SBf(|), "| |"); + v(SAb(|)EFC()|, "| |"); + v(SAb(|)EFC()SBa(|), "| |"); + v(SAb(|)EFC()SBb(|), "| |"); + v(SAb(|)EFC()SBc(|), "| |"); + v(SAb(|)EFC()SBd(|), "| |"); + v(SAb(|)EFC()SBe(|), "| |"); + v(SAb(|)EFC()SBf(|), "| |"); + v(SAb(|) EOA|, "| |"); + v(SAb(|) EOB|, "| |"); + v(SAb(|) EOC|, "| |"); + v(SAb(|) EFA()|, "| |"); + v(SAb(|) EFA()SBa(|), "| |"); + v(SAb(|) EFA()SBb(|), "| |"); + v(SAb(|) EFA()SBc(|), "| |"); + v(SAb(|) EFA()SBd(|), "| |"); + v(SAb(|) EFA()SBe(|), "| |"); + v(SAb(|) EFA()SBf(|), "| |"); + v(SAb(|) EFB()|, "| |"); + v(SAb(|) EFB()SBa(|), "| |"); + v(SAb(|) EFB()SBb(|), "| |"); + v(SAb(|) EFB()SBc(|), "| |"); + v(SAb(|) EFB()SBd(|), "| |"); + v(SAb(|) EFB()SBe(|), "| |"); + v(SAb(|) EFB()SBf(|), "| |"); + v(SAb(|) EFC()|, "| |"); + v(SAb(|) EFC()SBa(|), "| |"); + v(SAb(|) EFC()SBb(|), "| |"); + v(SAb(|) EFC()SBc(|), "| |"); + v(SAb(|) EFC()SBd(|), "| |"); + v(SAb(|) EFC()SBe(|), "| |"); + v(SAb(|) EFC()SBf(|), "| |"); + v(SAb(|)EOA |, "| |"); + v(SAb(|)EOA SBa(|), "| |"); + v(SAb(|)EOA SBb(|), "| |"); + v(SAb(|)EOA SBc(|), "| |"); + v(SAb(|)EOA SBd(|), "| |"); + v(SAb(|)EOA SBe(|), "| |"); + v(SAb(|)EOA SBf(|), "| |"); + v(SAb(|)EOB |, "| |"); + v(SAb(|)EOB SBa(|), "| |"); + v(SAb(|)EOB SBb(|), "| |"); + v(SAb(|)EOB SBc(|), "| |"); + v(SAb(|)EOB SBd(|), "| |"); + v(SAb(|)EOB SBe(|), "| |"); + v(SAb(|)EOB SBf(|), "| |"); + v(SAb(|)EOC |, "| |"); + v(SAb(|)EOC SBa(|), "| |"); + v(SAb(|)EOC SBb(|), "| |"); + v(SAb(|)EOC SBc(|), "| |"); + v(SAb(|)EOC SBd(|), "| |"); + v(SAb(|)EOC SBe(|), "| |"); + v(SAb(|)EOC SBf(|), "| |"); + v(SAb(|)EFA() |, "| |"); + v(SAb(|)EFA() SBa(|), "| |"); + v(SAb(|)EFA() SBb(|), "| |"); + v(SAb(|)EFA() SBc(|), "| |"); + v(SAb(|)EFA() SBd(|), "| |"); + v(SAb(|)EFA() SBe(|), "| |"); + v(SAb(|)EFA() SBf(|), "| |"); + v(SAb(|)EFB() |, "| |"); + v(SAb(|)EFB() SBa(|), "| |"); + v(SAb(|)EFB() SBb(|), "| |"); + v(SAb(|)EFB() SBc(|), "| |"); + v(SAb(|)EFB() SBd(|), "| |"); + v(SAb(|)EFB() SBe(|), "| |"); + v(SAb(|)EFB() SBf(|), "| |"); + v(SAb(|)EFC() |, "| |"); + v(SAb(|)EFC() SBa(|), "| |"); + v(SAb(|)EFC() SBb(|), "| |"); + v(SAb(|)EFC() SBc(|), "| |"); + v(SAb(|)EFC() SBd(|), "| |"); + v(SAb(|)EFC() SBe(|), "| |"); + v(SAb(|)EFC() SBf(|), "| |"); + v(SAb(|) EOA |, "| |"); + v(SAb(|) EOA SBa(|), "| |"); + v(SAb(|) EOA SBb(|), "| |"); + v(SAb(|) EOA SBc(|), "| |"); + v(SAb(|) EOA SBd(|), "| |"); + v(SAb(|) EOA SBe(|), "| |"); + v(SAb(|) EOA SBf(|), "| |"); + v(SAb(|) EOB |, "| |"); + v(SAb(|) EOB SBa(|), "| |"); + v(SAb(|) EOB SBb(|), "| |"); + v(SAb(|) EOB SBc(|), "| |"); + v(SAb(|) EOB SBd(|), "| |"); + v(SAb(|) EOB SBe(|), "| |"); + v(SAb(|) EOB SBf(|), "| |"); + v(SAb(|) EOC |, "| |"); + v(SAb(|) EOC SBa(|), "| |"); + v(SAb(|) EOC SBb(|), "| |"); + v(SAb(|) EOC SBc(|), "| |"); + v(SAb(|) EOC SBd(|), "| |"); + v(SAb(|) EOC SBe(|), "| |"); + v(SAb(|) EOC SBf(|), "| |"); + v(SAb(|) EFA() |, "| |"); + v(SAb(|) EFA() SBa(|), "| |"); + v(SAb(|) EFA() SBb(|), "| |"); + v(SAb(|) EFA() SBc(|), "| |"); + v(SAb(|) EFA() SBd(|), "| |"); + v(SAb(|) EFA() SBe(|), "| |"); + v(SAb(|) EFA() SBf(|), "| |"); + v(SAb(|) EFB() |, "| |"); + v(SAb(|) EFB() SBa(|), "| |"); + v(SAb(|) EFB() SBb(|), "| |"); + v(SAb(|) EFB() SBc(|), "| |"); + v(SAb(|) EFB() SBd(|), "| |"); + v(SAb(|) EFB() SBe(|), "| |"); + v(SAb(|) EFB() SBf(|), "| |"); + v(SAb(|) EFC() |, "| |"); + v(SAb(|) EFC() SBa(|), "| |"); + v(SAb(|) EFC() SBb(|), "| |"); + v(SAb(|) EFC() SBc(|), "| |"); + v(SAb(|) EFC() SBd(|), "| |"); + v(SAb(|) EFC() SBe(|), "| |"); + v(SAb(|) EFC() SBf(|), "| |"); +} + +void +check4 (void) +{ + v(SAc(|)|, "| |"); + v(SAc(|)SBa(|), "| |"); + v(SAc(|)SBb(|), "| |"); + v(SAc(|)SBc(|), "| |"); + v(SAc(|)SBd(|), "| |"); + v(SAc(|)SBe(|), "| |"); + v(SAc(|)SBf(|), "| |"); + v(SAc(|) |, "| |"); + v(SAc(|) SBa(|), "| |"); + v(SAc(|) SBb(|), "| |"); + v(SAc(|) SBc(|), "| |"); + v(SAc(|) SBd(|), "| |"); + v(SAc(|) SBe(|), "| |"); + v(SAc(|) SBf(|), "| |"); + v(SAc(|)EOA|, "| |"); + v(SAc(|)EOB|, "| |"); + v(SAc(|)EOC|, "| |"); + v(SAc(|)EFA()|, "| |"); + v(SAc(|)EFA()SBa(|), "| |"); + v(SAc(|)EFA()SBb(|), "| |"); + v(SAc(|)EFA()SBc(|), "| |"); + v(SAc(|)EFA()SBd(|), "| |"); + v(SAc(|)EFA()SBe(|), "| |"); + v(SAc(|)EFA()SBf(|), "| |"); + v(SAc(|)EFB()|, "| |"); + v(SAc(|)EFB()SBa(|), "| |"); + v(SAc(|)EFB()SBb(|), "| |"); + v(SAc(|)EFB()SBc(|), "| |"); + v(SAc(|)EFB()SBd(|), "| |"); + v(SAc(|)EFB()SBe(|), "| |"); + v(SAc(|)EFB()SBf(|), "| |"); + v(SAc(|)EFC()|, "| |"); + v(SAc(|)EFC()SBa(|), "| |"); + v(SAc(|)EFC()SBb(|), "| |"); + v(SAc(|)EFC()SBc(|), "| |"); + v(SAc(|)EFC()SBd(|), "| |"); + v(SAc(|)EFC()SBe(|), "| |"); + v(SAc(|)EFC()SBf(|), "| |"); + v(SAc(|) EOA|, "| |"); + v(SAc(|) EOB|, "| |"); + v(SAc(|) EOC|, "| |"); + v(SAc(|) EFA()|, "| |"); + v(SAc(|) EFA()SBa(|), "| |"); + v(SAc(|) EFA()SBb(|), "| |"); + v(SAc(|) EFA()SBc(|), "| |"); + v(SAc(|) EFA()SBd(|), "| |"); + v(SAc(|) EFA()SBe(|), "| |"); + v(SAc(|) EFA()SBf(|), "| |"); + v(SAc(|) EFB()|, "| |"); + v(SAc(|) EFB()SBa(|), "| |"); + v(SAc(|) EFB()SBb(|), "| |"); + v(SAc(|) EFB()SBc(|), "| |"); + v(SAc(|) EFB()SBd(|), "| |"); + v(SAc(|) EFB()SBe(|), "| |"); + v(SAc(|) EFB()SBf(|), "| |"); + v(SAc(|) EFC()|, "| |"); + v(SAc(|) EFC()SBa(|), "| |"); + v(SAc(|) EFC()SBb(|), "| |"); + v(SAc(|) EFC()SBc(|), "| |"); + v(SAc(|) EFC()SBd(|), "| |"); + v(SAc(|) EFC()SBe(|), "| |"); + v(SAc(|) EFC()SBf(|), "| |"); + v(SAc(|)EOA |, "| |"); + v(SAc(|)EOA SBa(|), "| |"); + v(SAc(|)EOA SBb(|), "| |"); + v(SAc(|)EOA SBc(|), "| |"); + v(SAc(|)EOA SBd(|), "| |"); + v(SAc(|)EOA SBe(|), "| |"); + v(SAc(|)EOA SBf(|), "| |"); + v(SAc(|)EOB |, "| |"); + v(SAc(|)EOB SBa(|), "| |"); + v(SAc(|)EOB SBb(|), "| |"); + v(SAc(|)EOB SBc(|), "| |"); + v(SAc(|)EOB SBd(|), "| |"); + v(SAc(|)EOB SBe(|), "| |"); + v(SAc(|)EOB SBf(|), "| |"); + v(SAc(|)EOC |, "| |"); + v(SAc(|)EOC SBa(|), "| |"); + v(SAc(|)EOC SBb(|), "| |"); + v(SAc(|)EOC SBc(|), "| |"); + v(SAc(|)EOC SBd(|), "| |"); + v(SAc(|)EOC SBe(|), "| |"); + v(SAc(|)EOC SBf(|), "| |"); + v(SAc(|)EFA() |, "| |"); + v(SAc(|)EFA() SBa(|), "| |"); + v(SAc(|)EFA() SBb(|), "| |"); + v(SAc(|)EFA() SBc(|), "| |"); + v(SAc(|)EFA() SBd(|), "| |"); + v(SAc(|)EFA() SBe(|), "| |"); + v(SAc(|)EFA() SBf(|), "| |"); + v(SAc(|)EFB() |, "| |"); + v(SAc(|)EFB() SBa(|), "| |"); + v(SAc(|)EFB() SBb(|), "| |"); + v(SAc(|)EFB() SBc(|), "| |"); + v(SAc(|)EFB() SBd(|), "| |"); + v(SAc(|)EFB() SBe(|), "| |"); + v(SAc(|)EFB() SBf(|), "| |"); + v(SAc(|)EFC() |, "| |"); + v(SAc(|)EFC() SBa(|), "| |"); + v(SAc(|)EFC() SBb(|), "| |"); + v(SAc(|)EFC() SBc(|), "| |"); + v(SAc(|)EFC() SBd(|), "| |"); + v(SAc(|)EFC() SBe(|), "| |"); + v(SAc(|)EFC() SBf(|), "| |"); + v(SAc(|) EOA |, "| |"); + v(SAc(|) EOA SBa(|), "| |"); + v(SAc(|) EOA SBb(|), "| |"); + v(SAc(|) EOA SBc(|), "| |"); + v(SAc(|) EOA SBd(|), "| |"); + v(SAc(|) EOA SBe(|), "| |"); + v(SAc(|) EOA SBf(|), "| |"); + v(SAc(|) EOB |, "| |"); + v(SAc(|) EOB SBa(|), "| |"); + v(SAc(|) EOB SBb(|), "| |"); + v(SAc(|) EOB SBc(|), "| |"); + v(SAc(|) EOB SBd(|), "| |"); + v(SAc(|) EOB SBe(|), "| |"); + v(SAc(|) EOB SBf(|), "| |"); + v(SAc(|) EOC |, "| |"); + v(SAc(|) EOC SBa(|), "| |"); + v(SAc(|) EOC SBb(|), "| |"); + v(SAc(|) EOC SBc(|), "| |"); + v(SAc(|) EOC SBd(|), "| |"); + v(SAc(|) EOC SBe(|), "| |"); + v(SAc(|) EOC SBf(|), "| |"); + v(SAc(|) EFA() |, "| |"); + v(SAc(|) EFA() SBa(|), "| |"); + v(SAc(|) EFA() SBb(|), "| |"); + v(SAc(|) EFA() SBc(|), "| |"); + v(SAc(|) EFA() SBd(|), "| |"); + v(SAc(|) EFA() SBe(|), "| |"); + v(SAc(|) EFA() SBf(|), "| |"); + v(SAc(|) EFB() |, "| |"); + v(SAc(|) EFB() SBa(|), "| |"); + v(SAc(|) EFB() SBb(|), "| |"); + v(SAc(|) EFB() SBc(|), "| |"); + v(SAc(|) EFB() SBd(|), "| |"); + v(SAc(|) EFB() SBe(|), "| |"); + v(SAc(|) EFB() SBf(|), "| |"); + v(SAc(|) EFC() |, "| |"); + v(SAc(|) EFC() SBa(|), "| |"); + v(SAc(|) EFC() SBb(|), "| |"); + v(SAc(|) EFC() SBc(|), "| |"); + v(SAc(|) EFC() SBd(|), "| |"); + v(SAc(|) EFC() SBe(|), "| |"); + v(SAc(|) EFC() SBf(|), "| |"); + v(SAc(|)|, "| |"); + v(SAc(|)SBa(|), "| |"); + v(SAc(|)SBb(|), "| |"); + v(SAc(|)SBc(|), "| |"); + v(SAc(|)SBd(|), "| |"); + v(SAc(|)SBe(|), "| |"); + v(SAc(|)SBf(|), "| |"); + v(SAc(|) |, "| |"); + v(SAc(|) SBa(|), "| |"); + v(SAc(|) SBb(|), "| |"); + v(SAc(|) SBc(|), "| |"); + v(SAc(|) SBd(|), "| |"); + v(SAc(|) SBe(|), "| |"); + v(SAc(|) SBf(|), "| |"); + v(SAc(|)EOA|, "| |"); + v(SAc(|)EOB|, "| |"); + v(SAc(|)EOC|, "| |"); + v(SAc(|)EFA()|, "| |"); + v(SAc(|)EFA()SBa(|), "| |"); + v(SAc(|)EFA()SBb(|), "| |"); + v(SAc(|)EFA()SBc(|), "| |"); + v(SAc(|)EFA()SBd(|), "| |"); + v(SAc(|)EFA()SBe(|), "| |"); + v(SAc(|)EFA()SBf(|), "| |"); + v(SAc(|)EFB()|, "| |"); + v(SAc(|)EFB()SBa(|), "| |"); + v(SAc(|)EFB()SBb(|), "| |"); + v(SAc(|)EFB()SBc(|), "| |"); + v(SAc(|)EFB()SBd(|), "| |"); + v(SAc(|)EFB()SBe(|), "| |"); + v(SAc(|)EFB()SBf(|), "| |"); + v(SAc(|)EFC()|, "| |"); + v(SAc(|)EFC()SBa(|), "| |"); + v(SAc(|)EFC()SBb(|), "| |"); + v(SAc(|)EFC()SBc(|), "| |"); + v(SAc(|)EFC()SBd(|), "| |"); + v(SAc(|)EFC()SBe(|), "| |"); + v(SAc(|)EFC()SBf(|), "| |"); + v(SAc(|) EOA|, "| |"); + v(SAc(|) EOB|, "| |"); + v(SAc(|) EOC|, "| |"); + v(SAc(|) EFA()|, "| |"); + v(SAc(|) EFA()SBa(|), "| |"); + v(SAc(|) EFA()SBb(|), "| |"); + v(SAc(|) EFA()SBc(|), "| |"); + v(SAc(|) EFA()SBd(|), "| |"); + v(SAc(|) EFA()SBe(|), "| |"); + v(SAc(|) EFA()SBf(|), "| |"); + v(SAc(|) EFB()|, "| |"); + v(SAc(|) EFB()SBa(|), "| |"); + v(SAc(|) EFB()SBb(|), "| |"); + v(SAc(|) EFB()SBc(|), "| |"); + v(SAc(|) EFB()SBd(|), "| |"); + v(SAc(|) EFB()SBe(|), "| |"); + v(SAc(|) EFB()SBf(|), "| |"); + v(SAc(|) EFC()|, "| |"); + v(SAc(|) EFC()SBa(|), "| |"); + v(SAc(|) EFC()SBb(|), "| |"); + v(SAc(|) EFC()SBc(|), "| |"); + v(SAc(|) EFC()SBd(|), "| |"); + v(SAc(|) EFC()SBe(|), "| |"); + v(SAc(|) EFC()SBf(|), "| |"); + v(SAc(|)EOA |, "| |"); + v(SAc(|)EOA SBa(|), "| |"); + v(SAc(|)EOA SBb(|), "| |"); + v(SAc(|)EOA SBc(|), "| |"); + v(SAc(|)EOA SBd(|), "| |"); + v(SAc(|)EOA SBe(|), "| |"); + v(SAc(|)EOA SBf(|), "| |"); + v(SAc(|)EOB |, "| |"); + v(SAc(|)EOB SBa(|), "| |"); + v(SAc(|)EOB SBb(|), "| |"); + v(SAc(|)EOB SBc(|), "| |"); + v(SAc(|)EOB SBd(|), "| |"); + v(SAc(|)EOB SBe(|), "| |"); + v(SAc(|)EOB SBf(|), "| |"); + v(SAc(|)EOC |, "| |"); + v(SAc(|)EOC SBa(|), "| |"); + v(SAc(|)EOC SBb(|), "| |"); + v(SAc(|)EOC SBc(|), "| |"); + v(SAc(|)EOC SBd(|), "| |"); + v(SAc(|)EOC SBe(|), "| |"); + v(SAc(|)EOC SBf(|), "| |"); + v(SAc(|)EFA() |, "| |"); + v(SAc(|)EFA() SBa(|), "| |"); + v(SAc(|)EFA() SBb(|), "| |"); + v(SAc(|)EFA() SBc(|), "| |"); + v(SAc(|)EFA() SBd(|), "| |"); + v(SAc(|)EFA() SBe(|), "| |"); + v(SAc(|)EFA() SBf(|), "| |"); + v(SAc(|)EFB() |, "| |"); + v(SAc(|)EFB() SBa(|), "| |"); + v(SAc(|)EFB() SBb(|), "| |"); + v(SAc(|)EFB() SBc(|), "| |"); + v(SAc(|)EFB() SBd(|), "| |"); + v(SAc(|)EFB() SBe(|), "| |"); + v(SAc(|)EFB() SBf(|), "| |"); + v(SAc(|)EFC() |, "| |"); + v(SAc(|)EFC() SBa(|), "| |"); + v(SAc(|)EFC() SBb(|), "| |"); + v(SAc(|)EFC() SBc(|), "| |"); + v(SAc(|)EFC() SBd(|), "| |"); + v(SAc(|)EFC() SBe(|), "| |"); + v(SAc(|)EFC() SBf(|), "| |"); + v(SAc(|) EOA |, "| |"); + v(SAc(|) EOA SBa(|), "| |"); + v(SAc(|) EOA SBb(|), "| |"); + v(SAc(|) EOA SBc(|), "| |"); + v(SAc(|) EOA SBd(|), "| |"); + v(SAc(|) EOA SBe(|), "| |"); + v(SAc(|) EOA SBf(|), "| |"); + v(SAc(|) EOB |, "| |"); + v(SAc(|) EOB SBa(|), "| |"); + v(SAc(|) EOB SBb(|), "| |"); + v(SAc(|) EOB SBc(|), "| |"); + v(SAc(|) EOB SBd(|), "| |"); + v(SAc(|) EOB SBe(|), "| |"); + v(SAc(|) EOB SBf(|), "| |"); + v(SAc(|) EOC |, "| |"); + v(SAc(|) EOC SBa(|), "| |"); + v(SAc(|) EOC SBb(|), "| |"); + v(SAc(|) EOC SBc(|), "| |"); + v(SAc(|) EOC SBd(|), "| |"); + v(SAc(|) EOC SBe(|), "| |"); + v(SAc(|) EOC SBf(|), "| |"); + v(SAc(|) EFA() |, "| |"); + v(SAc(|) EFA() SBa(|), "| |"); + v(SAc(|) EFA() SBb(|), "| |"); + v(SAc(|) EFA() SBc(|), "| |"); + v(SAc(|) EFA() SBd(|), "| |"); + v(SAc(|) EFA() SBe(|), "| |"); + v(SAc(|) EFA() SBf(|), "| |"); + v(SAc(|) EFB() |, "| |"); + v(SAc(|) EFB() SBa(|), "| |"); + v(SAc(|) EFB() SBb(|), "| |"); + v(SAc(|) EFB() SBc(|), "| |"); + v(SAc(|) EFB() SBd(|), "| |"); + v(SAc(|) EFB() SBe(|), "| |"); + v(SAc(|) EFB() SBf(|), "| |"); + v(SAc(|) EFC() |, "| |"); + v(SAc(|) EFC() SBa(|), "| |"); + v(SAc(|) EFC() SBb(|), "| |"); + v(SAc(|) EFC() SBc(|), "| |"); + v(SAc(|) EFC() SBd(|), "| |"); + v(SAc(|) EFC() SBe(|), "| |"); + v(SAc(|) EFC() SBf(|), "| |"); +} + +void +check5 (void) +{ + v(SAd(|)|, "| |"); + v(SAd(|)SBa(|), "| |"); + v(SAd(|)SBb(|), "| |"); + v(SAd(|)SBc(|), "| |"); + v(SAd(|)SBd(|), "| |"); + v(SAd(|)SBe(|), "| |"); + v(SAd(|)SBf(|), "| |"); + v(SAd(|) |, "| |"); + v(SAd(|) SBa(|), "| |"); + v(SAd(|) SBb(|), "| |"); + v(SAd(|) SBc(|), "| |"); + v(SAd(|) SBd(|), "| |"); + v(SAd(|) SBe(|), "| |"); + v(SAd(|) SBf(|), "| |"); + v(SAd(|)EOA|, "| |"); + v(SAd(|)EOB|, "| |"); + v(SAd(|)EOC|, "| |"); + v(SAd(|)EFA()|, "| |"); + v(SAd(|)EFA()SBa(|), "| |"); + v(SAd(|)EFA()SBb(|), "| |"); + v(SAd(|)EFA()SBc(|), "| |"); + v(SAd(|)EFA()SBd(|), "| |"); + v(SAd(|)EFA()SBe(|), "| |"); + v(SAd(|)EFA()SBf(|), "| |"); + v(SAd(|)EFB()|, "| |"); + v(SAd(|)EFB()SBa(|), "| |"); + v(SAd(|)EFB()SBb(|), "| |"); + v(SAd(|)EFB()SBc(|), "| |"); + v(SAd(|)EFB()SBd(|), "| |"); + v(SAd(|)EFB()SBe(|), "| |"); + v(SAd(|)EFB()SBf(|), "| |"); + v(SAd(|)EFC()|, "| |"); + v(SAd(|)EFC()SBa(|), "| |"); + v(SAd(|)EFC()SBb(|), "| |"); + v(SAd(|)EFC()SBc(|), "| |"); + v(SAd(|)EFC()SBd(|), "| |"); + v(SAd(|)EFC()SBe(|), "| |"); + v(SAd(|)EFC()SBf(|), "| |"); + v(SAd(|) EOA|, "| |"); + v(SAd(|) EOB|, "| |"); + v(SAd(|) EOC|, "| |"); + v(SAd(|) EFA()|, "| |"); + v(SAd(|) EFA()SBa(|), "| |"); + v(SAd(|) EFA()SBb(|), "| |"); + v(SAd(|) EFA()SBc(|), "| |"); + v(SAd(|) EFA()SBd(|), "| |"); + v(SAd(|) EFA()SBe(|), "| |"); + v(SAd(|) EFA()SBf(|), "| |"); + v(SAd(|) EFB()|, "| |"); + v(SAd(|) EFB()SBa(|), "| |"); + v(SAd(|) EFB()SBb(|), "| |"); + v(SAd(|) EFB()SBc(|), "| |"); + v(SAd(|) EFB()SBd(|), "| |"); + v(SAd(|) EFB()SBe(|), "| |"); + v(SAd(|) EFB()SBf(|), "| |"); + v(SAd(|) EFC()|, "| |"); + v(SAd(|) EFC()SBa(|), "| |"); + v(SAd(|) EFC()SBb(|), "| |"); + v(SAd(|) EFC()SBc(|), "| |"); + v(SAd(|) EFC()SBd(|), "| |"); + v(SAd(|) EFC()SBe(|), "| |"); + v(SAd(|) EFC()SBf(|), "| |"); + v(SAd(|)EOA |, "| |"); + v(SAd(|)EOA SBa(|), "| |"); + v(SAd(|)EOA SBb(|), "| |"); + v(SAd(|)EOA SBc(|), "| |"); + v(SAd(|)EOA SBd(|), "| |"); + v(SAd(|)EOA SBe(|), "| |"); + v(SAd(|)EOA SBf(|), "| |"); + v(SAd(|)EOB |, "| |"); + v(SAd(|)EOB SBa(|), "| |"); + v(SAd(|)EOB SBb(|), "| |"); + v(SAd(|)EOB SBc(|), "| |"); + v(SAd(|)EOB SBd(|), "| |"); + v(SAd(|)EOB SBe(|), "| |"); + v(SAd(|)EOB SBf(|), "| |"); + v(SAd(|)EOC |, "| |"); + v(SAd(|)EOC SBa(|), "| |"); + v(SAd(|)EOC SBb(|), "| |"); + v(SAd(|)EOC SBc(|), "| |"); + v(SAd(|)EOC SBd(|), "| |"); + v(SAd(|)EOC SBe(|), "| |"); + v(SAd(|)EOC SBf(|), "| |"); + v(SAd(|)EFA() |, "| |"); + v(SAd(|)EFA() SBa(|), "| |"); + v(SAd(|)EFA() SBb(|), "| |"); + v(SAd(|)EFA() SBc(|), "| |"); + v(SAd(|)EFA() SBd(|), "| |"); + v(SAd(|)EFA() SBe(|), "| |"); + v(SAd(|)EFA() SBf(|), "| |"); + v(SAd(|)EFB() |, "| |"); + v(SAd(|)EFB() SBa(|), "| |"); + v(SAd(|)EFB() SBb(|), "| |"); + v(SAd(|)EFB() SBc(|), "| |"); + v(SAd(|)EFB() SBd(|), "| |"); + v(SAd(|)EFB() SBe(|), "| |"); + v(SAd(|)EFB() SBf(|), "| |"); + v(SAd(|)EFC() |, "| |"); + v(SAd(|)EFC() SBa(|), "| |"); + v(SAd(|)EFC() SBb(|), "| |"); + v(SAd(|)EFC() SBc(|), "| |"); + v(SAd(|)EFC() SBd(|), "| |"); + v(SAd(|)EFC() SBe(|), "| |"); + v(SAd(|)EFC() SBf(|), "| |"); + v(SAd(|) EOA |, "| |"); + v(SAd(|) EOA SBa(|), "| |"); + v(SAd(|) EOA SBb(|), "| |"); + v(SAd(|) EOA SBc(|), "| |"); + v(SAd(|) EOA SBd(|), "| |"); + v(SAd(|) EOA SBe(|), "| |"); + v(SAd(|) EOA SBf(|), "| |"); + v(SAd(|) EOB |, "| |"); + v(SAd(|) EOB SBa(|), "| |"); + v(SAd(|) EOB SBb(|), "| |"); + v(SAd(|) EOB SBc(|), "| |"); + v(SAd(|) EOB SBd(|), "| |"); + v(SAd(|) EOB SBe(|), "| |"); + v(SAd(|) EOB SBf(|), "| |"); + v(SAd(|) EOC |, "| |"); + v(SAd(|) EOC SBa(|), "| |"); + v(SAd(|) EOC SBb(|), "| |"); + v(SAd(|) EOC SBc(|), "| |"); + v(SAd(|) EOC SBd(|), "| |"); + v(SAd(|) EOC SBe(|), "| |"); + v(SAd(|) EOC SBf(|), "| |"); + v(SAd(|) EFA() |, "| |"); + v(SAd(|) EFA() SBa(|), "| |"); + v(SAd(|) EFA() SBb(|), "| |"); + v(SAd(|) EFA() SBc(|), "| |"); + v(SAd(|) EFA() SBd(|), "| |"); + v(SAd(|) EFA() SBe(|), "| |"); + v(SAd(|) EFA() SBf(|), "| |"); + v(SAd(|) EFB() |, "| |"); + v(SAd(|) EFB() SBa(|), "| |"); + v(SAd(|) EFB() SBb(|), "| |"); + v(SAd(|) EFB() SBc(|), "| |"); + v(SAd(|) EFB() SBd(|), "| |"); + v(SAd(|) EFB() SBe(|), "| |"); + v(SAd(|) EFB() SBf(|), "| |"); + v(SAd(|) EFC() |, "| |"); + v(SAd(|) EFC() SBa(|), "| |"); + v(SAd(|) EFC() SBb(|), "| |"); + v(SAd(|) EFC() SBc(|), "| |"); + v(SAd(|) EFC() SBd(|), "| |"); + v(SAd(|) EFC() SBe(|), "| |"); + v(SAd(|) EFC() SBf(|), "| |"); +} + +void +check6 (void) +{ + v(SAe(|)|, "| |"); + v(SAe(|)SBa(|), "| |"); + v(SAe(|)SBb(|), "| |"); + v(SAe(|)SBc(|), "| |"); + v(SAe(|)SBd(|), "| |"); + v(SAe(|)SBe(|), "| |"); + v(SAe(|)SBf(|), "| |"); + v(SAe(|) |, "| |"); + v(SAe(|) SBa(|), "| |"); + v(SAe(|) SBb(|), "| |"); + v(SAe(|) SBc(|), "| |"); + v(SAe(|) SBd(|), "| |"); + v(SAe(|) SBe(|), "| |"); + v(SAe(|) SBf(|), "| |"); + v(SAe(|)EOA|, "| |"); + v(SAe(|)EOB|, "| |"); + v(SAe(|)EOC|, "| |"); + v(SAe(|)EFA()|, "| |"); + v(SAe(|)EFA()SBa(|), "| |"); + v(SAe(|)EFA()SBb(|), "| |"); + v(SAe(|)EFA()SBc(|), "| |"); + v(SAe(|)EFA()SBd(|), "| |"); + v(SAe(|)EFA()SBe(|), "| |"); + v(SAe(|)EFA()SBf(|), "| |"); + v(SAe(|)EFB()|, "| |"); + v(SAe(|)EFB()SBa(|), "| |"); + v(SAe(|)EFB()SBb(|), "| |"); + v(SAe(|)EFB()SBc(|), "| |"); + v(SAe(|)EFB()SBd(|), "| |"); + v(SAe(|)EFB()SBe(|), "| |"); + v(SAe(|)EFB()SBf(|), "| |"); + v(SAe(|)EFC()|, "| |"); + v(SAe(|)EFC()SBa(|), "| |"); + v(SAe(|)EFC()SBb(|), "| |"); + v(SAe(|)EFC()SBc(|), "| |"); + v(SAe(|)EFC()SBd(|), "| |"); + v(SAe(|)EFC()SBe(|), "| |"); + v(SAe(|)EFC()SBf(|), "| |"); + v(SAe(|) EOA|, "| |"); + v(SAe(|) EOB|, "| |"); + v(SAe(|) EOC|, "| |"); + v(SAe(|) EFA()|, "| |"); + v(SAe(|) EFA()SBa(|), "| |"); + v(SAe(|) EFA()SBb(|), "| |"); + v(SAe(|) EFA()SBc(|), "| |"); + v(SAe(|) EFA()SBd(|), "| |"); + v(SAe(|) EFA()SBe(|), "| |"); + v(SAe(|) EFA()SBf(|), "| |"); + v(SAe(|) EFB()|, "| |"); + v(SAe(|) EFB()SBa(|), "| |"); + v(SAe(|) EFB()SBb(|), "| |"); + v(SAe(|) EFB()SBc(|), "| |"); + v(SAe(|) EFB()SBd(|), "| |"); + v(SAe(|) EFB()SBe(|), "| |"); + v(SAe(|) EFB()SBf(|), "| |"); + v(SAe(|) EFC()|, "| |"); + v(SAe(|) EFC()SBa(|), "| |"); + v(SAe(|) EFC()SBb(|), "| |"); + v(SAe(|) EFC()SBc(|), "| |"); + v(SAe(|) EFC()SBd(|), "| |"); + v(SAe(|) EFC()SBe(|), "| |"); + v(SAe(|) EFC()SBf(|), "| |"); + v(SAe(|)EOA |, "| |"); + v(SAe(|)EOA SBa(|), "| |"); + v(SAe(|)EOA SBb(|), "| |"); + v(SAe(|)EOA SBc(|), "| |"); + v(SAe(|)EOA SBd(|), "| |"); + v(SAe(|)EOA SBe(|), "| |"); + v(SAe(|)EOA SBf(|), "| |"); + v(SAe(|)EOB |, "| |"); + v(SAe(|)EOB SBa(|), "| |"); + v(SAe(|)EOB SBb(|), "| |"); + v(SAe(|)EOB SBc(|), "| |"); + v(SAe(|)EOB SBd(|), "| |"); + v(SAe(|)EOB SBe(|), "| |"); + v(SAe(|)EOB SBf(|), "| |"); + v(SAe(|)EOC |, "| |"); + v(SAe(|)EOC SBa(|), "| |"); + v(SAe(|)EOC SBb(|), "| |"); + v(SAe(|)EOC SBc(|), "| |"); + v(SAe(|)EOC SBd(|), "| |"); + v(SAe(|)EOC SBe(|), "| |"); + v(SAe(|)EOC SBf(|), "| |"); + v(SAe(|)EFA() |, "| |"); + v(SAe(|)EFA() SBa(|), "| |"); + v(SAe(|)EFA() SBb(|), "| |"); + v(SAe(|)EFA() SBc(|), "| |"); + v(SAe(|)EFA() SBd(|), "| |"); + v(SAe(|)EFA() SBe(|), "| |"); + v(SAe(|)EFA() SBf(|), "| |"); + v(SAe(|)EFB() |, "| |"); + v(SAe(|)EFB() SBa(|), "| |"); + v(SAe(|)EFB() SBb(|), "| |"); + v(SAe(|)EFB() SBc(|), "| |"); + v(SAe(|)EFB() SBd(|), "| |"); + v(SAe(|)EFB() SBe(|), "| |"); + v(SAe(|)EFB() SBf(|), "| |"); + v(SAe(|)EFC() |, "| |"); + v(SAe(|)EFC() SBa(|), "| |"); + v(SAe(|)EFC() SBb(|), "| |"); + v(SAe(|)EFC() SBc(|), "| |"); + v(SAe(|)EFC() SBd(|), "| |"); + v(SAe(|)EFC() SBe(|), "| |"); + v(SAe(|)EFC() SBf(|), "| |"); + v(SAe(|) EOA |, "| |"); + v(SAe(|) EOA SBa(|), "| |"); + v(SAe(|) EOA SBb(|), "| |"); + v(SAe(|) EOA SBc(|), "| |"); + v(SAe(|) EOA SBd(|), "| |"); + v(SAe(|) EOA SBe(|), "| |"); + v(SAe(|) EOA SBf(|), "| |"); + v(SAe(|) EOB |, "| |"); + v(SAe(|) EOB SBa(|), "| |"); + v(SAe(|) EOB SBb(|), "| |"); + v(SAe(|) EOB SBc(|), "| |"); + v(SAe(|) EOB SBd(|), "| |"); + v(SAe(|) EOB SBe(|), "| |"); + v(SAe(|) EOB SBf(|), "| |"); + v(SAe(|) EOC |, "| |"); + v(SAe(|) EOC SBa(|), "| |"); + v(SAe(|) EOC SBb(|), "| |"); + v(SAe(|) EOC SBc(|), "| |"); + v(SAe(|) EOC SBd(|), "| |"); + v(SAe(|) EOC SBe(|), "| |"); + v(SAe(|) EOC SBf(|), "| |"); + v(SAe(|) EFA() |, "| |"); + v(SAe(|) EFA() SBa(|), "| |"); + v(SAe(|) EFA() SBb(|), "| |"); + v(SAe(|) EFA() SBc(|), "| |"); + v(SAe(|) EFA() SBd(|), "| |"); + v(SAe(|) EFA() SBe(|), "| |"); + v(SAe(|) EFA() SBf(|), "| |"); + v(SAe(|) EFB() |, "| |"); + v(SAe(|) EFB() SBa(|), "| |"); + v(SAe(|) EFB() SBb(|), "| |"); + v(SAe(|) EFB() SBc(|), "| |"); + v(SAe(|) EFB() SBd(|), "| |"); + v(SAe(|) EFB() SBe(|), "| |"); + v(SAe(|) EFB() SBf(|), "| |"); + v(SAe(|) EFC() |, "| |"); + v(SAe(|) EFC() SBa(|), "| |"); + v(SAe(|) EFC() SBb(|), "| |"); + v(SAe(|) EFC() SBc(|), "| |"); + v(SAe(|) EFC() SBd(|), "| |"); + v(SAe(|) EFC() SBe(|), "| |"); + v(SAe(|) EFC() SBf(|), "| |"); +} + +void +check7 (void) +{ + v(SAf(|)|, "| |"); + v(SAf(|)SBa(|), "| |"); + v(SAf(|)SBb(|), "| |"); + v(SAf(|)SBc(|), "| |"); + v(SAf(|)SBd(|), "| |"); + v(SAf(|)SBe(|), "| |"); + v(SAf(|)SBf(|), "| |"); + v(SAf(|) |, "| |"); + v(SAf(|) SBa(|), "| |"); + v(SAf(|) SBb(|), "| |"); + v(SAf(|) SBc(|), "| |"); + v(SAf(|) SBd(|), "| |"); + v(SAf(|) SBe(|), "| |"); + v(SAf(|) SBf(|), "| |"); + v(SAf(|)EOA|, "| |"); + v(SAf(|)EOB|, "| |"); + v(SAf(|)EOC|, "| |"); + v(SAf(|)EFA()|, "| |"); + v(SAf(|)EFA()SBa(|), "| |"); + v(SAf(|)EFA()SBb(|), "| |"); + v(SAf(|)EFA()SBc(|), "| |"); + v(SAf(|)EFA()SBd(|), "| |"); + v(SAf(|)EFA()SBe(|), "| |"); + v(SAf(|)EFA()SBf(|), "| |"); + v(SAf(|)EFB()|, "| |"); + v(SAf(|)EFB()SBa(|), "| |"); + v(SAf(|)EFB()SBb(|), "| |"); + v(SAf(|)EFB()SBc(|), "| |"); + v(SAf(|)EFB()SBd(|), "| |"); + v(SAf(|)EFB()SBe(|), "| |"); + v(SAf(|)EFB()SBf(|), "| |"); + v(SAf(|)EFC()|, "| |"); + v(SAf(|)EFC()SBa(|), "| |"); + v(SAf(|)EFC()SBb(|), "| |"); + v(SAf(|)EFC()SBc(|), "| |"); + v(SAf(|)EFC()SBd(|), "| |"); + v(SAf(|)EFC()SBe(|), "| |"); + v(SAf(|)EFC()SBf(|), "| |"); + v(SAf(|) EOA|, "| |"); + v(SAf(|) EOB|, "| |"); + v(SAf(|) EOC|, "| |"); + v(SAf(|) EFA()|, "| |"); + v(SAf(|) EFA()SBa(|), "| |"); + v(SAf(|) EFA()SBb(|), "| |"); + v(SAf(|) EFA()SBc(|), "| |"); + v(SAf(|) EFA()SBd(|), "| |"); + v(SAf(|) EFA()SBe(|), "| |"); + v(SAf(|) EFA()SBf(|), "| |"); + v(SAf(|) EFB()|, "| |"); + v(SAf(|) EFB()SBa(|), "| |"); + v(SAf(|) EFB()SBb(|), "| |"); + v(SAf(|) EFB()SBc(|), "| |"); + v(SAf(|) EFB()SBd(|), "| |"); + v(SAf(|) EFB()SBe(|), "| |"); + v(SAf(|) EFB()SBf(|), "| |"); + v(SAf(|) EFC()|, "| |"); + v(SAf(|) EFC()SBa(|), "| |"); + v(SAf(|) EFC()SBb(|), "| |"); + v(SAf(|) EFC()SBc(|), "| |"); + v(SAf(|) EFC()SBd(|), "| |"); + v(SAf(|) EFC()SBe(|), "| |"); + v(SAf(|) EFC()SBf(|), "| |"); + v(SAf(|)EOA |, "| |"); + v(SAf(|)EOA SBa(|), "| |"); + v(SAf(|)EOA SBb(|), "| |"); + v(SAf(|)EOA SBc(|), "| |"); + v(SAf(|)EOA SBd(|), "| |"); + v(SAf(|)EOA SBe(|), "| |"); + v(SAf(|)EOA SBf(|), "| |"); + v(SAf(|)EOB |, "| |"); + v(SAf(|)EOB SBa(|), "| |"); + v(SAf(|)EOB SBb(|), "| |"); + v(SAf(|)EOB SBc(|), "| |"); + v(SAf(|)EOB SBd(|), "| |"); + v(SAf(|)EOB SBe(|), "| |"); + v(SAf(|)EOB SBf(|), "| |"); + v(SAf(|)EOC |, "| |"); + v(SAf(|)EOC SBa(|), "| |"); + v(SAf(|)EOC SBb(|), "| |"); + v(SAf(|)EOC SBc(|), "| |"); + v(SAf(|)EOC SBd(|), "| |"); + v(SAf(|)EOC SBe(|), "| |"); + v(SAf(|)EOC SBf(|), "| |"); + v(SAf(|)EFA() |, "| |"); + v(SAf(|)EFA() SBa(|), "| |"); + v(SAf(|)EFA() SBb(|), "| |"); + v(SAf(|)EFA() SBc(|), "| |"); + v(SAf(|)EFA() SBd(|), "| |"); + v(SAf(|)EFA() SBe(|), "| |"); + v(SAf(|)EFA() SBf(|), "| |"); + v(SAf(|)EFB() |, "| |"); + v(SAf(|)EFB() SBa(|), "| |"); + v(SAf(|)EFB() SBb(|), "| |"); + v(SAf(|)EFB() SBc(|), "| |"); + v(SAf(|)EFB() SBd(|), "| |"); + v(SAf(|)EFB() SBe(|), "| |"); + v(SAf(|)EFB() SBf(|), "| |"); + v(SAf(|)EFC() |, "| |"); + v(SAf(|)EFC() SBa(|), "| |"); + v(SAf(|)EFC() SBb(|), "| |"); + v(SAf(|)EFC() SBc(|), "| |"); + v(SAf(|)EFC() SBd(|), "| |"); + v(SAf(|)EFC() SBe(|), "| |"); + v(SAf(|)EFC() SBf(|), "| |"); + v(SAf(|) EOA |, "| |"); + v(SAf(|) EOA SBa(|), "| |"); + v(SAf(|) EOA SBb(|), "| |"); + v(SAf(|) EOA SBc(|), "| |"); + v(SAf(|) EOA SBd(|), "| |"); + v(SAf(|) EOA SBe(|), "| |"); + v(SAf(|) EOA SBf(|), "| |"); + v(SAf(|) EOB |, "| |"); + v(SAf(|) EOB SBa(|), "| |"); + v(SAf(|) EOB SBb(|), "| |"); + v(SAf(|) EOB SBc(|), "| |"); + v(SAf(|) EOB SBd(|), "| |"); + v(SAf(|) EOB SBe(|), "| |"); + v(SAf(|) EOB SBf(|), "| |"); + v(SAf(|) EOC |, "| |"); + v(SAf(|) EOC SBa(|), "| |"); + v(SAf(|) EOC SBb(|), "| |"); + v(SAf(|) EOC SBc(|), "| |"); + v(SAf(|) EOC SBd(|), "| |"); + v(SAf(|) EOC SBe(|), "| |"); + v(SAf(|) EOC SBf(|), "| |"); + v(SAf(|) EFA() |, "| |"); + v(SAf(|) EFA() SBa(|), "| |"); + v(SAf(|) EFA() SBb(|), "| |"); + v(SAf(|) EFA() SBc(|), "| |"); + v(SAf(|) EFA() SBd(|), "| |"); + v(SAf(|) EFA() SBe(|), "| |"); + v(SAf(|) EFA() SBf(|), "| |"); + v(SAf(|) EFB() |, "| |"); + v(SAf(|) EFB() SBa(|), "| |"); + v(SAf(|) EFB() SBb(|), "| |"); + v(SAf(|) EFB() SBc(|), "| |"); + v(SAf(|) EFB() SBd(|), "| |"); + v(SAf(|) EFB() SBe(|), "| |"); + v(SAf(|) EFB() SBf(|), "| |"); + v(SAf(|) EFC() |, "| |"); + v(SAf(|) EFC() SBa(|), "| |"); + v(SAf(|) EFC() SBb(|), "| |"); + v(SAf(|) EFC() SBc(|), "| |"); + v(SAf(|) EFC() SBd(|), "| |"); + v(SAf(|) EFC() SBe(|), "| |"); + v(SAf(|) EFC() SBf(|), "| |"); +} + +int +main (void) +{ + check0 (); + check1 (); + check2 (); + check3 (); + check4 (); + check5 (); + check6 (); + check7 (); + exit (0); +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/strp1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/strp1.c new file mode 100644 index 000000000..096d968c9 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/strp1.c @@ -0,0 +1,35 @@ +/* { dg-do run } */ + +/* Regression test for stringizing and token pasting. + We got internal escape markers in the strings. */ + +#include <string.h> +#include <stdlib.h> + +#define S(x) _S(x) +#define _S(x) #x + +#define I 1 +static const char s1[] = S(I.1); +static const char t1[] = "1.1"; + +#define f h +#define h(a) a+f +static const char s2[] = S( f(1)(2) ); +static const char t2[] = "1+h(2)"; + +#undef I +#undef f +#undef h + +int +main(void) +{ + if (strcmp (s1, t1)) + abort (); + + if (strcmp (s2, t2)) + abort (); + + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/strp2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/strp2.c new file mode 100644 index 000000000..d1fcd9182 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/strp2.c @@ -0,0 +1,23 @@ +/* { dg-do run } */ + +/* Test for odd corner cases in stringizing/pasting. + Taken more or less verbatim from C99 section 6.10.3.3. */ + +#include <stdlib.h> +#include <string.h> + +#define hash_hash # ## # +#define mkstr(a) # a +#define in_between(a) mkstr(a) +#define join(c, d) in_between(c hash_hash d) + +const char p[] = join(x, y); +const char q[] = "x ## y"; + +int +main (void) +{ + if (strcmp (p, q)) + abort (); + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/subframework1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/subframework1.c new file mode 100644 index 000000000..35d64d7fb --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/subframework1.c @@ -0,0 +1,15 @@ +/* Copyright (C) 2004 Free Software Foundation, Inc. */ + +/* { dg-do preprocess { target *-*-darwin* } } */ +/* { dg-options "-Wno-deprecated -F$srcdir/gcc.dg/cpp/frame" } */ + +/* Contributed by Robert Bowdidge <bowdidge@apple.com> */ +/* include a file from a subframework that will import two files that + both look at the same file. Make sure we only include that file once; + if so, the program will compile fine. If not, we'll get redefinition + errors */ + +#include <one/one-includeSubs.h> +#ifndef ONESUB_C_INCLUDED +#error C.h not included +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/syshdr.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/syshdr.c new file mode 100644 index 000000000..310d5d0d2 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/syshdr.c @@ -0,0 +1,13 @@ +/* Test for proper suppression of warnings in system headers, + and only in system headers. */ +/* FRAGILITY WARNING: The only way we have to distinguish the good error + from the bad error is that the good error is on line 4 and the bad is + on line 5 (of their respective files). dg.exp doesn't have any way to + condition error matchers on the file they're in. */ + +/* { dg-do preprocess } */ +/* { dg-error "include_next" "good error" { target *-*-* } 4 } */ + +#include "syshdr1.h" +/* { dg-message "" "In file included from:" { target *-*-* } 0 } */ +#include "syshdr2.h" diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/syshdr.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/syshdr.h new file mode 100644 index 000000000..3f546aa52 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/syshdr.h @@ -0,0 +1,10 @@ +/* Indented to avoid "suggest hiding ..." warnings. */ + #pragma GCC system_header + +#define sys_uint 1U +#define sys_str(x) x +#define sys_foo(x, y...) bar (x, ##y) + +#define sys_uint 1U +#define sys_fl 1.0f +#define sys_ld 1.0L diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/syshdr1.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/syshdr1.h new file mode 100644 index 000000000..310f39b5f --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/syshdr1.h @@ -0,0 +1,4 @@ +/* This file should generate an error because #include_next is not a + standard directive. */ + +#include_next <stdio.h> diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/syshdr2.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/syshdr2.h new file mode 100644 index 000000000..0140fdac1 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/syshdr2.h @@ -0,0 +1,5 @@ +/* This file would generate an error because of #include_next, but the + #pragma marks it a system header, so the error is suppressed. */ + +#pragma GCC system_header +#include_next <stdio.h> diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/syshdr3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/syshdr3.c new file mode 100644 index 000000000..15749ff99 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/syshdr3.c @@ -0,0 +1,16 @@ +/* Contributed by Dodji Seketeli <dodji@redhat.com> */ +/* Origin: PR preprocessor/7263 */ +/* { dg-options "-pedantic -std=c89 -ftrack-macro-expansion=1" } */ +/* { dg-do compile } */ + +/* This tests the proprer suppression of warning coming from macro + defined in system headers and expanded in a non-system header + location. */ +#include "syshdr3.h" + +static _Complex float c = _Complex_I + _Complex_I; /* These macros are defined in + system header so we should + have no warning here. */ +U_LL u = ONE_ULL; /* Likewise here. */ + +unsigned long long v = 1ULL; /* { dg-warning "long long" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/syshdr3.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/syshdr3.h new file mode 100644 index 000000000..e5d502a24 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/syshdr3.h @@ -0,0 +1,7 @@ +#pragma GCC system_header + +#define _Complex __complex__ +#define _Complex_I 1.0iF + +#define U_LL unsigned long long +#define ONE_ULL 1ULL diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/sysmac1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/sysmac1.c new file mode 100644 index 000000000..cc8469e18 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/sysmac1.c @@ -0,0 +1,26 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=gnu99 -pedantic -Wtraditional -ftrack-macro-expansion=0" } */ + +/* Tests diagnostics are suppressed for some macros defined in system + headers. */ + +/* Source: Neil Booth, 15 Jan 2001. */ + +#include "syshdr.h" + +#define uint 1U +#define str(x) x +#define foo(x, y...) bar(x, ##y) /* { dg-warning "named variadic macros" } */ + +#if uint /* { dg-warning "traditional C rejects" } */ +#endif +#if sys_uint /* { dg-bogus "traditional C rejects" } */ +#endif + +(str); /* { dg-warning "used with arguments" } */ +(sys_str); /* { dg-bogus "used with arguments" } */ + +foo (one_arg); /* { dg-warning "requires rest arguments" } */ +sys_foo (one_arg); /* { dg-bogus "requires rest arguments" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/sysmac2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/sysmac2.c new file mode 100644 index 000000000..cdba668a0 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/sysmac2.c @@ -0,0 +1,28 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -pedantic -Wtraditional -ftrack-macro-expansion=0" } */ + +/* Tests diagnostics are suppressed for some macros defined in system + headers. */ + +/* Source: Neil Booth, 15 Jan 2001. */ + +#include "syshdr.h" + +#define uint 1U +#define fl 1.0f +#define ld 1.0L + +int +main () +{ + int u1 = uint; /* { dg-warning "traditional C rejects" } */ + int u2 = sys_uint; /* { dg-bogus "traditional C rejects" } */ + float f1 = fl; /* { dg-warning "traditional C rejects" } */ + float f2 = sys_fl; /* { dg-bogus "traditional C rejects" } */ + long double ld1 = ld; /* { dg-warning "traditional C rejects" } */ + long double l2 = sys_ld; /* { dg-bogus "traditional C rejects" } */ + + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/tr-paste.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/tr-paste.c new file mode 100644 index 000000000..1dd827663 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/tr-paste.c @@ -0,0 +1,19 @@ +/* Test for proper comment elimination semantics from cpplib's -traditional. + This should compile and link with compiled with `gcc -traditional-cpp'. + Test case by Jason R. Thorpe <thorpej@zembu.com>. */ + +/* { dg-do compile } */ +/* { dg-options "-traditional-cpp" } */ + +extern int printf (const char *, ...); + +#define A(name) X/**/name + +#define B(name) \ +void A(Y/**/name)() { A(name)(); } + +void Xhello() { printf("hello world\n"); } + +B(hello) + +int main() { XYhello(); return (0); } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/tr-warn1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/tr-warn1.c new file mode 100644 index 000000000..37b5efe5d --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/tr-warn1.c @@ -0,0 +1,39 @@ +/* Test for warnings about nontraditional directives. */ +/* { dg-do preprocess } */ +/* { dg-options "-pedantic -Wtraditional" } */ + +/* Block 1: K+R directives should have the # indented. */ + +#define foo bar /* { dg-bogus "indented" "^#kandr" } */ +# define foo bar /* { dg-bogus "indented" "^# kandr" } */ + #define foo bar /* { dg-warning "indented" "^ #kandr" } */ + # define foo bar /* { dg-warning "indented" "^ # kandr" } */ + +/* Block 2: C89 directives should not have the # indented. */ + +#pragma whatever /* { dg-warning "indented" "^#c89" } */ +# pragma whatever /* { dg-warning "indented" "^# c89" } */ + #pragma whatever /* { dg-bogus "indented" "^ #c89" } */ + # pragma whatever /* { dg-bogus "indented" "^ # c89" } */ + +/* Block 3: Extensions should not have the # indented, + _and_ they should get a -pedantic warning. */ + +#assert foo(bar) /* { dg-warning "indented" "^#ext" } */ +# assert bar(baz) /* { dg-warning "indented" "^# ext" } */ + #assert baz(quux) /* { dg-bogus "indented" "^ #ext" } */ + # assert quux(weeble) /* { dg-bogus "indented" "^ # ext" } */ + +/* We warn of #elif regardless of whether we're skipping or not, and + do not warn about indentaion. */ +#if 0 +#if 1 +#elif 1 /* { dg-warning "#elif" "#elif skipping" } */ +#endif +#elif 0 /* { dg-warning "#elif" "#elif not skipping" } */ +#endif + +/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 22 } */ +/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 23 } */ +/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 24 } */ +/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 25 } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/tr-warn2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/tr-warn2.c new file mode 100644 index 000000000..85b624761 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/tr-warn2.c @@ -0,0 +1,18 @@ +/* K+R rejects use of function-like macros in non-function context. + ANSI C explicitly permits this (the macro is not expanded). + + We should not warn about this during pre-expansion of arguments, + since traditional preprocessors don't do pre-expansion, and we get + the warning anyway during the re-scan pass if and only if it is + appropriate. */ + +/* { dg-do preprocess } */ +/* { dg-options -Wtraditional } */ + +#define f(x) x +#define g(x) x / 2 +#define h(a, b) a(b) +f(g) (3) /* { dg-bogus "must be used with arguments" } */ +f 2 /* { dg-warning "must be used with arguments" } */ +f(g) 3 /* { dg-warning "must be used with arguments" } */ +h(f, 3) /* { dg-bogus "must be used with arguments" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/tr-warn3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/tr-warn3.c new file mode 100644 index 000000000..33517188c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/tr-warn3.c @@ -0,0 +1,61 @@ +/* Test for warnings about nontraditional directives inside the unused + clauses of #if statements. Extensions do _not_ receive pedantic + warnings inside unused clauses because they are often hidden this + way on purpose. However they do still require indentation for K&R. */ +/* { dg-do preprocess } */ +/* { dg-options "-pedantic -Wtraditional" } */ + +#if 1 + +/* Block 1: K+R directives should have the # indented to warn. */ + +#define foo bar /* { dg-bogus "indented" "^#kandr" } */ +# define foo bar /* { dg-bogus "indented" "^# kandr" } */ + #define foo bar /* { dg-warning "indented" "^ #kandr" } */ + # define foo bar /* { dg-warning "indented" "^ # kandr" } */ + +/* Block 2: C89 directives should not have the # indented to warn. */ + +#pragma whatever /* { dg-warning "indented" "^#c89" } */ +# pragma whatever /* { dg-warning "indented" "^# c89" } */ + #pragma whatever /* { dg-bogus "indented" "^ #c89" } */ + # pragma whatever /* { dg-bogus "indented" "^ # c89" } */ + +/* Block 3: Extensions should not have the # indented to warn, _and_ + they should get a -pedantic warning. */ + +#assert foo(bar) /* { dg-warning "indented" "^#ext" } */ +# assert bar(baz) /* { dg-warning "indented" "^# ext" } */ + #assert baz(quux) /* { dg-bogus "indented" "^ #ext" } */ + # assert quux(weeble) /* { dg-bogus "indented" "^ # ext" } */ + +#else + +/* Block 1: K+R directives should have the # indented to warn. */ + +#undef foo bar /* { dg-bogus "indented" "^#kandr" } */ +# undef foo bar /* { dg-bogus "indented" "^# kandr" } */ + #undef foo bar /* { dg-warning "indented" "^ #kandr" } */ + # undef foo bar /* { dg-warning "indented" "^ # kandr" } */ + +/* Block 2: C89 directives should not have the # indented to warn. */ + +#error whatever /* { dg-warning "indented" "^#c89" } */ +# error whatever /* { dg-warning "indented" "^# c89" } */ + #error whatever /* { dg-bogus "indented" "^ #c89" } */ + # error whatever /* { dg-bogus "indented" "^ # c89" } */ + +/* Block 3: Extensions should not have the # indented to warn, and + they should _not_ get a -pedantic warning. */ + +#unassert foo(bar) /* { dg-warning "indented" "^#ext" } */ +# unassert bar(baz) /* { dg-warning "indented" "^# ext" } */ + #unassert baz(quux) /* { dg-bogus "indented" "^ #ext" } */ + # unassert quux(weeble) /* { dg-bogus "indented" "^ # ext" } */ + +#endif + +/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 27 } */ +/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 28 } */ +/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 29 } */ +/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 30 } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/tr-warn4.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/tr-warn4.c new file mode 100644 index 000000000..f5b5779bf --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/tr-warn4.c @@ -0,0 +1,26 @@ +/* Test for -Wtraditional warnings on integer constant suffixes. + Note, gcc should omit these warnings in system header files. + By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/22/2000. */ +/* { dg-do preprocess } */ +/* { dg-options "-Wtraditional" } */ + +#if 1U /* { dg-warning "traditional C rejects" "numeric constant suffix" } */ +#endif +#if 1u /* { dg-warning "traditional C rejects" "numeric constant suffix" } */ +#endif +#if 1L +#endif +#if 1l +#endif + +# 17 "sys-header.h" 3 +/* We are in system headers now, no -Wtraditional warnings should issue. */ + +#if 1U +#endif +#if 1u +#endif +#if 1L +#endif +#if 1l +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/tr-warn5.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/tr-warn5.c new file mode 100644 index 000000000..6867b88c2 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/tr-warn5.c @@ -0,0 +1,14 @@ +/* Test for -Wtraditional warnings on the unary plus operator. + Note, gcc should omit these warnings in system header files. + By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/22/2000. */ +/* { dg-do preprocess } */ +/* { dg-options "-Wtraditional" } */ + +#if +1 /* { dg-warning "unary plus operator" "unary plus operator" } */ +#endif + +# 11 "sys-header.h" 3 +/* We are in system headers now, no -Wtraditional warnings should issue. */ + +#if +1 +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/tr-warn6.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/tr-warn6.c new file mode 100644 index 000000000..d95409ef8 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/tr-warn6.c @@ -0,0 +1,27 @@ +/* Test for -Wtraditional warnings for stringification of macro args. + Note, gcc should omit these warnings in system header files. + By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 9/8/2000. */ +/* { dg-do preprocess } */ +/* { dg-options "-Wtraditional" } */ + +#define foo1(h) sdf "h3" fds "h" /* { dg-warning "macro argument \"h\" would be stringified" "traditional stringification" } */ +#define foo2(h2) sdf "h2" fds "h3" /* { dg-warning "macro argument \"h2\" would be stringified" "traditional stringification" } */ +#define foo3(h3) sdf "h2" fds "h3" /* { dg-warning "macro argument \"h3\" would be stringified" "traditional stringification" } */ +#define foo4(h) sdf 'h3' fds 'h' /* { dg-warning "macro argument \"h\" would be stringified" "traditional stringification" } */ +#define foo5(h2) sdf 'h2' fds 'h3' /* { dg-warning "macro argument \"h2\" would be stringified" "traditional stringification" } */ +#define foo6(h3) sdf 'h2' fds 'h3' /* { dg-warning "macro argument \"h3\" would be stringified" "traditional stringification" } */ +#define foo7(AA, hello, world, EEE) sdf "A B hello C,world,DhelloE F" fds EEE /* { dg-warning "macro argument \"hello\" would be stringified" "traditional stringification" } */ + +/* Catch the second warning from the above line. */ +/* { dg-warning "macro argument \"world\" would be stringified" "traditional stringification second warning" { target *-*-* } 13 } */ + +# 19 "sys-header.h" 3 +/* We are in system headers now, no -Wtraditional warnings should issue. */ + +#define bar1(h) sdf "h3" fds "h" +#define bar2(h2) sdf "h2" fds "h3" +#define bar3(h3) sdf "h2" fds "h3" +#define bar4(h) sdf 'h3' fds 'h' +#define bar5(h2) sdf 'h2' fds 'h3' +#define bar6(h3) sdf 'h2' fds 'h3' +#define bar7(AA, hello, world, EEE) sdf "A B hello C,world,DhelloE F" fds EEE diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/Wunused.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/Wunused.c new file mode 100644 index 000000000..403d617f5 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/Wunused.c @@ -0,0 +1,37 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-Wunused-macros -traditional-cpp" } */ + +/* Test everything related to -Wunused-macros. + + Source: Neil Booth, 23 Jul 2002. */ + +#include "Wunused.h" + +#define used1 /* { dg-bogus "used" } */ +#define used2 /* { dg-bogus "used" } */ +#define used3 /* { dg-bogus "used" } */ +#define used4 something /* { dg-bogus "used" } */ + +#define unused5 /* { dg-warning "used" } */ +#define unused6 /* { dg-warning "used" } */ +#define unused7() /* { dg-warning "used" } */ + +#if defined used1 +#endif +#ifdef used2 +#endif +#ifndef used3 +#endif +used4 + +unused7; /* This does not count as a use. */ + +#if 0 +unused5 /* This does not count as a use. */ +#endif + +#undef unused5 +#define unused6 +unused6 diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/Wunused.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/Wunused.h new file mode 100644 index 000000000..8b54412bd --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/Wunused.h @@ -0,0 +1 @@ +#define unused_but_ok diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/__STDC__.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/__STDC__.c new file mode 100644 index 000000000..b25bcb9aa --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/__STDC__.c @@ -0,0 +1,7 @@ +/* Test that __STDC__ is not defined. */ + +/* { dg-do preprocess } */ + +#if defined __STDC__ +# error __STDC__ defined /* { dg-bogus "__STDC__" "__STDC__ defined" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/argcount.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/argcount.c new file mode 100644 index 000000000..208cd44b3 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/argcount.c @@ -0,0 +1,21 @@ +/* Test that we correctly complain about an invalid number of macro + arguments. */ + +/* { dg-do preprocess } */ + +#define f(x) x +#define g(x, y) x y +#define h() + +f(); /* { dg-bogus "requires 1" "no arg is 1 empty arg" } */ +f( ); /* { dg-bogus "macro" "1 arg to 1 param macro" } */ +f(1,); /* { dg-error "passed 2" "2 args to 1 param macro" } */ +f(1,2); /* { dg-error "passed 2" "2 args to 1 param macro" } */ +h(); /* { dg-bogus "macro" "no arg to 1 param macro" } */ +h( ); /* { dg-error "passed 1" "1 arg to 0 param macro" } */ +h(1,2); /* { dg-error "passed 2" "2 args to 0 param macro" } */ +g(); /* { dg-error "requires 2" "0 args to 2 param macro" } */ +g( ); /* { dg-error "requires 2" "1 args to 2 param macro" } */ +g( ,2); /* { dg-bogus "requires 2" "2 args to 2 param macro" } */ +g(,); /* { dg-bogus "requires 2" "2 args to 2 param macro" } */ +g(1,2,3); /* { dg-error "passed 3" "3 args to 2 param macro" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/assembler.S b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/assembler.S new file mode 100644 index 000000000..75bb62841 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/assembler.S @@ -0,0 +1,29 @@ +/* Regression test - in assembly language, # may have some significance + other than 'stringize macro argument' and therefore must be preserved + in the output, and should not be warned about. */ + +/* { dg-do preprocess } */ + +#ifndef FOO +#1 /* Once caused a bogus unterminated #ifndef. */ +#endif + +#define foo() mov r0, #5 /* { dg-bogus "not followed" "spurious warning" } */ + +entry: + foo() + +/* Check we don't EOF on an unknown directive. */ +#unknown directive +#error a later diagnostic /* { dg-error "diagnostic" } */ + +/* + { dg-final { if ![file exists 20000510-1.i] { return } } } + { dg-final { set tmp [grep 20000510-1.i # line] } } + { dg-final { if {[string length $tmp] > 0} \{ } } + { dg-final { pass "20000510-1.S: # preservation" } } + { dg-final { \} else \{ } } + { dg-final { fail "20000510-1.S: # preservation" } } + { dg-final { \} } } +*/ + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/assert1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/assert1.c new file mode 100644 index 000000000..d1446105c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/assert1.c @@ -0,0 +1,46 @@ +/* Basic tests of the #assert preprocessor extension. */ +/* { dg-do compile } */ +/* { dg-options "-Wno-deprecated" } */ + +#define def unused expansion +#define fail int fail + +#assert abc (def) +#assert abc (ghi) +#assert abc (jkl) +#assert space ( s p a c e ) + +/* Basic: */ +#if !#abc (def) || !#abc (ghi) || !#abc (jkl) +fail +#endif + +/* any answer for #abc */ +#if !#abc +fail +#endif + +/* internal whitespace is collapsed, + external whitespace is deleted */ +#if !#space (s p a c e) || !#space ( s p a c e ) || #space (space) +fail +#endif + +/* removing assertions */ +#unassert abc (jkl) +#if !#abc || !#abc (def) || !#abc (ghi) || #abc (jkl) +fail +#endif + +#unassert abc +#if #abc || #abc (def) || #abc (ghi) || #abc (jkl) +fail +#endif + +int gobble + +/* make sure it can succeed too. + also check space before open paren isn't significant */ +#if #space(s p a c e) +; +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/assert2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/assert2.c new file mode 100644 index 000000000..4aa0b9944 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/assert2.c @@ -0,0 +1,24 @@ +/* Malformed assertion tests. */ +/* { dg-do preprocess } */ +/* { dg-options "-Wno-deprecated" } */ + +#assert /* { dg-error "without predicate" "assert w/o predicate" } */ +#assert % /* { dg-error "an identifier" "assert punctuation" } */ +#assert 12 /* { dg-error "an identifier" "assert number" } */ +#assert abc /* { dg-error "missing" "assert w/o answer" } */ + +#if # /* { dg-error "without predicate" "test w/o predicate" } */ +#endif + +#if #% /* { dg-error "an identifier" "test punctuation" } */ +#endif + +#if #12 /* { dg-error "an identifier" "test number" } */ +#endif + +#if #abc +#error /* { dg-bogus "error" "test w/o answer" } */ +#endif + +#if #abc[def] /* { dg-error "not valid in" "bad syntax" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/assert3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/assert3.c new file mode 100644 index 000000000..9010ecebd --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/assert3.c @@ -0,0 +1,10 @@ +/* Copyright (C) 2000, 2008 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-A abc=def -A abc\(ghi\) \"-Aabc = jkl\" -A abc=mno -A -abc=mno -Wno-deprecated" } */ + +/* Test -A command line syntax. Source Neil Booth. 31 Oct 2000. */ + +#if !#abc (def) || !#abc (ghi) || !#abc (jkl) || #abc(mno) +#error Command line -A assertions +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/builtins.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/builtins.c new file mode 100644 index 000000000..74798bbb4 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/builtins.c @@ -0,0 +1,54 @@ +/* Test that builtin-macros are OK. */ + +/* { dg-do run } */ + +#include "builtins.h" + +void abort (void); +char *strstr (const char *, const char *); +int strcmp (const char *, const char *); + +#define LINE __LINE__ + +#if __LINE__ != 13 +# error __LINE__ part 1 /* { dg-bogus "__LINE__" } */ +#endif + +#if \ + __LINE__ != 18 +# error __LINE__ part 2 /* { dg-bogus "__LINE__" } */ +#endif + +#if LINE != 22 +# error __LINE__ part 3 /* { dg-bogus "__LINE__" } */ +#endif + +#if __INCLUDE_LEVEL != 0 +# error __INCLUDE_LEVEL__ /* { dg-bogus "__INCLUDE_LEVEL__" } */ +#endif + +#if !defined (__TIME__) +# error __TIME__ /* { dg-bogus "__TIME__" } */ +#endif + +#if !defined (__DATE__) +# error __DATE__ /* { dg-bogus "__DATE__" } */ +#endif + + +int main () +{ + /* level is defined in builtins.h. */ + if (level != 1) + abort (); + + if (!strstr (__FILE__, "builtins.c")) + abort (); + + if (!strcmp (__BASE_FILE__, "builtins.c")) + abort (); + + return 0; +} + +/* { dg-require-host-local "" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/builtins.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/builtins.h new file mode 100644 index 000000000..9f2b9a014 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/builtins.h @@ -0,0 +1 @@ +int level = __INCLUDE_LEVEL__; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-C.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-C.c new file mode 100644 index 000000000..ff67ddbdb --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-C.c @@ -0,0 +1,37 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-C -traditional-cpp" } */ + +/* Test -C doesn't fail with #define. #define is the tricky case, + being the only directive that remembers its comments. + + -C treats comments as tokens in their own right, so e.g. comment at + the beginning of a directive turns it into a non-directive. */ + +#define simple no comments + +#define/**/obj_like/**/(some)/**/thing/**/ +#define fun_like(/**/x/**/,/**/y/**/)/**/ +/**/#define not_a_macro + +#if !defined simple || !defined obj_like || !defined fun_like +#error Missed some macros with -C +#endif + +#ifdef not_a_macro +#error not_a_macro is! +#endif + +/* Check obj_like doesn't expect arguments, and fun_like does. */ +obj_like +fun_like (foo, bar) + +/* Check OK to redefine fun_like without comments in the params. */ +#define fun_like(x, y)/**/ + +/* Check comments in macros in directives are OK. */ +#define ZERO 0 /* A trailing comment. */ + +#if ZERO +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-C2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-C2.c new file mode 100644 index 000000000..96bd371a9 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-C2.c @@ -0,0 +1,11 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-C -traditional-cpp" } */ + +/* Test that comments are actually written out + + Neil Booth, 24 Jun 2002. */ + +/* { dg-final { scan-file cmdlne-C2.i "dg-final" } } */ + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-dD.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-dD.c new file mode 100644 index 000000000..1e4c8c867 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-dD.c @@ -0,0 +1,9 @@ +/* Copyright (C) 2000, 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-dD -traditional-cpp" } */ + +/* Test -dD does not fail. */ + +#define objlike obj like +#define funlike(like) fun like diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-dM.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-dM.c new file mode 100644 index 000000000..0fb5bd9dd --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-dM.c @@ -0,0 +1,9 @@ +/* Copyright (C) 2000, 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-dM -traditional-cpp" } */ + +/* Test -dM does not fail. */ + +#define objlike obj like +#define funlike(like) fun like diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/comment-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/comment-2.c new file mode 100644 index 000000000..8d54e3a0f --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/comment-2.c @@ -0,0 +1,11 @@ +/* Test for warning of nested comments. */ + +/* { dg-do preprocess } */ + +/* { dg-options "-traditional-cpp -Wcomments" } + +/* /* */ /* { dg-warning "within comment" } */ + +/* + + /* { dg-warning "within comment" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/comment-3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/comment-3.c new file mode 100644 index 000000000..e2710ad56 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/comment-3.c @@ -0,0 +1,6 @@ +/* Test we don't accept C++ comments. */ + +/* { dg-do preprocess } */ + +#if 0 +#endif // /* { dg-warning "extra tokens" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/comment.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/comment.c new file mode 100644 index 000000000..971a78a6d --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/comment.c @@ -0,0 +1,5 @@ +/* Test for warning of unterminated comment. */ + +/* { dg-do preprocess } */ + +/* { dg-error "unterminated comment" } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/define.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/define.c new file mode 100644 index 000000000..d83288df2 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/define.c @@ -0,0 +1,2 @@ +/* { dg-do preprocess } */ +/* { dg-options "-traditional-cpp -DDEFINE1DEFINE -DDEFINE2DEFIN=" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/defined.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/defined.c new file mode 100644 index 000000000..5fa1d93b8 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/defined.c @@ -0,0 +1,78 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Tests tradcpp0 with defined. The defined operator in traditional C + works just the same as the defined operator in Standard C. */ + +/* Source: Zack Weinberg, glibc, Neil Booth 11 Dec 2000. */ + +#if defined REGPARMS +#error REGPARMS should not be defined +#endif + +#define REGPARMS 1 +#if !defined REGPARMS +#error REGPARMS should be defined +#endif + +#define defined /* { dg-error "defined" } */ + +/* No diagnostics, though you could argue there should be. */ +#if defined defined +#error defined is defined! +#endif + +#define is_Z_defined defined Z + +#if defined Z +#error Z is not defined +#endif + +/* The behavior of "defined" when it comes from a macro expansion is + now documented. */ +#if is_Z_defined +#error Macro expanding into defined operator test 1 +#endif + +#define Z + +#if !defined Z +#error Z is defined +#endif + +#if !is_Z_defined +#error Macro expanding into defined operator test 2 +#endif + +#undef is_Z_defined +#undef Z + +/* Do all the tests over again with the () form of defined. */ + +/* No diagnostics, though you could argue there should be. */ +#if defined(defined) +#error defined is defined! +#endif + +#define is_Z_defined defined ( Z ) + +#if defined(Z) +#error Z is not defined +#endif + +/* The behavior of "defined" when it comes from a macro expansion is + now documented. */ +#if is_Z_defined +#error Macro expanding into defined operator test 1 +#endif + +#define Z + +#if !defined(Z) +#error Z is defined +#endif + +#if !is_Z_defined +#error Macro expanding into defined operator test 2 +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/directive.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/directive.c new file mode 100644 index 000000000..ee7ebcab0 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/directive.c @@ -0,0 +1,23 @@ +/* Test for some basic aspects of -traditional directive processing. */ + +/* { dg-do preprocess } */ + +#define HASH # +HASH + +/* There is a #error directive. */ + +#error bad /* { dg-error "bad" } */ + +/* Directives with their #s indented are not recognized. */ + #if 0 /* { dg-bogus "unterminated" } */ + +#wrong /* { dg-error "invalid" } */ + +#define foo 2 +#define bar + 3 +#define foobar 6 + +#if foo/**/bar != 5 +# error Comments in directive is a separator /* { dg-bogus "error" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/escaped-eof.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/escaped-eof.c new file mode 100644 index 000000000..2c9c185b1 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/escaped-eof.c @@ -0,0 +1,6 @@ +/* Test for warning of escaped EOF. */ + +/* { dg-do preprocess } */ + +/* { dg-warning "backslash-new" "escaped EOF warning" { target *-*-* } 6 } */ +\ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/escaped-nl.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/escaped-nl.c new file mode 100644 index 000000000..be8cc53fe --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/escaped-nl.c @@ -0,0 +1,10 @@ +/* Test escaped newlines at start of macro definition are properly + skipped (buglet in skip_whitespace () in cpptrad.c). */ + +/* { dg-do preprocess } */ + +#define NUM \ +100 +#if NUM != 100 +# error NUM not defined properly /* { dg-bogus "error" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/funlike-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/funlike-2.c new file mode 100644 index 000000000..edcf2abf2 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/funlike-2.c @@ -0,0 +1,23 @@ +/* Test that nested commas and parentheses in macro arguments are + OK. */ + +/* { dg-do preprocess } */ + +#define f(x) x +#define g(x, y) x y + +#if f((1)) != 1 +# error /* { dg-bogus "error" "nested parens 1" } */ +#endif + +#if f((1, 2)) != 2 +# error /* { dg-bogus "error" "nested comma 1" } */ +#endif + +#if g(, (1)) != 1 +# error /* { dg-bogus "error" "nested parens 2" } */ +#endif + +#if g((1, 2), + 3) != 5 +# error /* { dg-bogus "error" "nested comma 2" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/funlike-3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/funlike-3.c new file mode 100644 index 000000000..5300afba7 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/funlike-3.c @@ -0,0 +1,12 @@ +/* Test that function-like macros are restricted to directives, and + that unterminated ones are warned about. */ + +/* { dg-do preprocess } */ + +#define f(x) x + +#if 2 f(/* { dg-error "unterminated" "unterminated macro in directive" } */ +) +#endif + +f( /* { dg-error "unterminated" "unterminated macro" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/funlike-4.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/funlike-4.c new file mode 100644 index 000000000..fcc65a8d6 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/funlike-4.c @@ -0,0 +1,26 @@ +/* Test that undefined names evaluate to zero, that macros after a + funlike macro are expanded, and that if it is a '(' the funlike + macro is not treated as such. */ + +/* { dg-do run } */ + +extern void abort (void); + +#define f(x) x + +int main () +{ +#if f(1) == f /**/ (/**/1/**/) + int x; +#endif + + x = 0; + if (f + /**/ ( + /**/ 0/**/ + /**/) + ) + abort (); + + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/funlike-5.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/funlike-5.c new file mode 100644 index 000000000..f60a6ea78 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/funlike-5.c @@ -0,0 +1,10 @@ +/* Test function like macro. */ +/* Contributed by Devang Patel <dpatel@apple.com> */ + +/* {do-do preprocess } */ +/* { dg-options "-traditional-cpp -E -dD" } */ +int __srget (char *); +#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++)) +#define getc(fp) __sgetc(fp) +#define getchar() getc(stdin) + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/funlike.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/funlike.c new file mode 100644 index 000000000..db550d53c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/funlike.c @@ -0,0 +1,25 @@ +/* Test that undefined names evaluate to zero, that macros after a + funlike macro are expanded, and that if it is a '(' the funlike + macro is not treated as such. */ + +/* { dg-do preprocess } */ + +#define f(x) x +#define h != 0 +#define i +#define paren ( + +#if f != 0 +# error /* { dg-bogus "error" "undefined name" } */ +#endif + +#if f h +# error /* { dg-bogus "error" "h not expanded" } */ +#endif + +#if f i +# error /* { dg-bogus "error" "empty macro" } */ +#endif + +#if f paren 6) /* { dg-error "missing binary" "macro-expanded parenthesis" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/hash.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/hash.c new file mode 100644 index 000000000..8108c89fb --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/hash.c @@ -0,0 +1,14 @@ +/* Test for erroneously thinking comments are token-pastes. + From XFree86 4.0. */ +/* { dg-do preprocess } */ + +#ifndef foo +#define foo /**/ +#endif + +#ifndef foo +#define foo /* as nothing */ +#endif + +/* { dg-bogus "(start|end) of macro" "paste at end" { target *-*-* } 7 } */ +/* { dg-bogus "(start|end) of macro" "comment at end" { target *-*-* } 11 } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/include.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/include.c new file mode 100644 index 000000000..94d25f815 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/include.c @@ -0,0 +1,12 @@ +/* Copyright (c) 2002 Free Software Foundation Inc. */ + +/* Test that macros are not expanded in the <> quotes of #inlcude. */ + +/* vxWorksCommon.h uses the "#" operator to construct the name of an + include file, thus making the file incompatible with -traditional-cpp. + Newlib uses ## when including stdlib.h as of 2007-09-07. */ +/* { dg-do preprocess { target { { ! vxworks_kernel } && { ! newlib } } } } */ + +#define __STDC__ 1 /* Stop complaints about non-ISO compilers. */ +#define stdlib 1 +#include <stdlib.h> /* { dg-bogus "o such file or directory" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/literals-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/literals-1.c new file mode 100644 index 000000000..15c8030fa --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/literals-1.c @@ -0,0 +1,28 @@ +/* Test that (what looks like) comments are not recognized in literals + and that quotes within quotes do not confused the preprocessor. */ + +/* { dg-do run } */ + +extern void abort (void); + +int main () +{ + const char *str1 = "/*"; + const char *str2 = "'"; + + if (str1[0] != '/' || str1[1] != '*' || str1[2] != '\0') + abort (); + + if (str2[0] != '\'' || str2[1] != '\0') + abort (); + +#if '"' != '\"' +# error /* { dg-bogus "error" "double quote in charconst" } */ +#endif + +#if !'\'' +# error quote /* { dg-bogus "quote" "quote in charconst" } */ +#endif + + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/literals-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/literals-2.c new file mode 100644 index 000000000..b471772f6 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/literals-2.c @@ -0,0 +1,8 @@ +/* Test that unterminated quotes in CPP expressions are + recognized. */ + +/* { dg-do preprocess } */ +/* { dg-warning "missing terminating" "bad charconst" { target *-*-* } 7 } */ +/* { dg-error "not valid" "bad charconst" { target *-*-* } 7 } */ +#if 'x +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/maccom1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/maccom1.c new file mode 100644 index 000000000..28602a51a --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/maccom1.c @@ -0,0 +1,13 @@ +/* { dg-do preprocess } */ +/* { dg-options "-CC -traditional-cpp" } */ + +/* This tests to make sure that comments are ignored between # and the + directive name when the -CC option is used. + + Jason R. Thorpe, 6 Apr 2002 */ + +#/**/define def passed + +def + +/* { dg-final { scan-file maccom1.i "(^|\n)passed" } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/maccom2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/maccom2.c new file mode 100644 index 000000000..068c357c1 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/maccom2.c @@ -0,0 +1,14 @@ +/* { dg-do preprocess } */ +/* { dg-options "-CC -traditional-cpp" } */ + +/* This tests to make sure that comments between the #define directive + and the macro identifier are ignored (i.e. treated like whitespace) + when the -CC option is used. + + Jason R. Thorpe, 6 Apr 2002 */ + +#define/**/def passed + +def + +/* { dg-final { scan-file maccom2.i "(^|\n)passed" } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/maccom3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/maccom3.c new file mode 100644 index 000000000..a6eb3f854 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/maccom3.c @@ -0,0 +1,13 @@ +/* { dg-do preprocess } */ +/* { dg-options "-CC -traditional-cpp" } */ + +/* This tests to make sure that comments in the definition of a macro + parameter list are ignored when the -CC option is used. + + Jason R. Thorpe, 6 Apr 2002 */ + +#define def(x /**/, y) passed + +def(x,y) + +/* { dg-final { scan-file maccom3.i "(^|\n)passed" } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/maccom4.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/maccom4.c new file mode 100644 index 000000000..eac52da0d --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/maccom4.c @@ -0,0 +1,17 @@ +/* { dg-do preprocess } */ +/* { dg-options "-CC -traditional-cpp" } */ + +/* This tests to make sure the comment is saved in the macro and copied + to the output file when the macro is expanded when the -CC option is + used. + + Jason R. Thorpe, 6 Apr 2002 */ + +#define def /* passed */ + +def + +/* + /* The + in the regexp prevents it from matching itself. */ + { dg-final { scan-file maccom4.i "p+assed" } } +*/ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/maccom6.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/maccom6.c new file mode 100644 index 000000000..baf5e980d --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/maccom6.c @@ -0,0 +1,20 @@ +/* { dg-do preprocess } */ +/* { dg-options "-CC -traditional-cpp" } */ + +/* This tests to make sure that expressions function properly + when used with macros containing comments and the -CC option + is being used. + + Jason R. Thorpe, 6 Apr 2002 */ + +#define ONE 1 /* one */ +#define TWO 2 /* two */ +#define THREE 3 /* three */ + +#if (ONE + TWO) != THREE +failed +#else +passed +#endif + +/* { dg-final { scan-file maccom6.i "(^|\n)passed" } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/macro.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/macro.c new file mode 100644 index 000000000..164b4ecfe --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/macro.c @@ -0,0 +1,11 @@ +/* Test that varargs are rejected, and that we don't complain about + macro args in skipped blocks. */ + +/* { dg-do preprocess } */ + +#define f(x) +#define g(x, y...) /* { dg-error "macro parameter list" } */ + +#if 0 +#define f(a,b) /* { dg-bogus "passed 2 arguments" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/macroargs.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/macroargs.c new file mode 100644 index 000000000..c5f91d9f2 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/macroargs.c @@ -0,0 +1,43 @@ +/* Test that whitespace in arguments is preserved, and that each + newline in macro arguments become a space. */ + +/* { dg-do run } */ + +#define f(x, y) "x y" +#define g(x) x + +extern void abort (void); + +void testquoting () +{ + const char *str1 = f("a", "\"a\""); + const char *str2 = f( \t, " \t"); + + if (strcmp (str1, "\"a\" \"\\\"a\\\"\"")) + abort (); + if (strcmp (str2, " \t \" \\t\"")) + abort (); +} + +int main () +{ + const char *str1 = f( foo ,bar); + const char *str2 = f( +foo +,bar); + + if (strcmp (str1, " foo bar")) + abort (); + + if (strcmp (str1, str2)) + abort (); + + /* Verify that quoted state is preserved over a newline. */ + if (strcmp (g /* { dg-bogus "unterminated 2" } */ ("1 +, 2"), "1 , 2")) + abort (); + + testquoting (); + + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi1.c new file mode 100644 index 000000000..4004d2183 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi1.c @@ -0,0 +1,36 @@ +/* Test "ignore redundant include" facility. + + We must test with C comments, and null directives, outside + the guard conditional; also, we test guarding with #ifndef and #if + !defined. -H is used because cpp might confuse the issue by + optimizing out #line markers. This test only passes if each of the + headers is read exactly once. + + The disgusting regexp in the dg-error line, when stuck into + dg.exp's compiler-output regexp, matches the correct -H output and + only the correct -H output. It has to be all on one line because + otherwise it will not be interpreted all in one unit. */ + +/* { dg-do compile } + { dg-options "-H -traditional-cpp" } + { dg-message "mi1c\.h\n\[^\n\]*mi1nd\.h\n\[^\n\]*mi1ndp\.h\n\[^\n\]*mi1x\.h" "redundant include check" { target *-*-* } 0 } */ + +#include "mi1c.h" +#include "mi1c.h" +#include "mi1c.h" + +#include "mi1nd.h" +#include "mi1nd.h" + +#include "mi1ndp.h" +#include "mi1ndp.h" + +#define MIX_H +#include "mi1x.h" +#include "mi1x.h" + +int +main (void) +{ + return a + c + d; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi1c.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi1c.h new file mode 100644 index 000000000..2956286eb --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi1c.h @@ -0,0 +1,12 @@ +/* Redundant header include test with C comments at top. */ +# /* And a null directive at the top. */ + +#ifndef CPP_MIC_H +#define CPP_MIC_H + +int a; + +#endif + +# /* And at the end, too! */ +/* And at the end too! */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi1nd.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi1nd.h new file mode 100644 index 000000000..c14c1a3c6 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi1nd.h @@ -0,0 +1,8 @@ +/* Redundant include check with #if !defined. */ + +#if !defined CPP_MIND_H +#define CPP_MIND_H + +int c; + +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi1ndp.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi1ndp.h new file mode 100644 index 000000000..b84202c6d --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi1ndp.h @@ -0,0 +1,7 @@ +#if !defined ( CPP_MINDP_H) +#define CPP_MINDP_H + +/* Redundant include check with #if !defined and parentheses. */ +int d; + +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi1x.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi1x.h new file mode 100644 index 000000000..a317cf852 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi1x.h @@ -0,0 +1,9 @@ +/* This header is never to have its contents visible, but it should + still receive the optimization. */ + +#ifndef MIX_H +#define MIX_H + +#define main wibble + +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi2.c new file mode 100644 index 000000000..916d5a949 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi2.c @@ -0,0 +1,12 @@ +/* Test for overly eager multiple include optimization. + Problem distilled from glibc 2.0.7's time.h, sys/time.h, timebits.h. + Problem noted by Tom Tromey <tromey@cygnus.com>. */ +/* { dg-do compile } */ + +#include "mi2a.h" +#include "mi2b.h" + +int main (void) +{ + return x; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi2a.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi2a.h new file mode 100644 index 000000000..e3f53b6cb --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi2a.h @@ -0,0 +1,5 @@ +/* Test for overly eager multiple include optimization. + Problem distilled from glibc 2.0.7's time.h, sys/time.h, timebits.h. + Problem noted by Tom Tromey <tromey@cygnus.com>. */ + +#include "mi2c.h" diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi2b.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi2b.h new file mode 100644 index 000000000..1d9a8b9b1 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi2b.h @@ -0,0 +1,6 @@ +/* Test for overly eager multiple include optimization. + Problem distilled from glibc 2.0.7's time.h, sys/time.h, timebits.h. + Problem noted by Tom Tromey <tromey@cygnus.com>. */ + +#define need_x +#include "mi2c.h" diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi2c.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi2c.h new file mode 100644 index 000000000..521792bee --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi2c.h @@ -0,0 +1,15 @@ +/* Test for overly eager multiple include optimization. + Problem distilled from glibc 2.0.7's time.h, sys/time.h, timebits.h. + Problem noted by Tom Tromey <tromey@cygnus.com>. */ +#ifdef need_x +#undef need_x +#ifndef have_x +#define have_x +extern int x; +#endif +#endif + +#ifndef t_h +#define t_h +extern int y; +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi3.c new file mode 100644 index 000000000..f33fd7887 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi3.c @@ -0,0 +1,20 @@ +/* Another test case for over-eager multiple include optimization. + This one distilled from glibc's setlocale.c and categories.def. */ +/* { dg-do compile } */ + +#define X a +#include "mi3.def" +#undef X + +#define X b +#include "mi3.def" +#undef X + +#include "mi3.h" +#include "mi3.h" /* The second include declares variable c. */ + +int +main(void) +{ + return a + b + c; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi3.def b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi3.def new file mode 100644 index 000000000..375d9c7fe --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi3.def @@ -0,0 +1,10 @@ +/* Another test case for over-eager multiple include optimization. + This one distilled from glibc's setlocale.c and categories.def. + The #ifdef block doesn't cover the entire file, so it must not be + taken for a reinclude guard. */ + +#ifndef NO_POSTLOAD +#define NO_POSTLOAD NULL +#endif + +int X; diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi3.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi3.h new file mode 100644 index 000000000..8774fcf48 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi3.h @@ -0,0 +1,7 @@ +/* Another test case for over-eager multiple include optimization. */ + +#ifndef GUARD +#define GUARD +#elif 1 /* #elif kills optimisation */ +int c; +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi4.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi4.c new file mode 100644 index 000000000..c886cc2c8 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi4.c @@ -0,0 +1,10 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ + +/* Undefining a macro guard and re-including the file used to confuse + file caching in cppfiles.c, and attempt to open a bad fd. */ + +#include "mi1c.h" +#undef CPP_MIC_H +#include "mi1c.h" diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi5.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi5.c new file mode 100644 index 000000000..ece38b5a6 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi5.c @@ -0,0 +1,13 @@ +/* Test "ignore redundant include" facility, with -C on. + + The disgusting regexp in the dg-error line, when stuck into + dg.exp's compiler-output regexp, matches the correct -H output and + only the correct -H output. It has to be all on one line because + otherwise it will not be interpreted all in one unit. */ + +/* { dg-do preprocess } + { dg-options "-H -C -traditional-cpp" } + { dg-message "mi1c\.h" "redundant include check with -C" { target *-*-* } 0 } */ + +#include "mi1c.h" +#include "mi1c.h" diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi6.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi6.c new file mode 100644 index 000000000..c3af2d3f2 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi6.c @@ -0,0 +1,61 @@ +/* Another test case for over-eager multiple include optimization, + where the leading "#if !defined" expression is obtained partially, + or wholly, from macros. Neil Booth, 30 Sep 2001. */ + +/* { dg-do compile } */ +/* { dg-options "" } */ + +extern void abort (void); + +/* Each include file should not be subject to MI optimisation, since + macro definitions can change. Each header increments the variable + VAR if it is defined. + + The first set of inclusions gets the headers into CPP's cache, but + does nothing since VAR is not defined. The second set should each + increment VAR, since none of the initial set should have been + flagged as optimizable. */ + +#define EMPTYL +#define EMPTYR +#define NOT ! +#define DEFINED defined (guard) +#define NOT_DEFINED ! defined (guard) + +#include "mi6a.h" +#include "mi6b.h" +#include "mi6c.h" +#include "mi6d.h" +#include "mi6e.h" + +/* Define the macro guard, and redefine the macros to something that + forces compilation of the conditional blocks. */ +#define guard +#undef EMPTYL +#define EMPTYL 1 || +#undef EMPTYR +#define EMPTYR || 1 +#undef NOT +#define NOT +#undef DEFINED +#define DEFINED 0 +#undef NOT_DEFINED +#define NOT_DEFINED 1 + +#define VAR five + +int +main(void) +{ + unsigned int five = 0; + +#include "mi6a.h" +#include "mi6b.h" +#include "mi6c.h" +#include "mi6d.h" +#include "mi6e.h" + + if (five != 5) + abort (); + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi6a.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi6a.h new file mode 100644 index 000000000..68a2fce47 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi6a.h @@ -0,0 +1,5 @@ +#if NOT_DEFINED + #ifdef VAR + VAR++; + #endif +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi6b.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi6b.h new file mode 100644 index 000000000..d2fe8be17 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi6b.h @@ -0,0 +1,5 @@ +#if NOT defined (guard) + #ifdef VAR + VAR++; + #endif +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi6c.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi6c.h new file mode 100644 index 000000000..d19cb5433 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi6c.h @@ -0,0 +1,5 @@ +#if !DEFINED + #ifdef VAR + VAR++; + #endif +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi6d.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi6d.h new file mode 100644 index 000000000..a1eabba8e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi6d.h @@ -0,0 +1,5 @@ +#if EMPTYL !defined (guard) + #ifdef VAR + VAR++; + #endif +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi6e.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi6e.h new file mode 100644 index 000000000..26ba71514 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi6e.h @@ -0,0 +1,5 @@ +#if !defined (guard) EMPTYR + #ifdef VAR + VAR++; + #endif +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi7.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi7.c new file mode 100644 index 000000000..d980586f9 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi7.c @@ -0,0 +1,19 @@ +/* Test "ignore redundant include" facility. + + -H is used because cpp might confuse the issue by optimizing out + #line markers. This test only passes if the headers is read + twice. + + The disgusting regexp in the dg-error line, when stuck into + dg.exp's compiler-output regexp, matches the correct -H output and + only the correct -H output. It has to be all on one line because + otherwise it will not be interpreted all in one unit. */ + +/* { dg-do preprocess } + { dg-options "-H -traditional-cpp" } + { dg-message "mi7a\.h\n\[^\n\]*mi7a\.h\n\[^\n\]*mi7b\.h\n\[^\n\]*mi7b\.h" "redundant include check" { target *-*-* } 0 } */ + +#include "mi7a.h" +#include "mi7a.h" +#include "mi7b.h" +#include "mi7b.h" diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi7a.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi7a.h new file mode 100644 index 000000000..0c701d7e6 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi7a.h @@ -0,0 +1,4 @@ +: +#ifndef GUARD1 +#define GUARD1 +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi7b.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi7b.h new file mode 100644 index 000000000..1747e5482 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/mi7b.h @@ -0,0 +1,4 @@ +#ifndef GUARD2 +#define GUARD2 +#endif +: diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/null-drctv.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/null-drctv.c new file mode 100644 index 000000000..99fd251f2 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/null-drctv.c @@ -0,0 +1,6 @@ +/* Test that the null directive doesn't swallow the following line. */ + +/* { dg-do preprocess } */ + +# +#error OK /* { dg-error "OK" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/num-sign.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/num-sign.c new file mode 100644 index 000000000..64f12c072 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/num-sign.c @@ -0,0 +1,16 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do preprocess { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ + +/* Tests that traditional numbers are signed, unless otherwise + specified. This test assumes a 32 bit target. + + Neil Booth, 5 Aug 2001. Inspired by PR 3824. */ + +#if 0xffffffffffffffff >= 0 +# error 0xffffffffffffffff /* { dg-bogus "0xffffffffffffffff" "0xffffffffffffffff positive" } */ +#endif + +#if 0xffffffffffffffffU <= 0 +# error 0xffffffffffffffffU /* { dg-bogus "0xffffffffffffffffU" "0xffffffffffffffffU negative" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/paste.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/paste.c new file mode 100644 index 000000000..9b83fd30f --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/paste.c @@ -0,0 +1,18 @@ +/* Test for proper comment elimination semantics from cpplib's -traditional. + This should compile and link with compiled with `gcc -traditional-cpp'. + Test case by Jason R. Thorpe <thorpej@zembu.com>. */ + +/* { dg-do compile } */ + +extern int printf (const char *, ...); + +#define A(name) X/**/name + +#define B(name) \ +void A(Y/**/name)() { A(name)(); } + +void Xhello() { printf("hello world\n"); } + +B(hello) + +int main() { XYhello(); return (0); } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/quote.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/quote.c new file mode 100644 index 000000000..f8e61700f --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/quote.c @@ -0,0 +1,6 @@ +/* Test that unterminated quotes are OK when only preprocessing. */ + +/* { dg-do preprocess } */ + +/* { dg-bogus "unterminated" } */ 'x +/* { dg-bogus "unterminated" } */ "x diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/recurse-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/recurse-1.c new file mode 100644 index 000000000..b5fd7af7f --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/recurse-1.c @@ -0,0 +1,10 @@ +/* Test for warning of and recovery from recursion in object-like + macros. */ + +/* { dg-do preprocess } */ + +#define foo foo +foo /* { dg-error "detected recursion" } */ + +#define bar a bar b +bar /* { dg-error "detected recursion" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/recurse-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/recurse-2.c new file mode 100644 index 000000000..5c6550fae --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/recurse-2.c @@ -0,0 +1,16 @@ +/* Test for warning of and recovery from recursion in function-like + macros. */ + +/* { dg-do preprocess } */ + +#define foo() foo() +foo(); /* { dg-error "detected recursion" } */ + +#define bar() bar baz() bar +bar(); /* { dg-bogus "detected recursion" } */ + +#define baz() foo() +baz(); /* { dg-error "detected recursion" } */ + +#define a(x) x(a) +a(a); /* { dg-error "detected recursion" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/recurse-3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/recurse-3.c new file mode 100644 index 000000000..91485ae5f --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/recurse-3.c @@ -0,0 +1,25 @@ +/* Tests that macros that look recursive but are not are accepted. */ + +/* { dg-do preprocess } */ + +#define g(x) x +g(g(g(g(g(g(g)))))); /* { dg-bogus "detected recursion" } */ + +/* This macro gets longer with each loop, to thwart tests for + recursion based on length. */ +#define f(a,b,c,d,e,f,g,h,i) a(b,c,d,e,f,g,h,i,2 3 4 5) +f(f,f,f,f,f,f,f,f,f) /* { dg-bogus "detected recursion" } */ + +/* The above cases should be enough, but this is taken from cccp + sources so let's try it too. */ +#define foo(x,y) bar (x (y,0), y) +foo (foo, baz); /* { dg-bogus "detected recursion" } */ + +#define mac mac/**/ro +mac /* { dg-bogus "detected recursion" } */ + +#define mac2 mac2 +"mac2" /* { dg-bogus "detected recursion" } */ + +#define macro "macro +macro mac2 /* { dg-bogus "detected recursion" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/redef1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/redef1.c new file mode 100644 index 000000000..ce5dde0bb --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/redef1.c @@ -0,0 +1,36 @@ +/* Test for redefining traditional macros with insignificant + (i.e. whitespace) differences. */ + +/* { dg-do preprocess } */ + + +#define foo bar +#define /* x */ foo /* x */ bar /* x */ + +#define quux(thud) a one and a thud and a two +#define /**/ quux( thud ) /**/ a one and a /**/ thud /**/ and /**/ a two +#define quux(thud) a one and a thud and a two /* bah */ + +#define f(x, y)x "x y z" y +#define f(x, y) x "x y z" y + +#define baz() whiz bang +#define baz() whiz bang + +#define g foo +#undef g +#define g + +/* { dg-bogus "redefined" "foo redefined" { target *-*-* } 8 } */ +/* { dg-bogus "redefined" "quux redefined" { target *-*-* } 11 } */ +/* { dg-bogus "redefined" "quux redefined" { target *-*-* } 12 } */ +/* { dg-bogus "redefined" "f redefined" { target *-*-* } 15 } */ +/* { dg-bogus "redefined" "baz redefined" { target *-*-* } 18 } */ +/* { dg-bogus "redefined" "g redefined" { target *-*-* } 22 } */ + +/* { dg-bogus "previous def" "foo prev def" { target *-*-* } 7 } */ +/* { dg-bogus "previous def" "quux prev def" { target *-*-* } 10 } */ +/* { dg-bogus "previous def" "quux prev def" { target *-*-* } 11 } */ +/* { dg-bogus "previous def" "f prev def" { target *-*-* } 14 } */ +/* { dg-bogus "previous def" "baz prev def" { target *-*-* } 17 } */ +/* { dg-bogus "previous def" "g prev def" { target *-*-* } 20 } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/redef2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/redef2.c new file mode 100644 index 000000000..5fcd5eb32 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/redef2.c @@ -0,0 +1,32 @@ +/* Test for redefining traditional macros with significant differences. */ + +/* { dg-do preprocess } */ + +#define foo bar /* { dg-message "previous def" "foo prev def" } */ +#define foo barr /* { dg-warning "redefined" "foo redefined" } */ + +#undef foo +#define foo bar /* { dg-message "previous def" "foo prev def 2" } */ +#define foo() bar /* { dg-warning "redefined" "foo redefined 2" } */ + +#undef foo +#define foo() bar /* { dg-message "previous def" "foo prev def" } */ +#define foo() barr /* { dg-warning "redefined" "foo redefined" } */ + +#define quux(thud) a thud b /* { dg-message "previous def" "quux prev def" } */ +#define quux(thu) a thud b /* { dg-warning "redefined" "quux redefined" } */ + +#define bar(x, y) x+y /* { dg-message "previous def" "bar prev def" } */ +#define bar(x, y) x+x /* { dg-warning "redefined" "bar redefined" } */ + +#define bat(x, y) x+y /* { dg-message "previous def" "bat prev def" } */ +#define bat(x, y) x+ y /* { dg-warning "redefined" "bat redefined" } */ + +#define baz(x, y) x+y /* { dg-message "previous def" "baz prev def" } */ +#define baz(x, y) x +y /* { dg-warning "redefined" "baz redefined" } */ + +#define f(x, y) "x y" /* { dg-message "previous def" "f prev def" } */ +#define f(x, y) "x y" /* { dg-warning "redefined" "f redefined" } */ + +#define g(x, y) 'x' /* { dg-message "previous def" "g prev def" } */ +#define g(x, y) ' x' /* { dg-warning "redefined" "g redefined" } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/strify.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/strify.c new file mode 100644 index 000000000..d97a43970 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/strify.c @@ -0,0 +1,18 @@ +/* Test whether traditional stringify works. */ +/* { dg-do run } */ + +#define foo(a, b) c="a"; d="b"; + +extern void abort (); +extern void exit (int); + +int main () +{ + char *c, *d; + + foo (p,q); + if (c[0] != 'p' || d[0] != 'q') + abort (); + + exit (0); +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/trad.exp b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/trad.exp new file mode 100644 index 000000000..b8723c3b8 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/trad.exp @@ -0,0 +1,43 @@ +# Copyright (C) 1997-2013 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# GCC testsuite that uses the `dg.exp' driver. + +# There's a bunch of headers we need. +if [is_remote host] { + foreach header [glob -nocomplain $srcdir/$subdir/*.{h,def} ] { + remote_download host $header + } +} + +# Load support procs. +load_lib gcc-dg.exp + +# If a testcase doesn't have special options, use these. +global DEFAULT_TRADCPPFLAGS +if ![info exists DEFAULT_TRADCPPFLAGS] then { + set DEFAULT_TRADCPPFLAGS " -traditional-cpp" +} + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \ + "" $DEFAULT_TRADCPPFLAGS + +# All done. +dg-finish diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/uchar.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/uchar.c new file mode 100644 index 000000000..8ea54a1f4 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/uchar.c @@ -0,0 +1,8 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-funsigned-char -fsigned-char -traditional-cpp" } */ + +#if defined (__CHAR_UNSIGNED__) +# error __CHAR_UNSIGNED__ defined +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/xwin1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/xwin1.c new file mode 100644 index 000000000..21220d1db --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trad/xwin1.c @@ -0,0 +1,13 @@ +/* XWindows (as of 4.3) does some pretty strange things with cpp. + This tests one of them; the leading comments are supposed to be + eaten by the preprocessor; but the 'directives' after them are + supposed to be retained as text, not processed, so that imake's cpp + can be run on the output! + { dg-do preprocess } +*/ + +/**/#if 0 +passed +/**/#endif + +/* { dg-final { scan-file xwin1.i "(^|\n)#if 0" } } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trigraphs.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trigraphs.c new file mode 100644 index 000000000..3ec5ed721 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/trigraphs.c @@ -0,0 +1,34 @@ +/* { dg-do run } */ +/* { dg-options "-ansi" } */ + +extern void abort (void); + +/* Basic tests for trigraph conversion. + All of them are here, but not in all possible contexts. *??/ +/ + +??=include <stdio.h> + +??=define TWELVE 1??/ +2 + +static const char str??(??) = "0123456789??/n"; + +int +main(void) +??< + unsigned char x = 5; + + if (sizeof str != TWELVE) + abort (); + + /* Test ^=, the only multi-character token to come from trigraphs. */ + x ??'= 3; + if (x != 6) + abort (); + + if ((5 ??! 3) != 7) + abort (); + + return 0; +??> diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/uchar-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/uchar-1.c new file mode 100644 index 000000000..3483e3281 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/uchar-1.c @@ -0,0 +1,8 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-funsigned-char -fsigned-char" } */ + +#if defined (__CHAR_UNSIGNED__) +# error __CHAR_UNSIGNED__ defined +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/uchar-3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/uchar-3.c new file mode 100644 index 000000000..41b987f5c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/uchar-3.c @@ -0,0 +1,17 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ +/* { dg-options "-funsigned-char -fpreprocessed" } */ + +/* Source: Ziemowit Laski. -fpreprocessed doesn't define macros, but + CPP would interpret charconsts based upon whether __CHAR_UNSIGNED__ + was defined. */ + +int foo() +{ + char f = 0x83; + if (f == '\x83') /* { dg-bogus "always false" } */ + f = 0; + + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucnid-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucnid-1.c new file mode 100644 index 000000000..3fad08831 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucnid-1.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-options "-std=c99 -fextended-identifiers" } */ +void abort (void); + +#define \u00C0 1 +#define \u00C1 2 +#define \U000000C2 3 +#define wh\u00ff 4 +#define a\u00c4b\u0441\U000003b4e 5 + +int main (void) +{ + + if (\u00C0 != 1) + abort (); + if (\u00c1 != 2) + abort (); + if (\u00C2 != 3) + abort (); + if (wh\u00ff != 4) + abort (); + if (a\u00c4b\u0441\U000003b4e != 5) + abort (); + + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucnid-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucnid-2.c new file mode 100644 index 000000000..6719c783f --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucnid-2.c @@ -0,0 +1,16 @@ +/* { dg-do run } */ +/* { dg-options "-std=c99 -fextended-identifiers" } */ +#include <stdlib.h> +#include <string.h> + +#define str(t) #t + +int main (void) +{ + const char s[] = str (\u30b2); + + if (strcmp (s, "\u30b2") != 0) + abort (); + + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucnid-3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucnid-3.c new file mode 100644 index 000000000..6389b7ebf --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucnid-3.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c99 -fextended-identifiers" } */ + +#define paste(x, y) x ## y + +int paste(\u00aa, \u0531) = 3; + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucnid-4.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucnid-4.c new file mode 100644 index 000000000..6a6699b94 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucnid-4.c @@ -0,0 +1,17 @@ +/* { dg-do preprocess } */ +/* { dg-options "-std=c99 -fextended-identifiers" } */ + +\u00AA +\u00AB /* { dg-error "not valid in an identifier" } */ +\u00B6 /* { dg-error "not valid in an identifier" } */ +\u00BA +\u00C0 +\u00D6 +\u0384 + +\u0669 /* { dg-error "not valid at the start of an identifier" } */ +A\u0669 +0\u00BA +0\u0669 +\u0E59 /* { dg-error "not valid at the start of an identifier" } */ +A\u0E59 diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucnid-5.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucnid-5.c new file mode 100644 index 000000000..cdccd3cdf --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucnid-5.c @@ -0,0 +1,17 @@ +/* { dg-do preprocess } */ +/* { dg-options "-std=c99 -pedantic -fextended-identifiers" } */ + +\u00AA +\u00AB /* { dg-error "not valid in an identifier" } */ +\u00B6 /* { dg-error "not valid in an identifier" } */ +\u00BA +\u00C0 +\u00D6 +\u0384 /* { dg-error "not valid in an identifier" } */ + +\u0669 /* { dg-error "not valid at the start of an identifier" } */ +A\u0669 +0\u00BA +0\u0669 +\u0E59 /* { dg-error "not valid at the start of an identifier" } */ +A\u0E59 diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucnid-6.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucnid-6.c new file mode 100644 index 000000000..9ee0858dd --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucnid-6.c @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c89" } */ +#define a b( +#define b(x) q +int a\u00aa); diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucnid-7.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucnid-7.c new file mode 100644 index 000000000..93404225d --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucnid-7.c @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c99 -fextended-identifiers" } */ +#define a b( +#define b(x) q +int a\U0000000z ); diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucnid-8.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucnid-8.c new file mode 100644 index 000000000..1f0379a5b --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucnid-8.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c99" } */ +/* Test that -std=c99 does not enable extended identifiers while the + feature is experimental; remove this test after audit of all + identifier uses in the compiler. */ +#define a b( +#define b(x) q +int a\u00aa); diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucs.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucs.c new file mode 100644 index 000000000..3f3d97edf --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/ucs.c @@ -0,0 +1,67 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ +/* { dg-options "-std=c99" } */ + +/* This tests universal character sequences. + + Neil Booth, 22 May 2001. + Richard Henderson, 3 Apr 2002. */ + +#include <limits.h> + +#define unsigned +0 +#define int +0 +#define char +1 +#define short +2 +#define long +3 + +#if __WCHAR_TYPE__ == 0 +# define WCHAR_MAX INT_MAX +#elif __WCHAR_TYPE__ == 1 +# define WCHAR_MAX CHAR_MAX +#elif __WCHAR_TYPE__ == 2 +# define WCHAR_MAX SHRT_MAX +#elif __WCHAR_TYPE__ == 3 +# define WCHAR_MAX LONG_MAX +#else +# error wacky wchar_t +#endif + +#undef unsigned +#undef int +#undef char +#undef short +#undef long + +#if L'\u1234' != 0x1234 +#error bad short ucs /* { dg-bogus "bad" "bad u1234 evaluation" } */ +#endif + +#if WCHAR_MAX >= 0x7ffffff +# if L'\U1234abcd' != 0x1234abcd +# error bad long ucs /* { dg-bogus "bad" "bad U1234abcd evaluation" } */ +# endif +#endif + +void foo () +{ + int c; + + c = L'\ubad'; /* { dg-error "incomplete" "incomplete UCN 1" } */ + c = L"\U1234"[0]; /* { dg-error "incomplete" "incompete UCN 2" } */ + + c = L'\u000x'; /* { dg-error "incomplete" "non-hex digit in UCN" } */ + /* If sizeof(HOST_WIDE_INT) > sizeof(wchar_t), we can get a multi-character + constant warning even for wide characters. */ + /* { dg-warning "too long|multi-character" "" { target *-*-* } 54 } */ + + c = '\u0024'; /* { dg-bogus "invalid" "0024 is a valid UCN" } */ + c = "\u0040"[0]; /* { dg-bogus "invalid" "0040 is a valid UCN" } */ + c = L'\u00a0'; /* { dg-bogus "invalid" "00a0 is a valid UCN" } */ + c = '\U00000060'; /* { dg-bogus "invalid" "0060 is a valid UCN" } */ + + c = '\u0025'; /* { dg-error "not a valid" "0025 invalid UCN" } */ + c = L"\uD800"[0]; /* { dg-error "not a valid" "D800 invalid UCN" } */ + c = L'\U0000DFFF'; /* { dg-error "not a valid" "DFFF invalid UCN" } */ +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/unc1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/unc1.c new file mode 100644 index 000000000..18c306fc8 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/unc1.c @@ -0,0 +1,14 @@ +/* Tests for un-terminated conditionals: 1. */ +/* { dg-do preprocess } */ + +#if 1 /* { dg-error "unterminated" "unterminated #if" } */ + +#ifdef notdef /* { dg-bogus "unterminated" "nested terminated #ifdef" } */ + +blah blah blah + +#endif + +more text + +/* oops! */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/unc2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/unc2.c new file mode 100644 index 000000000..976d2b181 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/unc2.c @@ -0,0 +1,12 @@ +/* Tests for unterminated conditionals: 2. */ +/* { dg-do preprocess } */ + +#ifdef __sparc__ /* { dg-error "unterminated" "unterminated if-elif-elif..." } */ +sparc +#elif defined __powerpc__ +ppc +#elif defined __i386__ +i386 +#elif defined __vax__ +vax + diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/unc3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/unc3.c new file mode 100644 index 000000000..d5f16f738 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/unc3.c @@ -0,0 +1,5 @@ +/* Tests for unterminated conditionals: 3. */ +/* { dg-do preprocess } */ + +#if 1 /* { dg-error "#else" "unterminated #else" } */ +#else diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/unc4.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/unc4.c new file mode 100644 index 000000000..10c49e9d4 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/unc4.c @@ -0,0 +1,39 @@ +/* { dg-do preprocess } */ + +/* Tests for un-terminated conditional diagnostics. + Copyright (c) 1999 Free Software Foundation. + Contributed by Zack Weinberg, who made it up all by himself. */ + +#endif /* { dg-error "#endif" "#endif without #if" } */ + +#else /* { dg-error "#else" "#else without #if" } */ +#endif /* { dg-error "#endif" "#endif after #else without #if" } */ + +#elif 0 /* { dg-error "#elif" "#elif without #if" } */ +#endif /* { dg-error "#endif" "#endif after #else without #if" } */ + +#if 1 /* { dg-bogus "unterminated" "terminated true conditional" } */ +blah +#endif + +#if 0 /* { dg-bogus "unterminated" "terminated false conditional" } */ +ignored +#endif + +/* We shouldn't see unbalanced conditionals inside #if'ed out #includes. */ +#if 0 +#include "unc1.c" +#endif + +/* The ifdef below should not get an error just because there's a bad if + inside the included file. + The odd dg-error tag on the include matches the "In file included from" + message. */ +#define FOO +#ifdef FOO /* { dg-bogus "unterminated" "nested unterm" } */ +#include "unc1.c" /* { dg-message "file included from" "" { target *-*-* } 0 } */ +#endif + +/* dg.exp doesn't read the included files for tags, so we have to + do them explicitly here. */ +/* { dg-error "#if" "unc1.c: unterminated #if" { target *-*-* } 4 } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/undef-opt-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/undef-opt-1.c new file mode 100644 index 000000000..99c524662 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/undef-opt-1.c @@ -0,0 +1,8 @@ +/* Test -undef. A bug in its handling broke glibc builds because + "linux" was wrongly defined. */ +/* { dg-do preprocess } */ +/* { dg-options "-undef" } */ + +#ifdef linux +#error -undef broken +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/undef2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/undef2.c new file mode 100644 index 000000000..5614e039b --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/undef2.c @@ -0,0 +1,23 @@ +/* C99 6.10.8 para 4: None of [the predefined macro names] shall be + the subject of a #define or an #undef preprocessing directive. */ + +/* { dg-do preprocess } */ + +#undef __DATE__ /* { dg-warning "undefining" "__DATE__" } */ +#undef __TIME__ /* { dg-warning "undefining" "__TIME__" } */ +#undef __FILE__ /* { dg-warning "undefining" "__FILE__" } */ +#undef __LINE__ /* { dg-warning "undefining" "__LINE__" } */ +#undef __STDC__ /* { dg-warning "undefining" "__STDC__" } */ + +/* These should be protected from #undef, but aren't, because they + are set with normal #define commands - and on top of that, some + of them are library properties, outside our control. To consider: + warn about undefining/redefining any identifier beginning with + __STDC_ . + + __STDC_HOSTED__ + __STDC_VERSION__ + __STDC_IEC_559__ + __STDC_IEC_559_COMPLEX__ + __STDC_ISO_10646__ + */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/usr/include/stdio.h b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/usr/include/stdio.h new file mode 100644 index 000000000..c674e89f7 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/usr/include/stdio.h @@ -0,0 +1,4 @@ +/* Used by gcc.dg/cpp/isysroot-1.c to test isysroot. */ +void foo() +{ +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/utf8-5byte-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/utf8-5byte-1.c new file mode 100644 index 000000000..7f96a5684 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/utf8-5byte-1.c @@ -0,0 +1,17 @@ +/* Test for bug in conversions from 5-byte UTF-8 sequences in + cpplib. */ +/* { dg-do run { target { 4byte_wchar_t } } } */ +/* { dg-options "-std=gnu99" } */ + +extern void abort (void); +extern void exit (int); + +__WCHAR_TYPE__ ws[] = L"û¿¿¿¿"; + +int +main (void) +{ + if (ws[0] != L'\U03FFFFFF' || ws[1] != 0) + abort (); + exit (0); +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/vararg1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/vararg1.c new file mode 100644 index 000000000..38bf56bd0 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/vararg1.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-options -w } */ + +/* count() used to give 1 owing to a buggy test for varargs. */ +#define count(y...) count1 ( , ##y) +#define count1(y...) count2 (y,1,0) +#define count2(_,x0,n,y...) n +#if count() != 0 || count(A) != 1 +#error Incorrect vararg argument counts +#endif + +/* Test for changed behavior of the GNU varargs extension. + ##args, where args is a rest argument which received zero tokens, + used to delete the previous sequence of nonwhitespace characters. + Now it deletes the previous token. */ + +#include <string.h> + +#define S(str, args...) " " str "\n", ##args + +int +main() +{ + const char *s = S("foo"); + return strchr (s, '\n') == NULL; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/vararg2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/vararg2.c new file mode 100644 index 000000000..2b2b0335c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/vararg2.c @@ -0,0 +1,131 @@ +/* { dg-do preprocess } */ +/* { dg-options "-std=gnu99" } */ + +/* Jamie's varargs macros from hell. Not for the faint of heart. + Great tests that C99 and GNU varargs give identical results. + Adapted to the testsuite by Neil Booth, 1 Nov 2000. */ + +/* Permission is granted to use, copy, modify and distribute this file + freely for any purpose whatsoever. This file is free software, and + there's no warranty. + + -- Jamie Lokier <jamie.lokier@cern.ch>, 25/Sep/2000. */ + +#define dup3(x) x,x,x + +/* Count elements in a list (0 to 10 max). */ +#define gnu_count(y...) _gnu_count1 ( , ##y) +#define _gnu_count1(y...) _gnu_count2 (y,10,9,8,7,6,5,4,3,2,1,0) +#define _gnu_count2(_,x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,n,ys...) n + +/* Tail of a list. */ +#define gnu_tail(y...) _gnu_tail (y) +#define _gnu_tail(x,y...) y + +/* Repeat N times. */ +#define gnu_repeat(n, x) gnu_tail (_gnu_repeat (n, x)) +#define _gnu_repeat(n, x) _gnu_repeat_##n (x) +#define _gnu_repeat_0(x) +#define _gnu_repeat_1(x) ,x +#define _gnu_repeat_2(x) ,x,x +#define _gnu_repeat_3(x) ,x,x,x +#define _gnu_repeat_4(x) ,x,x,x,x +#define _gnu_repeat_5(x) ,x,x,x,x,x + +#define _gnu_keep(xs...) xs +#define _gnu_discard(xs...) +#define _gnu_split_r(n,xs...) _gnu_split_rd (n,_gnu_keep,_gnu_discard xs) +#define _gnu_split_d(n,xs...) _gnu_split_rd (n,_gnu_discard,_gnu_keep xs) +#define _gnu_split_rd(n,xs...) _gnu_split_##n (xs) +#define _gnu_split_0(a,b,xs...) a() b(xs) +#define _gnu_split_1(a,b,x0,xs...) a(x0) b(xs) +#define _gnu_split_2(a,b,x0,x1,xs...) a(x0,x1) b(xs) +#define _gnu_split_3(a,b,x0,x1,x2,xs...) a(x0,x1,x2) b(xs) +#define _gnu_split_4(a,b,x0,x1,x2,x3,xs...) a(x0,x1,x2,x3) b(xs) +#define _gnu_split_5(a,b,x0,x1,x2,x3,x4,xs...) a(x0,x1,x2,x3,x4) b(xs) + +/* List manipulations. Surprise: index zero is the rightmost element. */ +#define gnu_take(n, xs...) \ + _gnu_split_d (_gnu_count1 ( , ## xs), _gnu_repeat (n, _gnu_error) , ## xs) +#define gnu_drop(n, xs...) \ + _gnu_split_d (n,,_gnu_split_r (_gnu_count1 ( , ## xs), _gnu_repeat (n, _gnu_error) , ## xs)) +#define gnu_index(pos, xs...) gnu_take (1, gnu_drop (pos , ## xs)) + +/* C99 __VA_ARGS__ versions */ +#define c99_count(...) _c99_count1 ( , ##__VA_ARGS__)/* If only ## worked.*/ +#define _c99_count1(...) _c99_count2 (__VA_ARGS__,10,9,8,7,6,5,4,3,2,1,0) +#define _c99_count2(_,x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,n,...) n + +#define c99_tail(...) _c99_tail (__VA_ARGS__) +#define _c99_tail(x,...) __VA_ARGS__ + +/* Repeat N times. */ +#define c99_repeat(n, x) c99_tail (_c99_repeat (n, x)) +#define _c99_repeat(n, x) _c99_repeat_##n (x) +#define _c99_repeat_0(x) +#define _c99_repeat_1(x) ,x +#define _c99_repeat_2(x) ,x,x +#define _c99_repeat_3(x) ,x,x,x +#define _c99_repeat_4(x) ,x,x,x,x +#define _c99_repeat_5(x) ,x,x,x,x,x + +#define _c99_keep(...) __VA_ARGS__ +#define _c99_discard(...) +#define _c99_split_r(n,...) _c99_split_rd(n,_c99_keep,_c99_discard __VA_ARGS__) +#define _c99_split_d(n,...) _c99_split_rd(n,_c99_discard,_c99_keep __VA_ARGS__) +#define _c99_split_rd(n,...) _c99_split_##n (__VA_ARGS__) +#define _c99_split_0(a,b,...) a() b(__VA_ARGS__) +#define _c99_split_1(a,b,x0,...) a(x0) b(__VA_ARGS__) +#define _c99_split_2(a,b,x0,x1,...) a(x0,x1) b(__VA_ARGS__) +#define _c99_split_3(a,b,x0,x1,x2,...) a(x0,x1,x2) b(__VA_ARGS__) +#define _c99_split_4(a,b,x0,x1,x2,x3,...) a(x0,x1,x2,x3) b(__VA_ARGS__) +#define _c99_split_5(a,b,x0,x1,x2,x3,x4,...) a(x0,x1,x2,x3,x4) b(__VA_ARGS__) + +/* List manipulations. Surprise: index zero is the rightmost element. */ +#define c99_take(n, ...) \ + _c99_split_d (_c99_count1 ( , ## __VA_ARGS__), _c99_repeat (n, _c99_error) , ## __VA_ARGS__) +#define c99_drop(n, ...) \ + _c99_split_d (n,,_c99_split_r (_c99_count1 ( , ## __VA_ARGS__), _c99_repeat (n, _c99_error) , ## __VA_ARGS__)) +#define c99_index(pos, ...) c99_take (1, c99_drop (pos , ## __VA_ARGS__)) + +/************** Expansions **************/ + +/* Correct answers are 0, 0, 1, 2, 10. */ +#if _gnu_count1 () != 0 || gnu_count () != 0 || gnu_count (A) != 1 \ + || gnu_count (,) != 2 || gnu_count (A, B, C, D, E, F, G, H, I, J) != 10 +#error gnu_count +#endif + +/* Correct answers are empty, 'x'. */ +#if gnu_repeat (0, 'x') gnu_repeat (1, 'x') != 'x' +#error gnu_repeat +#endif + +/* Correct answers are "e", "b", "a", empty. */ +#if gnu_index (0, 'a', 'b', 'c', 'd', 'e') != 'e' \ + || gnu_index (3, 'a', 'b', 'c', 'd', 'e') != 'b' \ + || gnu_index (4, 'a', 'b', 'c', 'd', 'e') != 'a' \ + gnu_index (5, 'a', 'b', 'c', 'd', 'e') +#error gnu_index +#endif + +/************* C99 tests *************/ + +/* The answers are 0, 0, 1, 2, 10 as for the non-C99 version. */ +#if _c99_count1 () != 0 || c99_count () != 0 || c99_count (A) != 1 \ + || c99_count (,) != 2 || c99_count (A, B, C, D, E, F, G, H, I, J) != 10 +#error c99_count +#endif + +/* Correct answers are empty, 'x'. */ +#if c99_repeat (0, 'x') c99_repeat (1, 'x') != 'x' +#error c99_repeat +#endif + +/* Correct answers are "e", "b", "a", empty. */ +#if c99_index (0, 'a', 'b', 'c', 'd', 'e') != 'e' \ + || c99_index (3, 'a', 'b', 'c', 'd', 'e') != 'b' \ + || c99_index (4, 'a', 'b', 'c', 'd', 'e') != 'a' \ + c99_index (5, 'a', 'b', 'c', 'd', 'e') +#error gnu_index +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/vararg3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/vararg3.c new file mode 100644 index 000000000..b17afd89e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/vararg3.c @@ -0,0 +1,17 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-std=c99" } */ + +/* Source: Neil Booth, 6 Aug 2002. + + Tests that we DTRT with varargs commas for a single-parameter macro + when in standards-conforming mode. */ + +#define f(...) , ## __VA_ARGS__ + +/* The comma from f's expansion should be retained (standards + conforming mode only). Tests that it isn't in non-standards mode + include macro8.c and vararg1.c. */ +#if 2 f() 3 /* { dg-bogus "missing binary operator" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/vararg4.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/vararg4.c new file mode 100644 index 000000000..460cebf28 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/vararg4.c @@ -0,0 +1,14 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options -std=gnu99 } */ + +/* Source: Neil Booth, 6 Aug 2002. + + Tests that we DTRT with varargs commas. */ + +#define g(a, ...) a , ## __VA_ARGS__ + +/* The comma from g's expansion should be retained. */ +#if g (2, ) 3 /* { dg-bogus "missing binary operator" } */ +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/very-long-comment.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/very-long-comment.c new file mode 100644 index 000000000..88d8eb936 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/very-long-comment.c @@ -0,0 +1,14 @@ +/* +This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. This is a really long comment. + */ +/* This testcase for PR 20907 is a bit finicky about the placement of + comment so avoid editing the text above here. */ +/* { dg-options "-Wall" } */ +/* { dg-do compile } */ +#warning test warning /* { dg-warning "test warning" } */ +#include <stdio.h> +int main() +{ + printf("This is line %d\n", __LINE__); + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-comments-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-comments-2.c new file mode 100644 index 000000000..492b99cb9 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-comments-2.c @@ -0,0 +1,7 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=comments" } +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ +/* /* */ // { dg-error "\"\.\*\" within comment .-Werror=comment." } + +// \ + // { dg-error "multi-line comment .-Werror=comment." "multi-line" { target *-*-* } 6 } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-comments-3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-comments-3.c new file mode 100644 index 000000000..639fa1015 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-comments-3.c @@ -0,0 +1,7 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=comment" } +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ +/* /* */ // { dg-error "\"\.\*\" within comment .-Werror=comment." } + +// \ + // { dg-error "multi-line comment .-Werror=comment." "multi-line" { target *-*-* } 6 } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-comments.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-comments.c new file mode 100644 index 000000000..1cdf75cf2 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-comments.c @@ -0,0 +1,7 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Wcomments" } + +/* /* */ // { dg-warning "\"\.\*\" within comment .-Wcomment." } + +// \ + // { dg-warning "multi-line comment .-Wcomment." "multi-line" { target *-*-* } 6 } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-cxx-compat-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-cxx-compat-2.c new file mode 100644 index 000000000..69c4cfa0c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-cxx-compat-2.c @@ -0,0 +1,4 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=c++-compat" } +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ +#define not ! // { dg-error "identifier \"not\" is a special operator name in C\\+\\+ .-Werror=c\\+\\+-compat." } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-cxx-compat.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-cxx-compat.c new file mode 100644 index 000000000..2e7b25932 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-cxx-compat.c @@ -0,0 +1,4 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Wc++-compat" } + +#define not ! // { dg-warning "identifier \"not\" is a special operator name in C\\+\\+ .-Wc\\+\\+-compat." } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-deprecated-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-deprecated-2.c new file mode 100644 index 000000000..8bd608ab7 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-deprecated-2.c @@ -0,0 +1,7 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=deprecated" } +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ +#assert x(x) // { dg-error "#assert is a deprecated GCC extension .-Werror=deprecated." } + +#if #x(x) // { dg-error "assertions are a deprecated extension .-Werror=deprecated." } +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-deprecated.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-deprecated.c new file mode 100644 index 000000000..84214b1f8 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-deprecated.c @@ -0,0 +1,7 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Wdeprecated" } + +#assert x(x) // { dg-warning "#assert is a deprecated GCC extension .-Wdeprecated." } + +#if #x(x) // { dg-warning "assertions are a deprecated extension .-Wdeprecated." } +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-long-long-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-long-long-2.c new file mode 100644 index 000000000..7b074a37c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-long-long-2.c @@ -0,0 +1,6 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Wtraditional -Werror=long-long" } +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ +#if 0LL // { dg-error "traditional C rejects the \"LL\" suffix .-Werror=long-long." } + // { dg-error "use of C99 long long integer constant .-Werror=long-long." "use long long" { target *-*-* } 4 } +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-long-long.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-long-long.c new file mode 100644 index 000000000..e86f9a628 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-long-long.c @@ -0,0 +1,6 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Wtraditional -Wlong-long" } + +#if 0LL // { dg-warning "traditional C rejects the \"LL\" suffix .-Wlong-long." } + // { dg-warning "use of C99 long long integer constant .-Wlong-long." "use long long" { target *-*-* } 4 } +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-multichar-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-multichar-2.c new file mode 100644 index 000000000..5b5a0cc37 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-multichar-2.c @@ -0,0 +1,5 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=multichar" } +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ +#if 'ab' // { dg-error "multi-character character constant .-Werror=multichar." } +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-multichar.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-multichar.c new file mode 100644 index 000000000..9188a1586 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-multichar.c @@ -0,0 +1,5 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Wmultichar" } + +#if 'ab' // { dg-warning "multi-character character constant .-Wmultichar." } +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-normalized-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-normalized-1.c new file mode 100644 index 000000000..fe1c57530 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-normalized-1.c @@ -0,0 +1,4 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -fextended-identifiers -Wnormalized=nfc" } + +\u0F43 // { dg-warning "`.U00000f43' is not in NFC .-Wnormalized=." } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-normalized-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-normalized-2.c new file mode 100644 index 000000000..f1fb96833 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-normalized-2.c @@ -0,0 +1,4 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -fextended-identifiers -Wnormalized=nfkc" } + +\u00AA // { dg-warning "`.U000000aa' is not in NFKC .-Wnormalized=." } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-normalized-3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-normalized-3.c new file mode 100644 index 000000000..43ea76a0e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-normalized-3.c @@ -0,0 +1,5 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -fextended-identifiers -Werror=normalized=" } +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ + // { dg-prune-output ".*-Werror=normalized=: set -Wnormalized=nfc.*" } +\u0F43 // { dg-error "`.U00000f43' is not in NFC .-Werror=normalized=." } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-redefined-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-redefined-2.c new file mode 100644 index 000000000..e6b209c1e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-redefined-2.c @@ -0,0 +1,18 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=builtin-macro-redefined" } +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ +#ifndef __TIME__ +#error "__TIME__ builtin is not defined" +// { dg-bogus "__TIME__ builtin is not defined" "no-time" { target *-*-* } 5 } +#endif + +#define __TIME__ "X" // { dg-error "\"__TIME__\" redefined .-Werror=builtin-macro-redefined." } + +#define __TIME__ "Y" // { dg-bogus "-Wbuiltin-macro-redefined" } + // { dg-warning "\"__TIME__\" redefined" "not-builtin-1" { target *-*-* } 11 } + // { dg-message "previous definition" "previous-1" { target *-*-* } 9 } + +#define X "X" +#define X "Y" // { dg-bogus "-Wbuiltin-macro-redefined" } + // { dg-warning "\"X\" redefined" "not-builtin-2" { target *-*-* } 16 } + // { dg-message "previous definition" "previous-2" { target *-*-* } 15 } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-redefined.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-redefined.c new file mode 100644 index 000000000..1d3e7fc3e --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-redefined.c @@ -0,0 +1,18 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Wbuiltin-macro-redefined" } + +#ifndef __TIME__ +#error "__TIME__ builtin is not defined" +// { dg-bogus "__TIME__ builtin is not defined" "no-time" { target *-*-* } 5 } +#endif + +#define __TIME__ "X" // { dg-warning "\"__TIME__\" redefined .-Wbuiltin-macro-redefined." } + +#define __TIME__ "Y" // { dg-bogus "-Wbuiltin-macro-redefined" } + // { dg-warning "\"__TIME__\" redefined" "not-builtin-1" { target *-*-* } 11 } + // { dg-message "previous definition" "previous-1" { target *-*-* } 9 } + +#define X "X" +#define X "Y" // { dg-bogus "-Wbuiltin-macro-redefined" } + // { dg-warning "\"X\" redefined" "not-builtin-2" { target *-*-* } 16 } + // { dg-message "previous definition" "previous-2" { target *-*-* } 15 } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-traditional-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-traditional-2.c new file mode 100644 index 000000000..05477afef --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-traditional-2.c @@ -0,0 +1,23 @@ +// { dg-do compile } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=traditional -Wno-deprecated -Wno-long-long" } +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ +#assert x(x) // { dg-error "suggest hiding #assert from traditional C with an indented # .-Werror=traditional." } + + #define X X // { dg-error "traditional C ignores #define with the # indented .-Werror=traditional." } + +#if 0 +#elif 1 // { dg-error "suggest not using #elif in traditional C .-Werror=traditional." } +#endif + +#define f(X) X +int f; // { dg-error "function-like macro \"f\" must be used with arguments in traditional C .-Werror=traditional." } + +#if 0U // { dg-error "traditional C rejects the \"U\" suffix .-Werror=traditional." } +#endif + +#if +1 // { dg-error " traditional C rejects the unary plus operator .-Werror=traditional." } +#endif + +char *x = "\x0"; // { dg-error "the meaning of '.x' is different in traditional C .-Werror=traditional." } +char *y = "\a"; // { dg-error "the meaning of '.a' is different in traditional C .-Werror=traditional." } +char *z = "\u0F43"; // { dg-error "the meaning of '.u' is different in traditional C .-Werror=traditional." } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-traditional.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-traditional.c new file mode 100644 index 000000000..f72f6db69 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-traditional.c @@ -0,0 +1,23 @@ +// { dg-do compile } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Wtraditional -Wno-deprecated -Wno-long-long" } + +#assert x(x) // { dg-warning "suggest hiding #assert from traditional C with an indented # .-Wtraditional." } + + #define X X // { dg-warning "traditional C ignores #define with the # indented .-Wtraditional." } + +#if 0 +#elif 1 // { dg-warning "suggest not using #elif in traditional C .-Wtraditional." } +#endif + +#define f(X) X +int f; // { dg-warning "function-like macro \"f\" must be used with arguments in traditional C .-Wtraditional." } + +#if 0U // { dg-warning "traditional C rejects the \"U\" suffix .-Wtraditional." } +#endif + +#if +1 // { dg-warning " traditional C rejects the unary plus operator .-Wtraditional." } +#endif + +char *x = "\x0"; // { dg-warning "the meaning of '.x' is different in traditional C .-Wtraditional." } +char *y = "\a"; // { dg-warning "the meaning of '.a' is different in traditional C .-Wtraditional." } +char *z = "\u0F43"; // { dg-warning "the meaning of '.u' is different in traditional C .-Wtraditional." } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-trigraphs-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-trigraphs-1.c new file mode 100644 index 000000000..4f3779df2 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-trigraphs-1.c @@ -0,0 +1,4 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -trigraphs -Wtrigraphs" } + +??= // { dg-warning "trigraph \\?\\?= converted to # .-Wtrigraphs." } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-trigraphs-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-trigraphs-2.c new file mode 100644 index 000000000..ff87ae549 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-trigraphs-2.c @@ -0,0 +1,4 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Wtrigraphs" } + +??= // { dg-warning "trigraph \\?\\?= ignored, use -trigraphs to enable .-Wtrigraphs." } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-trigraphs-3.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-trigraphs-3.c new file mode 100644 index 000000000..e7537c868 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-trigraphs-3.c @@ -0,0 +1,4 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -trigraphs -Werror=trigraphs" } +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ +??= // { dg-error "trigraph \\?\\?= converted to # .-Werror=trigraphs." } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-trigraphs-4.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-trigraphs-4.c new file mode 100644 index 000000000..d8333d4c3 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-trigraphs-4.c @@ -0,0 +1,4 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=trigraphs" } +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ +??= // { dg-error "trigraph \\?\\?= ignored, use -trigraphs to enable .-Werror=trigraphs." } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-undef-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-undef-2.c new file mode 100644 index 000000000..15fdde95c --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-undef-2.c @@ -0,0 +1,5 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=undef" } +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ +#if x // { dg-error "\"x\" is not defined .-Werror=undef." } +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-undef.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-undef.c new file mode 100644 index 000000000..dd4524d81 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-undef.c @@ -0,0 +1,5 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Wundef" } + +#if x // { dg-warning "\"x\" is not defined .-Wundef." } +#endif diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-unused-macros-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-unused-macros-2.c new file mode 100644 index 000000000..d7fe145c8 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-unused-macros-2.c @@ -0,0 +1,4 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=unused-macros" } +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ +#define X X // { dg-error "macro \"X\" is not used .-Werror=unused-macros." } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-unused-macros.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-unused-macros.c new file mode 100644 index 000000000..e1ce94eee --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-unused-macros.c @@ -0,0 +1,4 @@ +// { dg-do preprocess } +// { dg-options "-std=gnu99 -fdiagnostics-show-option -Wunused-macros" } + +#define X X // { dg-warning "macro \"X\" is not used .-Wunused-macros." } diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-variadic-2.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-variadic-2.c new file mode 100644 index 000000000..1a266cd24 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-variadic-2.c @@ -0,0 +1,6 @@ +/* { dg-do preprocess } */ +/* { dg-options "-ansi -fdiagnostics-show-option -pedantic -Werror=variadic-macros" } */ +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ +#define F(...) X /* { dg-error "anonymous variadic macros were introduced in C99 .-Werror=variadic-macros." } */ + +#define G(X...) X /* { dg-error "ISO C does not permit named variadic macros .-Werror=variadic-macros." } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-variadic.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-variadic.c new file mode 100644 index 000000000..ba66c9018 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/warn-variadic.c @@ -0,0 +1,6 @@ +/* { dg-do preprocess } */ +/* { dg-options "-ansi -fdiagnostics-show-option -pedantic -Wvariadic-macros" } */ + +#define F(...) X /* { dg-warning "anonymous variadic macros were introduced in C99 .-Wvariadic-macros." } */ + +#define G(X...) X /* { dg-warning "ISO C does not permit named variadic macros .-Wvariadic-macros." } */ diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/wchar-1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/wchar-1.c new file mode 100644 index 000000000..ac9b38b80 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/wchar-1.c @@ -0,0 +1,24 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. */ + +/* { dg-do run } */ +/* { dg-options "-w" } */ + +/* Source: Neil Booth, 24 Feb 2002. + + Test if compiler and preprocessor agree on signeness of wide + chars. */ + +int main () +{ + __WCHAR_TYPE__ c = -1; + +#if L'\x0' - 1 < 0 + if (c > 0) + abort (); +#else + if (c < 0) + abort (); +#endif + + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/gcc.dg/cpp/widestr1.c b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/widestr1.c new file mode 100644 index 000000000..0b68201b0 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/gcc.dg/cpp/widestr1.c @@ -0,0 +1,9 @@ +/* Copyright (C) 2000, 2001 Free Software Foundation. + + by Alexandre Oliva <oliva@lsd.ic.unicamp.br> */ + +/* { dg-do preprocess } */ + +#line 1 L"foo" /* { dg-error "not a valid filename" "wide string in #line" } */ +#include L"stdio.h" /* { dg-error "expects" "wide string in #include" } */ + |