aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/Wunused.c37
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/Wunused.h1
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/__STDC__.c7
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/argcount.c21
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/assembler.S29
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/assert1.c46
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/assert2.c24
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/assert3.c10
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/builtins.c54
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/builtins.h1
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-C.c37
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-C2.c11
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-dD.c9
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-dM.c9
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/comment-2.c11
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/comment-3.c6
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/comment.c5
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/define.c2
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/defined.c78
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/directive.c23
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/escaped-eof.c6
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/escaped-nl.c10
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/funlike-2.c23
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/funlike-3.c12
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/funlike-4.c26
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/funlike-5.c10
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/funlike.c25
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/hash.c14
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/include.c12
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/literals-1.c28
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/literals-2.c8
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/maccom1.c13
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/maccom2.c14
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/maccom3.c13
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/maccom4.c17
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/maccom6.c20
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/macro.c11
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/macroargs.c43
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi1.c36
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi1c.h12
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi1nd.h8
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi1ndp.h7
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi1x.h9
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi2.c12
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi2a.h5
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi2b.h6
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi2c.h15
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi3.c20
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi3.def10
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi3.h7
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi4.c10
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi5.c13
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi6.c61
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi6a.h5
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi6b.h5
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi6c.h5
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi6d.h5
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi6e.h5
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi7.c19
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi7a.h4
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi7b.h4
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/null-drctv.c6
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/num-sign.c16
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/paste.c18
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/quote.c6
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/recurse-1.c10
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/recurse-2.c16
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/recurse-3.c25
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/redef1.c36
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/redef2.c32
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/strify.c18
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/trad.exp43
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/uchar.c8
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/xwin1.c13
74 files changed, 1256 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/Wunused.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/Wunused.c
new file mode 100644
index 000000000..403d617f5
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/Wunused.h b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/Wunused.h
new file mode 100644
index 000000000..8b54412bd
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/Wunused.h
@@ -0,0 +1 @@
+#define unused_but_ok
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/__STDC__.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/__STDC__.c
new file mode 100644
index 000000000..b25bcb9aa
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/argcount.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/argcount.c
new file mode 100644
index 000000000..208cd44b3
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/assembler.S b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/assembler.S
new file mode 100644
index 000000000..75bb62841
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/assert1.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/assert1.c
new file mode 100644
index 000000000..d1446105c
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/assert2.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/assert2.c
new file mode 100644
index 000000000..4aa0b9944
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/assert3.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/assert3.c
new file mode 100644
index 000000000..9010ecebd
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/builtins.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/builtins.c
new file mode 100644
index 000000000..74798bbb4
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/builtins.h b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/builtins.h
new file mode 100644
index 000000000..9f2b9a014
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/builtins.h
@@ -0,0 +1 @@
+int level = __INCLUDE_LEVEL__;
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-C.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-C.c
new file mode 100644
index 000000000..ff67ddbdb
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-C2.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-C2.c
new file mode 100644
index 000000000..96bd371a9
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-dD.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-dD.c
new file mode 100644
index 000000000..1e4c8c867
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-dM.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-dM.c
new file mode 100644
index 000000000..0fb5bd9dd
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/comment-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/comment-2.c
new file mode 100644
index 000000000..8d54e3a0f
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/comment-3.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/comment-3.c
new file mode 100644
index 000000000..e2710ad56
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/comment.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/comment.c
new file mode 100644
index 000000000..971a78a6d
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/define.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/define.c
new file mode 100644
index 000000000..d83288df2
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/defined.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/defined.c
new file mode 100644
index 000000000..5fa1d93b8
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/directive.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/directive.c
new file mode 100644
index 000000000..ee7ebcab0
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/escaped-eof.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/escaped-eof.c
new file mode 100644
index 000000000..2c9c185b1
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/escaped-nl.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/escaped-nl.c
new file mode 100644
index 000000000..be8cc53fe
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/funlike-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/funlike-2.c
new file mode 100644
index 000000000..edcf2abf2
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/funlike-3.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/funlike-3.c
new file mode 100644
index 000000000..5300afba7
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/funlike-4.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/funlike-4.c
new file mode 100644
index 000000000..fcc65a8d6
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/funlike-5.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/funlike-5.c
new file mode 100644
index 000000000..f60a6ea78
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/funlike.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/funlike.c
new file mode 100644
index 000000000..db550d53c
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/hash.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/hash.c
new file mode 100644
index 000000000..8108c89fb
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/include.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/include.c
new file mode 100644
index 000000000..94d25f815
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/literals-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/literals-1.c
new file mode 100644
index 000000000..15c8030fa
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/literals-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/literals-2.c
new file mode 100644
index 000000000..b471772f6
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/maccom1.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/maccom1.c
new file mode 100644
index 000000000..28602a51a
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/maccom2.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/maccom2.c
new file mode 100644
index 000000000..068c357c1
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/maccom3.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/maccom3.c
new file mode 100644
index 000000000..a6eb3f854
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/maccom4.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/maccom4.c
new file mode 100644
index 000000000..eac52da0d
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/maccom6.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/maccom6.c
new file mode 100644
index 000000000..baf5e980d
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/macro.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/macro.c
new file mode 100644
index 000000000..164b4ecfe
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/macroargs.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/macroargs.c
new file mode 100644
index 000000000..c5f91d9f2
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/mi1.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi1.c
new file mode 100644
index 000000000..4004d2183
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/mi1c.h b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi1c.h
new file mode 100644
index 000000000..2956286eb
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/mi1nd.h b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi1nd.h
new file mode 100644
index 000000000..c14c1a3c6
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/mi1ndp.h b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi1ndp.h
new file mode 100644
index 000000000..b84202c6d
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/mi1x.h b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi1x.h
new file mode 100644
index 000000000..a317cf852
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/mi2.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi2.c
new file mode 100644
index 000000000..916d5a949
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/mi2a.h b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi2a.h
new file mode 100644
index 000000000..e3f53b6cb
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/mi2b.h b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi2b.h
new file mode 100644
index 000000000..1d9a8b9b1
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/mi2c.h b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi2c.h
new file mode 100644
index 000000000..521792bee
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/mi3.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi3.c
new file mode 100644
index 000000000..f33fd7887
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/mi3.def b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi3.def
new file mode 100644
index 000000000..375d9c7fe
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/mi3.h b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi3.h
new file mode 100644
index 000000000..8774fcf48
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/mi4.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi4.c
new file mode 100644
index 000000000..c886cc2c8
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/mi5.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi5.c
new file mode 100644
index 000000000..ece38b5a6
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/mi6.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi6.c
new file mode 100644
index 000000000..c3af2d3f2
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/mi6a.h b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi6a.h
new file mode 100644
index 000000000..68a2fce47
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/mi6b.h b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi6b.h
new file mode 100644
index 000000000..d2fe8be17
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/mi6c.h b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi6c.h
new file mode 100644
index 000000000..d19cb5433
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi6c.h
@@ -0,0 +1,5 @@
+#if !DEFINED
+ #ifdef VAR
+ VAR++;
+ #endif
+#endif
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi6d.h b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi6d.h
new file mode 100644
index 000000000..a1eabba8e
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/mi6e.h b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi6e.h
new file mode 100644
index 000000000..26ba71514
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/mi7.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi7.c
new file mode 100644
index 000000000..d980586f9
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/mi7a.h b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi7a.h
new file mode 100644
index 000000000..0c701d7e6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi7a.h
@@ -0,0 +1,4 @@
+:
+#ifndef GUARD1
+#define GUARD1
+#endif
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi7b.h b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi7b.h
new file mode 100644
index 000000000..1747e5482
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/mi7b.h
@@ -0,0 +1,4 @@
+#ifndef GUARD2
+#define GUARD2
+#endif
+:
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/null-drctv.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/null-drctv.c
new file mode 100644
index 000000000..99fd251f2
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/num-sign.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/num-sign.c
new file mode 100644
index 000000000..64f12c072
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/paste.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/paste.c
new file mode 100644
index 000000000..9b83fd30f
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/quote.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/quote.c
new file mode 100644
index 000000000..f8e61700f
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/recurse-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/recurse-1.c
new file mode 100644
index 000000000..b5fd7af7f
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/recurse-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/recurse-2.c
new file mode 100644
index 000000000..5c6550fae
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/recurse-3.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/recurse-3.c
new file mode 100644
index 000000000..91485ae5f
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/redef1.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/redef1.c
new file mode 100644
index 000000000..ce5dde0bb
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/redef2.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/redef2.c
new file mode 100644
index 000000000..5fcd5eb32
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/strify.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/strify.c
new file mode 100644
index 000000000..d97a43970
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/trad.exp b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/trad.exp
new file mode 100644
index 000000000..c00a17c9b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/trad.exp
@@ -0,0 +1,43 @@
+# Copyright (C) 1997-2014 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.9/gcc/testsuite/gcc.dg/cpp/trad/uchar.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/uchar.c
new file mode 100644
index 000000000..8ea54a1f4
--- /dev/null
+++ b/gcc-4.9/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.9/gcc/testsuite/gcc.dg/cpp/trad/xwin1.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/trad/xwin1.c
new file mode 100644
index 000000000..21220d1db
--- /dev/null
+++ b/gcc-4.9/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" } } */