URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Subversion Repositories openrisc_me
Compare Revisions
- This comparison shows the changes necessary to convert path
/openrisc/trunk/gnu-src/gcc-4.2.2/gcc/testsuite/gcc.dg/cpp/trad
- from Rev 149 to Rev 154
- ↔ Reverse comparison
Rev 149 → Rev 154
/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! */ |
mi1c.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: defined.c
===================================================================
--- defined.c (nonexistent)
+++ defined.c (revision 154)
@@ -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
defined.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: funlike-5.c
===================================================================
--- funlike-5.c (nonexistent)
+++ funlike-5.c (revision 154)
@@ -0,0 +1,10 @@
+/* Test function like macro. */
+/* Contributed by Devang Patel */
+
+/* {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)
+
funlike-5.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: comment-2.c
===================================================================
--- comment-2.c (nonexistent)
+++ comment-2.c (revision 154)
@@ -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" } */
comment-2.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: comment.c
===================================================================
--- comment.c (nonexistent)
+++ comment.c (revision 154)
@@ -0,0 +1,5 @@
+/* Test for warning of unterminated comment. */
+
+/* { dg-do preprocess } */
+
+/* { dg-warning "unterminated comment" }
comment.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mi7b.h
===================================================================
--- mi7b.h (nonexistent)
+++ mi7b.h (revision 154)
@@ -0,0 +1,4 @@
+#ifndef GUARD2
+#define GUARD2
+#endif
+:
mi7b.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: cmdlne-C2.c
===================================================================
--- cmdlne-C2.c (nonexistent)
+++ cmdlne-C2.c (revision 154)
@@ -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" } } */
+
cmdlne-C2.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: redef1.c
===================================================================
--- redef1.c (nonexistent)
+++ redef1.c (revision 154)
@@ -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 } */
redef1.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: maccom1.c
===================================================================
--- maccom1.c (nonexistent)
+++ maccom1.c (revision 154)
@@ -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" } } */
maccom1.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: maccom3.c
===================================================================
--- maccom3.c (nonexistent)
+++ maccom3.c (revision 154)
@@ -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" } } */
maccom3.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: hash.c
===================================================================
--- hash.c (nonexistent)
+++ hash.c (revision 154)
@@ -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 } */
hash.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: assert2.c
===================================================================
--- assert2.c (nonexistent)
+++ assert2.c (revision 154)
@@ -0,0 +1,23 @@
+/* Malformed assertion tests. */
+/* { dg-do preprocess } */
+
+#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
assert2.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: cmdlne-dD.c
===================================================================
--- cmdlne-dD.c (nonexistent)
+++ cmdlne-dD.c (revision 154)
@@ -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
cmdlne-dD.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: Wunused.c
===================================================================
--- Wunused.c (nonexistent)
+++ Wunused.c (revision 154)
@@ -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
Wunused.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: quote.c
===================================================================
--- quote.c (nonexistent)
+++ quote.c (revision 154)
@@ -0,0 +1,6 @@
+/* Test that unterminated quotes are OK when only preprocessing. */
+
+/* { dg-do preprocess } */
+
+/* { dg-bogus "unterminated" } */ 'x
+/* { dg-bogus "unterminated" } */ "x
quote.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mi2b.h
===================================================================
--- mi2b.h (nonexistent)
+++ mi2b.h (revision 154)
@@ -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 . */
+
+#define need_x
+#include "mi2c.h"
mi2b.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: Wunused.h
===================================================================
--- Wunused.h (nonexistent)
+++ Wunused.h (revision 154)
@@ -0,0 +1 @@
+#define unused_but_ok
Wunused.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mi6b.h
===================================================================
--- mi6b.h (nonexistent)
+++ mi6b.h (revision 154)
@@ -0,0 +1,5 @@
+#if NOT defined (guard)
+ #ifdef VAR
+ VAR++;
+ #endif
+#endif
mi6b.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mi6d.h
===================================================================
--- mi6d.h (nonexistent)
+++ mi6d.h (revision 154)
@@ -0,0 +1,5 @@
+#if EMPTYL !defined (guard)
+ #ifdef VAR
+ VAR++;
+ #endif
+#endif
mi6d.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mi3.def
===================================================================
--- mi3.def (nonexistent)
+++ mi3.def (revision 154)
@@ -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;
Index: xwin1.c
===================================================================
--- xwin1.c (nonexistent)
+++ xwin1.c (revision 154)
@@ -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" } } */
xwin1.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: recurse-1.c
===================================================================
--- recurse-1.c (nonexistent)
+++ recurse-1.c (revision 154)
@@ -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" } */
recurse-1.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: recurse-3.c
===================================================================
--- recurse-3.c (nonexistent)
+++ recurse-3.c (revision 154)
@@ -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" } */
recurse-3.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: escaped-eof.c
===================================================================
--- escaped-eof.c (nonexistent)
+++ escaped-eof.c (revision 154)
@@ -0,0 +1,6 @@
+/* Test for warning of escaped EOF. */
+
+/* { dg-do preprocess } */
+
+/* { dg-warning "backslash-new" "escaped EOF warning" { target *-*-* } 6 } */
+\
escaped-eof.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: escaped-nl.c
===================================================================
--- escaped-nl.c (nonexistent)
+++ escaped-nl.c (revision 154)
@@ -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
escaped-nl.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: literals-2.c
===================================================================
--- literals-2.c (nonexistent)
+++ literals-2.c (revision 154)
@@ -0,0 +1,8 @@
+/* Test that unterminated quotes in CPP expressions are
+ recognized. */
+
+/* { dg-do preprocess } */
+/* { dg-error "missing terminating" "bad charconst" { target *-*-* } 7 } */
+/* { dg-error "not valid" "bad charconst" { target *-*-* } 7 } */
+#if 'x
+#endif
literals-2.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mi2.c
===================================================================
--- mi2.c (nonexistent)
+++ mi2.c (revision 154)
@@ -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 . */
+/* { dg-do compile } */
+
+#include "mi2a.h"
+#include "mi2b.h"
+
+int main (void)
+{
+ return x;
+}
mi2.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mi4.c
===================================================================
--- mi4.c (nonexistent)
+++ mi4.c (revision 154)
@@ -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"
mi4.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: define.c
===================================================================
--- define.c (nonexistent)
+++ define.c (revision 154)
@@ -0,0 +1,2 @@
+/* { dg-do preprocess } */
+/* { dg-options "-traditional-cpp -DDEFINE1DEFINE -DDEFINE2DEFIN=" } */
define.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mi6.c
===================================================================
--- mi6.c (nonexistent)
+++ mi6.c (revision 154)
@@ -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;
+}
mi6.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: funlike-2.c
===================================================================
--- funlike-2.c (nonexistent)
+++ funlike-2.c (revision 154)
@@ -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
funlike-2.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: funlike-4.c
===================================================================
--- funlike-4.c (nonexistent)
+++ funlike-4.c (revision 154)
@@ -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;
+}
funlike-4.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: macro.c
===================================================================
--- macro.c (nonexistent)
+++ macro.c (revision 154)
@@ -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
macro.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: comment-3.c
===================================================================
--- comment-3.c (nonexistent)
+++ comment-3.c (revision 154)
@@ -0,0 +1,6 @@
+/* Test we don't accept C++ comments. */
+
+/* { dg-do preprocess } */
+
+#if 0
+#endif // /* { dg-warning "extra tokens" } */
comment-3.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mi7a.h
===================================================================
--- mi7a.h (nonexistent)
+++ mi7a.h (revision 154)
@@ -0,0 +1,4 @@
+:
+#ifndef GUARD1
+#define GUARD1
+#endif
mi7a.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: trad.exp
===================================================================
--- trad.exp (nonexistent)
+++ trad.exp (revision 154)
@@ -0,0 +1,43 @@
+# Copyright (C) 1997, 2000, 2007 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
+# .
+
+# 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
Index: redef2.c
===================================================================
--- redef2.c (nonexistent)
+++ redef2.c (revision 154)
@@ -0,0 +1,32 @@
+/* Test for redefining traditional macros with significant differences. */
+
+/* { dg-do preprocess } */
+
+#define foo bar /* { dg-warning "previous def" "foo prev def" } */
+#define foo barr /* { dg-warning "redefined" "foo redefined" } */
+
+#undef foo
+#define foo bar /* { dg-warning "previous def" "foo prev def 2" } */
+#define foo() bar /* { dg-warning "redefined" "foo redefined 2" } */
+
+#undef foo
+#define foo() bar /* { dg-warning "previous def" "foo prev def" } */
+#define foo() barr /* { dg-warning "redefined" "foo redefined" } */
+
+#define quux(thud) a thud b /* { dg-warning "previous def" "quux prev def" } */
+#define quux(thu) a thud b /* { dg-warning "redefined" "quux redefined" } */
+
+#define bar(x, y) x+y /* { dg-warning "previous def" "bar prev def" } */
+#define bar(x, y) x+x /* { dg-warning "redefined" "bar redefined" } */
+
+#define bat(x, y) x+y /* { dg-warning "previous def" "bat prev def" } */
+#define bat(x, y) x+ y /* { dg-warning "redefined" "bat redefined" } */
+
+#define baz(x, y) x+y /* { dg-warning "previous def" "baz prev def" } */
+#define baz(x, y) x +y /* { dg-warning "redefined" "baz redefined" } */
+
+#define f(x, y) "x y" /* { dg-warning "previous def" "f prev def" } */
+#define f(x, y) "x y" /* { dg-warning "redefined" "f redefined" } */
+
+#define g(x, y) 'x' /* { dg-warning "previous def" "g prev def" } */
+#define g(x, y) ' x' /* { dg-warning "redefined" "g redefined" } */
redef2.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: paste.c
===================================================================
--- paste.c (nonexistent)
+++ paste.c (revision 154)
@@ -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 . */
+
+/* { 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); }
paste.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mi1nd.h
===================================================================
--- mi1nd.h (nonexistent)
+++ mi1nd.h (revision 154)
@@ -0,0 +1,8 @@
+/* Redundant include check with #if !defined. */
+
+#if !defined CPP_MIND_H
+#define CPP_MIND_H
+
+int c;
+
+#endif
mi1nd.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: directive.c
===================================================================
--- directive.c (nonexistent)
+++ directive.c (revision 154)
@@ -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
directive.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: strify.c
===================================================================
--- strify.c (nonexistent)
+++ strify.c (revision 154)
@@ -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);
+}
strify.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: maccom2.c
===================================================================
--- maccom2.c (nonexistent)
+++ maccom2.c (revision 154)
@@ -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" } } */
maccom2.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: argcount.c
===================================================================
--- argcount.c (nonexistent)
+++ argcount.c (revision 154)
@@ -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" } */
argcount.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: assert1.c
===================================================================
--- assert1.c (nonexistent)
+++ assert1.c (revision 154)
@@ -0,0 +1,46 @@
+/* Basic tests of the #assert preprocessor extension. */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+#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
assert1.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mi1x.h
===================================================================
--- mi1x.h (nonexistent)
+++ mi1x.h (revision 154)
@@ -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
mi1x.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: maccom4.c
===================================================================
--- maccom4.c (nonexistent)
+++ maccom4.c (revision 154)
@@ -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" } }
+*/
maccom4.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: assert3.c
===================================================================
--- assert3.c (nonexistent)
+++ assert3.c (revision 154)
@@ -0,0 +1,10 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc. */
+
+/* { dg-do preprocess } */
+/* { dg-options "-A abc=def -A abc\(ghi\) \"-Aabc = jkl\" -A abc=mno -A -abc=mno" } */
+
+/* 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
assert3.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: maccom6.c
===================================================================
--- maccom6.c (nonexistent)
+++ maccom6.c (revision 154)
@@ -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" } } */
maccom6.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: builtins.c
===================================================================
--- builtins.c (nonexistent)
+++ builtins.c (revision 154)
@@ -0,0 +1,52 @@
+/* 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;
+}
builtins.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: __STDC__.c
===================================================================
--- __STDC__.c (nonexistent)
+++ __STDC__.c (revision 154)
@@ -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
__STDC__.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: assembler.S
===================================================================
--- assembler.S (nonexistent)
+++ assembler.S (revision 154)
@@ -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 { \} } }
+*/
+
assembler.S
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: num-sign.c
===================================================================
--- num-sign.c (nonexistent)
+++ num-sign.c (revision 154)
@@ -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
num-sign.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mi2a.h
===================================================================
--- mi2a.h (nonexistent)
+++ mi2a.h (revision 154)
@@ -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 . */
+
+#include "mi2c.h"
mi2a.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mi1ndp.h
===================================================================
--- mi1ndp.h (nonexistent)
+++ mi1ndp.h (revision 154)
@@ -0,0 +1,7 @@
+#if !defined ( CPP_MINDP_H)
+#define CPP_MINDP_H
+
+/* Redundant include check with #if !defined and parentheses. */
+int d;
+
+#endif
mi1ndp.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: builtins.h
===================================================================
--- builtins.h (nonexistent)
+++ builtins.h (revision 154)
@@ -0,0 +1 @@
+int level = __INCLUDE_LEVEL__;
builtins.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mi2c.h
===================================================================
--- mi2c.h (nonexistent)
+++ mi2c.h (revision 154)
@@ -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 . */
+#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
mi2c.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: cmdlne-dM.c
===================================================================
--- cmdlne-dM.c (nonexistent)
+++ cmdlne-dM.c (revision 154)
@@ -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
cmdlne-dM.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mi6a.h
===================================================================
--- mi6a.h (nonexistent)
+++ mi6a.h (revision 154)
@@ -0,0 +1,5 @@
+#if NOT_DEFINED
+ #ifdef VAR
+ VAR++;
+ #endif
+#endif
mi6a.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: uchar.c
===================================================================
--- uchar.c (nonexistent)
+++ uchar.c (revision 154)
@@ -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
uchar.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mi6c.h
===================================================================
--- mi6c.h (nonexistent)
+++ mi6c.h (revision 154)
@@ -0,0 +1,5 @@
+#if !DEFINED
+ #ifdef VAR
+ VAR++;
+ #endif
+#endif
mi6c.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mi6e.h
===================================================================
--- mi6e.h (nonexistent)
+++ mi6e.h (revision 154)
@@ -0,0 +1,5 @@
+#if !defined (guard) EMPTYR
+ #ifdef VAR
+ VAR++;
+ #endif
+#endif
mi6e.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: recurse-2.c
===================================================================
--- recurse-2.c (nonexistent)
+++ recurse-2.c (revision 154)
@@ -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" } */
recurse-2.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: literals-1.c
===================================================================
--- literals-1.c (nonexistent)
+++ literals-1.c (revision 154)
@@ -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;
+}
literals-1.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: macroargs.c
===================================================================
--- macroargs.c (nonexistent)
+++ macroargs.c (revision 154)
@@ -0,0 +1,30 @@
+/* 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);
+
+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 ();
+
+ return 0;
+}
macroargs.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: cmdlne-C.c
===================================================================
--- cmdlne-C.c (nonexistent)
+++ cmdlne-C.c (revision 154)
@@ -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
cmdlne-C.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: include.c
===================================================================
--- include.c (nonexistent)
+++ include.c (revision 154)
@@ -0,0 +1,9 @@
+/* Copyright (c) 2002 Free Software Foundation Inc. */
+
+/* Test that macros are not expanded in the <> quotes of #inlcude. */
+
+/* { dg-do preprocess } */
+
+#define __STDC__ 1 /* Stop complaints about non-ISO compilers. */
+#define stdio 1
+#include /* { dg-bogus "o such file or directory" } */
include.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mi1.c
===================================================================
--- mi1.c (nonexistent)
+++ mi1.c (revision 154)
@@ -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-error "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;
+}
mi1.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mi3.c
===================================================================
--- mi3.c (nonexistent)
+++ mi3.c (revision 154)
@@ -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;
+}
mi3.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mi5.c
===================================================================
--- mi5.c (nonexistent)
+++ mi5.c (revision 154)
@@ -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-error "mi1c\.h" "redundant include check with -C" { target *-*-* } 0 } */
+
+#include "mi1c.h"
+#include "mi1c.h"
mi5.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: null-drctv.c
===================================================================
--- null-drctv.c (nonexistent)
+++ null-drctv.c (revision 154)
@@ -0,0 +1,6 @@
+/* Test that the null directive doesn't swallow the following line. */
+
+/* { dg-do preprocess } */
+
+#
+#error OK /* { dg-error "OK" } */
null-drctv.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mi7.c
===================================================================
--- mi7.c (nonexistent)
+++ mi7.c (revision 154)
@@ -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-error "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"
mi7.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: funlike-3.c
===================================================================
--- funlike-3.c (nonexistent)
+++ funlike-3.c (revision 154)
@@ -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" } */
funlike-3.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mi3.h
===================================================================
--- mi3.h (nonexistent)
+++ mi3.h (revision 154)
@@ -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
mi3.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: funlike.c
===================================================================
--- funlike.c (nonexistent)
+++ funlike.c (revision 154)
@@ -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
funlike.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property