diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 91b90d8920e..31acb8c132f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,89 @@ +2000-06-27 Zack Weinberg + + * gcc.dg/cpp: New directory. + * gcc.dg/cpp/cpp.exp: New driver. + * gcc.dg/cpp/20000627-1.c: New test. + * gcc.c-torture/special/special.exp: Remove entry for 921210-1.c. + * gcc.c-torture/special/921210-1.c: Move to gcc.dg/cpp/19921210-1.c + and rewrite as a compilation test. + + * gcc.dg: Move many files into the cpp subdirectory, possibly + renaming or editing them as well. + Old name New name + 990119-1.c cpp/19990119-1.c + 990228-1.c cpp/19990228-1.c + 990407-1.c cpp/19990407-1.c + 990409-1.c cpp/19990409-1.c + 990413-1.c cpp/19990413-1.c + 990703-1.c cpp/19990703-1.c + 20000127-1.c cpp/20000127-1.c + 20000129-1.c cpp/20000129-1.c + 20000207-1.c cpp/20000207-1.c + 20000207-2.c cpp/20000207-2.c + 20000209-1.c cpp/20000209-1.c + 20000209-2.c cpp/20000209-2.c + 20000301-1.c cpp/20000301-1.c + 20000419-1.c cpp/20000419-1.c + 20000510-1.S cpp/20000510-1.S + 20000519-1.c cpp/20000519-1.c + 20000529-1.c cpp/20000529-1.c + 20000625-1.c cpp/20000625-1.c + 20000625-2.c cpp/20000625-2.c + cpp-as1.c cpp/assert1.c + cpp-as2.c cpp/assert2.c + cxx-comments-1.c cpp/cxxcom1.c + cxx-comments-2.c cpp/cxxcom2.c + endif-label.c cpp/endif.c + cpp-hash1.c cpp/hash1.c + cpp-hash2.c cpp/hash2.c + cpp-if1.c cpp/if-1.c + cpp-if2.c cpp/if-2.c + cpp-if3.c cpp/if-3.c + cpp-if4.c cpp/if-4.c + cpp-if5.c cpp/if-5.c + cpp-cond.c cpp/if-cexp.c + cpp-missingop.c cpp/if-mop.c + cpp-missingparen.c cpp/if-mpar.c + cpp-opprec.c cpp/if-oppr.c + cpp-ifparen.c cpp/if-paren.c + cpp-shortcircuit.c cpp/if-sc.c + cpp-shift.c cpp/if-shift.c + cpp-unary.c cpp/if-unary.c + cpp-li1.c cpp/line1.c + cpp-li2.c cpp/line2.c + lineno.c cpp/line3.c + lineno-2.c cpp/line4.c + cpp-mi.c cpp/mi1.c + cpp-mic.h cpp/mi1c.h + cpp-micc.h cpp/mi1cc.h + cpp-mind.h cpp/mi1nd.h + cpp-mindp.h cpp/mi1ndp.h + cpp-mix.h cpp/mi1x.h + cpp-mi2.c cpp/mi2.c + cpp-mi2a.h cpp/mi2a.h + cpp-mi2b.h cpp/mi2b.h + cpp-mi2c.h cpp/mi2c.h + cpp-mi3.c cpp/mi3.c + cpp-mi3.def cpp/mi3.def + poison-1.c cpp/poison.c + pr-impl.c cpp/prag-imp.c + cpp-redef-2.c cpp/redef1.c + cpp-redef.c cpp/redef2.c + strpaste.c cpp/strp1.c + strpaste-2.c cpp/strp2.c + cpp-tradpaste.c cpp/tr-paste.c + cpp-tradstringify.c cpp/tr-str.c + cpp-tradwarn1.c cpp/tr-warn1.c + cpp-tradwarn2.c cpp/tr-warn2.c + trigraphs.c cpp/trigraphs.c + cpp-unc1.c cpp/unc1.c + cpp-unc2.c cpp/unc2.c + cpp-unc3.c cpp/unc3.c + cpp-unc.c cpp/unc4.c + undef.c cpp/undef1.c + undef-2.c cpp/undef2.c + cpp-wi1.c cpp/widestr1.c + 2000-06-27 Mark Mitchell * lib/g++.exp (g++_include_flags): Tweak. diff --git a/gcc/testsuite/gcc.c-torture/special/921210-1.c b/gcc/testsuite/gcc.c-torture/special/921210-1.c deleted file mode 100644 index bbbf39a314b..00000000000 --- a/gcc/testsuite/gcc.c-torture/special/921210-1.c +++ /dev/null @@ -1,4 +0,0 @@ -#define a1(y) (y+1) -#define a2(y) a1(y)+1 -#define f a->f -a2(f) diff --git a/gcc/testsuite/gcc.c-torture/special/special.exp b/gcc/testsuite/gcc.c-torture/special/special.exp index 8415b22f7d5..cc5b812ee38 100644 --- a/gcc/testsuite/gcc.c-torture/special/special.exp +++ b/gcc/testsuite/gcc.c-torture/special/special.exp @@ -50,17 +50,6 @@ if { [istarget rs6000-*-aix*] dg-runtest $srcdir/$subdir/981006-1.c "-Wuninitialized -O2 $extra_flags" "" dg-finish -# 921210-1 -set lines [gcc_target_compile $srcdir/$subdir/921210-1.c "" preprocess ""] -set lines [prune [split [prune_warnings [prune_gcc_output $lines]] "\n"] ""] -set line [lindex $lines [expr [llength $lines]-1]] -regsub -all " " $line "" clean -if [expr [string compare $clean "(a->f+1)+1"]==0] then { - pass "921210-1.c" -} else { - fail "921210-1.c" -} - # 920521-1 c-torture 920521-1.c "-S" diff --git a/gcc/testsuite/gcc.dg/990119-1.c b/gcc/testsuite/gcc.dg/990119-1.c deleted file mode 100644 index c9b75bd7720..00000000000 --- a/gcc/testsuite/gcc.dg/990119-1.c +++ /dev/null @@ -1,17 +0,0 @@ -/* This checks for two things: - - an obscure corner case in the standard rules for __LINE__ - - regression of an associated bug in cpplib where the semicolon got lost */ -/* { dg-do run } */ - -int i = __LINE__\ -; - -extern void abort (void); - -int main (void) /* { dg-bogus "parse error" "semicolon eaten" } */ -{ - if (i != 6) - abort (); - else - return 0; -} diff --git a/gcc/testsuite/gcc.dg/990409-1.c b/gcc/testsuite/gcc.dg/990409-1.c deleted file mode 100644 index c7bfa617212..00000000000 --- a/gcc/testsuite/gcc.dg/990409-1.c +++ /dev/null @@ -1,20 +0,0 @@ -/* Test that __LINE__ works when embedded in a macro. */ -/* { dg-do run } */ - -extern void abort (void); - -#define XLINE __LINE__ - -void -bar(int x, int y) -{ - if (x != y) - abort(); -} - -int -main(void) -{ - bar(XLINE, __LINE__); - return 0; -} diff --git a/gcc/testsuite/gcc.dg/cpp/19921210-1.c b/gcc/testsuite/gcc.dg/cpp/19921210-1.c new file mode 100644 index 00000000000..32d2a816ece --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/19921210-1.c @@ -0,0 +1,13 @@ +/* Test for proper disabling of macros within their own expansions. */ +/* { dg-do compile } */ + +/* The following is a trick to evaluate a complex boolean expression + at compile time, inspired by autoconf 2.13's sizeof-detection. */ + +enum { a = 4, f = 3 }; + +#define a1(y) (y+2) +#define a2(y) a1(y)+1 +#define f a+f + +char array[(a2(f)) == 10 ? 1 : -1]; diff --git a/gcc/testsuite/gcc.dg/cpp/19990119-1.c b/gcc/testsuite/gcc.dg/cpp/19990119-1.c new file mode 100644 index 00000000000..10a7baae3f5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/19990119-1.c @@ -0,0 +1,9 @@ +/* This checks for two things: + - an obscure corner case in the standard rules for __LINE__ + - regression of an associated bug in cpplib where the semicolon got lost */ +/* { dg-do compile } */ + +enum { i = __LINE__\ +}; + +char array[i == 6 ? 1 : -1]; diff --git a/gcc/testsuite/gcc.dg/990228-1.c b/gcc/testsuite/gcc.dg/cpp/19990228-1.c similarity index 100% rename from gcc/testsuite/gcc.dg/990228-1.c rename to gcc/testsuite/gcc.dg/cpp/19990228-1.c diff --git a/gcc/testsuite/gcc.dg/990407-1.c b/gcc/testsuite/gcc.dg/cpp/19990407-1.c similarity index 100% rename from gcc/testsuite/gcc.dg/990407-1.c rename to gcc/testsuite/gcc.dg/cpp/19990407-1.c diff --git a/gcc/testsuite/gcc.dg/cpp/19990409-1.c b/gcc/testsuite/gcc.dg/cpp/19990409-1.c new file mode 100644 index 00000000000..d7f5e28525e --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/19990409-1.c @@ -0,0 +1,6 @@ +/* Test that __LINE__ works when embedded in a macro. */ +/* { dg-do compile } */ + +#define XLINE __LINE__ + +char array[XLINE == __LINE__ ? 1 : -1]; diff --git a/gcc/testsuite/gcc.dg/990413-1.c b/gcc/testsuite/gcc.dg/cpp/19990413-1.c similarity index 100% rename from gcc/testsuite/gcc.dg/990413-1.c rename to gcc/testsuite/gcc.dg/cpp/19990413-1.c diff --git a/gcc/testsuite/gcc.dg/990703-1.c b/gcc/testsuite/gcc.dg/cpp/19990703-1.c similarity index 100% rename from gcc/testsuite/gcc.dg/990703-1.c rename to gcc/testsuite/gcc.dg/cpp/19990703-1.c diff --git a/gcc/testsuite/gcc.dg/20000127-1.c b/gcc/testsuite/gcc.dg/cpp/20000127-1.c similarity index 100% rename from gcc/testsuite/gcc.dg/20000127-1.c rename to gcc/testsuite/gcc.dg/cpp/20000127-1.c diff --git a/gcc/testsuite/gcc.dg/20000129-1.c b/gcc/testsuite/gcc.dg/cpp/20000129-1.c similarity index 100% rename from gcc/testsuite/gcc.dg/20000129-1.c rename to gcc/testsuite/gcc.dg/cpp/20000129-1.c diff --git a/gcc/testsuite/gcc.dg/20000207-1.c b/gcc/testsuite/gcc.dg/cpp/20000207-1.c similarity index 100% rename from gcc/testsuite/gcc.dg/20000207-1.c rename to gcc/testsuite/gcc.dg/cpp/20000207-1.c diff --git a/gcc/testsuite/gcc.dg/20000207-2.c b/gcc/testsuite/gcc.dg/cpp/20000207-2.c similarity index 100% rename from gcc/testsuite/gcc.dg/20000207-2.c rename to gcc/testsuite/gcc.dg/cpp/20000207-2.c diff --git a/gcc/testsuite/gcc.dg/20000209-1.c b/gcc/testsuite/gcc.dg/cpp/20000209-1.c similarity index 100% rename from gcc/testsuite/gcc.dg/20000209-1.c rename to gcc/testsuite/gcc.dg/cpp/20000209-1.c diff --git a/gcc/testsuite/gcc.dg/20000209-2.c b/gcc/testsuite/gcc.dg/cpp/20000209-2.c similarity index 100% rename from gcc/testsuite/gcc.dg/20000209-2.c rename to gcc/testsuite/gcc.dg/cpp/20000209-2.c diff --git a/gcc/testsuite/gcc.dg/20000301-1.c b/gcc/testsuite/gcc.dg/cpp/20000301-1.c similarity index 100% rename from gcc/testsuite/gcc.dg/20000301-1.c rename to gcc/testsuite/gcc.dg/cpp/20000301-1.c diff --git a/gcc/testsuite/gcc.dg/20000419-1.c b/gcc/testsuite/gcc.dg/cpp/20000419-1.c similarity index 100% rename from gcc/testsuite/gcc.dg/20000419-1.c rename to gcc/testsuite/gcc.dg/cpp/20000419-1.c diff --git a/gcc/testsuite/gcc.dg/20000510-1.S b/gcc/testsuite/gcc.dg/cpp/20000510-1.S similarity index 100% rename from gcc/testsuite/gcc.dg/20000510-1.S rename to gcc/testsuite/gcc.dg/cpp/20000510-1.S diff --git a/gcc/testsuite/gcc.dg/20000519-1.c b/gcc/testsuite/gcc.dg/cpp/20000519-1.c similarity index 100% rename from gcc/testsuite/gcc.dg/20000519-1.c rename to gcc/testsuite/gcc.dg/cpp/20000519-1.c diff --git a/gcc/testsuite/gcc.dg/20000529-1.c b/gcc/testsuite/gcc.dg/cpp/20000529-1.c similarity index 100% rename from gcc/testsuite/gcc.dg/20000529-1.c rename to gcc/testsuite/gcc.dg/cpp/20000529-1.c diff --git a/gcc/testsuite/gcc.dg/20000625-1.c b/gcc/testsuite/gcc.dg/cpp/20000625-1.c similarity index 83% rename from gcc/testsuite/gcc.dg/20000625-1.c rename to gcc/testsuite/gcc.dg/cpp/20000625-1.c index 717ffb05e28..9193e39bc2b 100644 --- a/gcc/testsuite/gcc.dg/20000625-1.c +++ b/gcc/testsuite/gcc.dg/cpp/20000625-1.c @@ -1,9 +1,7 @@ /* Regression test for paste corner cases. Distilled from syscall stub logic in glibc. */ -/* { dg-do run } */ - -#include +/* { dg-do compile } */ #define ENTRY(name) name##: #define socket bind diff --git a/gcc/testsuite/gcc.dg/20000625-2.c b/gcc/testsuite/gcc.dg/cpp/20000625-2.c similarity index 100% rename from gcc/testsuite/gcc.dg/20000625-2.c rename to gcc/testsuite/gcc.dg/cpp/20000625-2.c diff --git a/gcc/testsuite/gcc.dg/cpp/20000627-1.c b/gcc/testsuite/gcc.dg/cpp/20000627-1.c new file mode 100644 index 00000000000..dc017324426 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/20000627-1.c @@ -0,0 +1,10 @@ +/* Test for spurious warnings with backslashes in perverse locations. + Bug exposed by Plumhall. */ +/* { dg-do compile } */ + +extern int bar; + +#def\ +ine foo bar + +int main(void) { return foo; } diff --git a/gcc/testsuite/gcc.dg/cpp-as1.c b/gcc/testsuite/gcc.dg/cpp/assert1.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-as1.c rename to gcc/testsuite/gcc.dg/cpp/assert1.c diff --git a/gcc/testsuite/gcc.dg/cpp-as2.c b/gcc/testsuite/gcc.dg/cpp/assert2.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-as2.c rename to gcc/testsuite/gcc.dg/cpp/assert2.c diff --git a/gcc/testsuite/gcc.dg/cpp/cpp.exp b/gcc/testsuite/gcc.dg/cpp/cpp.exp new file mode 100644 index 00000000000..4d50b443ea3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/cpp.exp @@ -0,0 +1,70 @@ +# Copyright (C) 1997, 2000 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 2 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 this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gcc@prep.ai.mit.edu + +# GCC testsuite that uses the `dg.exp' driver. + +# Load support procs. +load_lib gcc-dg.exp + +# Utility for scanning compiler result, invoked via dg-final. +# Call pass if pattern is present, otherwise fail. +proc scan-assembler { testcase pattern } { + global subdir + + set fd [open [file rootname $testcase].s r] + set text [read $fd] + close $fd + + if [regexp -- $pattern $text] { + pass "$subdir/$testcase scan-assembler" + } else { + fail "$subdir/$testcase scan-assembler" + } +} + +# Call pass if pattern is not present, otherwise fail. +proc scan-assembler-not { testcase pattern } { + global subdir + + set fd [open [file rootname $testcase].s r] + set text [read $fd] + close $fd + + if ![regexp -- $pattern $text] { + pass "$subdir/$testcase scan-assembler-not" + } else { + fail "$subdir/$testcase scan-assembler-not" + } +} + +# If a testcase doesn't have special options, use these. +global DEFAULT_CFLAGS +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS " -ansi -pedantic-errors" +} + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \ + "" $DEFAULT_CFLAGS + +# All done. +dg-finish diff --git a/gcc/testsuite/gcc.dg/cxx-comments-1.c b/gcc/testsuite/gcc.dg/cpp/cxxcom1.c similarity index 100% rename from gcc/testsuite/gcc.dg/cxx-comments-1.c rename to gcc/testsuite/gcc.dg/cpp/cxxcom1.c diff --git a/gcc/testsuite/gcc.dg/cxx-comments-2.c b/gcc/testsuite/gcc.dg/cpp/cxxcom2.c similarity index 100% rename from gcc/testsuite/gcc.dg/cxx-comments-2.c rename to gcc/testsuite/gcc.dg/cpp/cxxcom2.c diff --git a/gcc/testsuite/gcc.dg/endif-label.c b/gcc/testsuite/gcc.dg/cpp/endif.c similarity index 100% rename from gcc/testsuite/gcc.dg/endif-label.c rename to gcc/testsuite/gcc.dg/cpp/endif.c diff --git a/gcc/testsuite/gcc.dg/cpp-hash1.c b/gcc/testsuite/gcc.dg/cpp/hash1.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-hash1.c rename to gcc/testsuite/gcc.dg/cpp/hash1.c diff --git a/gcc/testsuite/gcc.dg/cpp-hash2.c b/gcc/testsuite/gcc.dg/cpp/hash2.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-hash2.c rename to gcc/testsuite/gcc.dg/cpp/hash2.c diff --git a/gcc/testsuite/gcc.dg/cpp-if1.c b/gcc/testsuite/gcc.dg/cpp/if-1.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-if1.c rename to gcc/testsuite/gcc.dg/cpp/if-1.c diff --git a/gcc/testsuite/gcc.dg/cpp-if2.c b/gcc/testsuite/gcc.dg/cpp/if-2.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-if2.c rename to gcc/testsuite/gcc.dg/cpp/if-2.c diff --git a/gcc/testsuite/gcc.dg/cpp-if3.c b/gcc/testsuite/gcc.dg/cpp/if-3.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-if3.c rename to gcc/testsuite/gcc.dg/cpp/if-3.c diff --git a/gcc/testsuite/gcc.dg/cpp-if4.c b/gcc/testsuite/gcc.dg/cpp/if-4.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-if4.c rename to gcc/testsuite/gcc.dg/cpp/if-4.c diff --git a/gcc/testsuite/gcc.dg/cpp-if5.c b/gcc/testsuite/gcc.dg/cpp/if-5.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-if5.c rename to gcc/testsuite/gcc.dg/cpp/if-5.c diff --git a/gcc/testsuite/gcc.dg/cpp-cond.c b/gcc/testsuite/gcc.dg/cpp/if-cexp.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-cond.c rename to gcc/testsuite/gcc.dg/cpp/if-cexp.c diff --git a/gcc/testsuite/gcc.dg/cpp-missingop.c b/gcc/testsuite/gcc.dg/cpp/if-mop.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-missingop.c rename to gcc/testsuite/gcc.dg/cpp/if-mop.c diff --git a/gcc/testsuite/gcc.dg/cpp-missingparen.c b/gcc/testsuite/gcc.dg/cpp/if-mpar.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-missingparen.c rename to gcc/testsuite/gcc.dg/cpp/if-mpar.c diff --git a/gcc/testsuite/gcc.dg/cpp-opprec.c b/gcc/testsuite/gcc.dg/cpp/if-oppr.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-opprec.c rename to gcc/testsuite/gcc.dg/cpp/if-oppr.c diff --git a/gcc/testsuite/gcc.dg/cpp-ifparen.c b/gcc/testsuite/gcc.dg/cpp/if-paren.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-ifparen.c rename to gcc/testsuite/gcc.dg/cpp/if-paren.c diff --git a/gcc/testsuite/gcc.dg/cpp-shortcircuit.c b/gcc/testsuite/gcc.dg/cpp/if-sc.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-shortcircuit.c rename to gcc/testsuite/gcc.dg/cpp/if-sc.c diff --git a/gcc/testsuite/gcc.dg/cpp-shift.c b/gcc/testsuite/gcc.dg/cpp/if-shift.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-shift.c rename to gcc/testsuite/gcc.dg/cpp/if-shift.c diff --git a/gcc/testsuite/gcc.dg/cpp-unary.c b/gcc/testsuite/gcc.dg/cpp/if-unary.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-unary.c rename to gcc/testsuite/gcc.dg/cpp/if-unary.c diff --git a/gcc/testsuite/gcc.dg/cpp-li1.c b/gcc/testsuite/gcc.dg/cpp/line1.c similarity index 61% rename from gcc/testsuite/gcc.dg/cpp-li1.c rename to gcc/testsuite/gcc.dg/cpp/line1.c index 7bc6561870a..376df9cae10 100644 --- a/gcc/testsuite/gcc.dg/cpp-li1.c +++ b/gcc/testsuite/gcc.dg/cpp/line1.c @@ -10,9 +10,9 @@ wibble /* - { dg-final { if \{ [grep cpp-li1.i baz] != "" \} \{ } } - { dg-final { pass "cpp-li1.i: #line directive optimization" } } + { dg-final { if \{ [grep line1.i baz] != "" \} \{ } } + { dg-final { pass "line1.i: #line directive optimization" } } { dg-final { \} else \{ } } - { dg-final { fail "cpp-li1.i: #line directive optimization" } } + { dg-final { fail "line1.i: #line directive optimization" } } { dg-final { \} } } */ diff --git a/gcc/testsuite/gcc.dg/cpp-li2.c b/gcc/testsuite/gcc.dg/cpp/line2.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-li2.c rename to gcc/testsuite/gcc.dg/cpp/line2.c diff --git a/gcc/testsuite/gcc.dg/lineno.c b/gcc/testsuite/gcc.dg/cpp/line3.c similarity index 100% rename from gcc/testsuite/gcc.dg/lineno.c rename to gcc/testsuite/gcc.dg/cpp/line3.c diff --git a/gcc/testsuite/gcc.dg/cpp/line4.c b/gcc/testsuite/gcc.dg/cpp/line4.c new file mode 100644 index 00000000000..84dbf9623a2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/line4.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ + +/* Test #line with and without macros for the line number. */ + +extern void abort (void); + +#define L 90 + +#line 44 +enum { i = __LINE__ }; + +#line L +enum { j = __LINE__ }; + +#line 16 /* N.B. the _next_ line is line 16. */ + +char array1[i == 44 ? 1 : -1]; +char array2[j == 90 ? 1 : -1]; +char array3[__LINE__ == 19 ? 1 : -1]; diff --git a/gcc/testsuite/gcc.dg/cpp-mi.c b/gcc/testsuite/gcc.dg/cpp/mi1.c similarity index 58% rename from gcc/testsuite/gcc.dg/cpp-mi.c rename to gcc/testsuite/gcc.dg/cpp/mi1.c index 0584a62cbfb..0e15c477e29 100644 --- a/gcc/testsuite/gcc.dg/cpp-mi.c +++ b/gcc/testsuite/gcc.dg/cpp/mi1.c @@ -1,7 +1,7 @@ /* Test "ignore redundant include" facility. We must test with C and C++ comments 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 + -H is used because cpp mi1ght confuse the issue by optimizing out #line markers. This test only passes if each of the headers is read exactly once. @@ -12,23 +12,23 @@ /* { dg-do compile } { dg-options "-H" } - { dg-error "mic\.h\n\[^\n\]*micc\.h\n\[^\n\]*mind\.h\n\[^\n\]*mindp\.h\n\[^\n\]*mix\.h" "redundant include check" { target *-*-* } 0 } */ + { dg-error "mi1c\.h\n\[^\n\]*mi1cc\.h\n\[^\n\]*mi1nd\.h\n\[^\n\]*mi1ndp\.h\n\[^\n\]*mi1x\.h" "redundant include check" { target *-*-* } 0 } */ -#include "cpp-mic.h" -#include "cpp-mic.h" +#include "mi1c.h" +#include "mi1c.h" -#include "cpp-micc.h" -#include "cpp-micc.h" +#include "mi1cc.h" +#include "mi1cc.h" -#include "cpp-mind.h" -#include "cpp-mind.h" +#include "mi1nd.h" +#include "mi1nd.h" -#include "cpp-mindp.h" -#include "cpp-mindp.h" +#include "mi1ndp.h" +#include "mi1ndp.h" -#define CPP_MIX_H -#include "cpp-mix.h" -#include "cpp-mix.h" +#define MIX_H +#include "mi1x.h" +#include "mi1x.h" int main (void) diff --git a/gcc/testsuite/gcc.dg/cpp-mic.h b/gcc/testsuite/gcc.dg/cpp/mi1c.h similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-mic.h rename to gcc/testsuite/gcc.dg/cpp/mi1c.h diff --git a/gcc/testsuite/gcc.dg/cpp-micc.h b/gcc/testsuite/gcc.dg/cpp/mi1cc.h similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-micc.h rename to gcc/testsuite/gcc.dg/cpp/mi1cc.h diff --git a/gcc/testsuite/gcc.dg/cpp-mind.h b/gcc/testsuite/gcc.dg/cpp/mi1nd.h similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-mind.h rename to gcc/testsuite/gcc.dg/cpp/mi1nd.h diff --git a/gcc/testsuite/gcc.dg/cpp-mindp.h b/gcc/testsuite/gcc.dg/cpp/mi1ndp.h similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-mindp.h rename to gcc/testsuite/gcc.dg/cpp/mi1ndp.h diff --git a/gcc/testsuite/gcc.dg/cpp-mix.h b/gcc/testsuite/gcc.dg/cpp/mi1x.h similarity index 79% rename from gcc/testsuite/gcc.dg/cpp-mix.h rename to gcc/testsuite/gcc.dg/cpp/mi1x.h index ce0e76435d7..a317cf852bf 100644 --- a/gcc/testsuite/gcc.dg/cpp-mix.h +++ b/gcc/testsuite/gcc.dg/cpp/mi1x.h @@ -1,8 +1,8 @@ /* This header is never to have its contents visible, but it should still receive the optimization. */ -#ifndef CPP_MIX_H -#define CPP_MIX_H +#ifndef MIX_H +#define MIX_H #define main wibble diff --git a/gcc/testsuite/gcc.dg/cpp-mi2.c b/gcc/testsuite/gcc.dg/cpp/mi2.c similarity index 84% rename from gcc/testsuite/gcc.dg/cpp-mi2.c rename to gcc/testsuite/gcc.dg/cpp/mi2.c index d5c814c61cc..916d5a949d0 100644 --- a/gcc/testsuite/gcc.dg/cpp-mi2.c +++ b/gcc/testsuite/gcc.dg/cpp/mi2.c @@ -3,8 +3,8 @@ Problem noted by Tom Tromey . */ /* { dg-do compile } */ -#include "cpp-mi2a.h" -#include "cpp-mi2b.h" +#include "mi2a.h" +#include "mi2b.h" int main (void) { diff --git a/gcc/testsuite/gcc.dg/cpp-mi2a.h b/gcc/testsuite/gcc.dg/cpp/mi2a.h similarity index 89% rename from gcc/testsuite/gcc.dg/cpp-mi2a.h rename to gcc/testsuite/gcc.dg/cpp/mi2a.h index c86838cf2e0..e3f53b6cb2e 100644 --- a/gcc/testsuite/gcc.dg/cpp-mi2a.h +++ b/gcc/testsuite/gcc.dg/cpp/mi2a.h @@ -2,4 +2,4 @@ Problem distilled from glibc 2.0.7's time.h, sys/time.h, timebits.h. Problem noted by Tom Tromey . */ -#include "cpp-mi2c.h" +#include "mi2c.h" diff --git a/gcc/testsuite/gcc.dg/cpp-mi2b.h b/gcc/testsuite/gcc.dg/cpp/mi2b.h similarity index 90% rename from gcc/testsuite/gcc.dg/cpp-mi2b.h rename to gcc/testsuite/gcc.dg/cpp/mi2b.h index 8d1970c5eab..1d9a8b9b1c5 100644 --- a/gcc/testsuite/gcc.dg/cpp-mi2b.h +++ b/gcc/testsuite/gcc.dg/cpp/mi2b.h @@ -3,4 +3,4 @@ Problem noted by Tom Tromey . */ #define need_x -#include "cpp-mi2c.h" +#include "mi2c.h" diff --git a/gcc/testsuite/gcc.dg/cpp-mi2c.h b/gcc/testsuite/gcc.dg/cpp/mi2c.h similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-mi2c.h rename to gcc/testsuite/gcc.dg/cpp/mi2c.h diff --git a/gcc/testsuite/gcc.dg/cpp-mi3.c b/gcc/testsuite/gcc.dg/cpp/mi3.c similarity index 84% rename from gcc/testsuite/gcc.dg/cpp-mi3.c rename to gcc/testsuite/gcc.dg/cpp/mi3.c index 6055684b83f..533b509f1e7 100644 --- a/gcc/testsuite/gcc.dg/cpp-mi3.c +++ b/gcc/testsuite/gcc.dg/cpp/mi3.c @@ -3,11 +3,11 @@ /* { dg-do compile } */ #define X a -#include "cpp-mi3.def" +#include "mi3.def" #undef X #define X b -#include "cpp-mi3.def" +#include "mi3.def" #undef X int diff --git a/gcc/testsuite/gcc.dg/cpp-mi3.def b/gcc/testsuite/gcc.dg/cpp/mi3.def similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-mi3.def rename to gcc/testsuite/gcc.dg/cpp/mi3.def diff --git a/gcc/testsuite/gcc.dg/poison-1.c b/gcc/testsuite/gcc.dg/cpp/poison.c similarity index 100% rename from gcc/testsuite/gcc.dg/poison-1.c rename to gcc/testsuite/gcc.dg/cpp/poison.c diff --git a/gcc/testsuite/gcc.dg/pr-impl.c b/gcc/testsuite/gcc.dg/cpp/prag-imp.c similarity index 100% rename from gcc/testsuite/gcc.dg/pr-impl.c rename to gcc/testsuite/gcc.dg/cpp/prag-imp.c diff --git a/gcc/testsuite/gcc.dg/cpp-redef.c b/gcc/testsuite/gcc.dg/cpp/redef1.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-redef.c rename to gcc/testsuite/gcc.dg/cpp/redef1.c diff --git a/gcc/testsuite/gcc.dg/cpp-redef-2.c b/gcc/testsuite/gcc.dg/cpp/redef2.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-redef-2.c rename to gcc/testsuite/gcc.dg/cpp/redef2.c diff --git a/gcc/testsuite/gcc.dg/strpaste.c b/gcc/testsuite/gcc.dg/cpp/strp1.c similarity index 100% rename from gcc/testsuite/gcc.dg/strpaste.c rename to gcc/testsuite/gcc.dg/cpp/strp1.c diff --git a/gcc/testsuite/gcc.dg/strpaste-2.c b/gcc/testsuite/gcc.dg/cpp/strp2.c similarity index 100% rename from gcc/testsuite/gcc.dg/strpaste-2.c rename to gcc/testsuite/gcc.dg/cpp/strp2.c diff --git a/gcc/testsuite/gcc.dg/cpp-tradpaste.c b/gcc/testsuite/gcc.dg/cpp/tr-paste.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-tradpaste.c rename to gcc/testsuite/gcc.dg/cpp/tr-paste.c diff --git a/gcc/testsuite/gcc.dg/cpp-tradstringify.c b/gcc/testsuite/gcc.dg/cpp/tr-str.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-tradstringify.c rename to gcc/testsuite/gcc.dg/cpp/tr-str.c diff --git a/gcc/testsuite/gcc.dg/cpp-tradwarn1.c b/gcc/testsuite/gcc.dg/cpp/tr-warn1.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-tradwarn1.c rename to gcc/testsuite/gcc.dg/cpp/tr-warn1.c diff --git a/gcc/testsuite/gcc.dg/cpp-tradwarn2.c b/gcc/testsuite/gcc.dg/cpp/tr-warn2.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-tradwarn2.c rename to gcc/testsuite/gcc.dg/cpp/tr-warn2.c diff --git a/gcc/testsuite/gcc.dg/trigraphs.c b/gcc/testsuite/gcc.dg/cpp/trigraphs.c similarity index 100% rename from gcc/testsuite/gcc.dg/trigraphs.c rename to gcc/testsuite/gcc.dg/cpp/trigraphs.c diff --git a/gcc/testsuite/gcc.dg/cpp-unc1.c b/gcc/testsuite/gcc.dg/cpp/unc1.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-unc1.c rename to gcc/testsuite/gcc.dg/cpp/unc1.c diff --git a/gcc/testsuite/gcc.dg/cpp-unc2.c b/gcc/testsuite/gcc.dg/cpp/unc2.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-unc2.c rename to gcc/testsuite/gcc.dg/cpp/unc2.c diff --git a/gcc/testsuite/gcc.dg/cpp-unc3.c b/gcc/testsuite/gcc.dg/cpp/unc3.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-unc3.c rename to gcc/testsuite/gcc.dg/cpp/unc3.c diff --git a/gcc/testsuite/gcc.dg/cpp-unc.c b/gcc/testsuite/gcc.dg/cpp/unc4.c similarity index 90% rename from gcc/testsuite/gcc.dg/cpp-unc.c rename to gcc/testsuite/gcc.dg/cpp/unc4.c index ba5c22184b5..c4862815c7d 100644 --- a/gcc/testsuite/gcc.dg/cpp-unc.c +++ b/gcc/testsuite/gcc.dg/cpp/unc4.c @@ -23,7 +23,7 @@ ignored /* We shouldn't see unbalanced conditionals inside #if'ed out #includes. */ #if 0 -#include "cpp-unc1.c" +#include "unc1.c" #endif /* The ifdef below should not get an error just because there's a bad if @@ -32,9 +32,9 @@ ignored message. */ #define FOO #ifdef FOO /* { dg-bogus "unterminated" "nested unterm" } */ -#include "cpp-unc1.c" /* { dg-error "" } */ +#include "unc1.c" /* { dg-error "" } */ #endif /* dg.exp doesn't read the included files for tags, so we have to do them explicitly here. */ -/* { dg-error "#if" "unc1.h: unterminated #if" { target *-*-* } 3 } */ +/* { dg-error "#if" "unc1.c: unterminated #if" { target *-*-* } 3 } */ diff --git a/gcc/testsuite/gcc.dg/undef.c b/gcc/testsuite/gcc.dg/cpp/undef1.c similarity index 100% rename from gcc/testsuite/gcc.dg/undef.c rename to gcc/testsuite/gcc.dg/cpp/undef1.c diff --git a/gcc/testsuite/gcc.dg/undef-2.c b/gcc/testsuite/gcc.dg/cpp/undef2.c similarity index 100% rename from gcc/testsuite/gcc.dg/undef-2.c rename to gcc/testsuite/gcc.dg/cpp/undef2.c diff --git a/gcc/testsuite/gcc.dg/cpp-wi1.c b/gcc/testsuite/gcc.dg/cpp/widestr1.c similarity index 100% rename from gcc/testsuite/gcc.dg/cpp-wi1.c rename to gcc/testsuite/gcc.dg/cpp/widestr1.c diff --git a/gcc/testsuite/gcc.dg/lineno-2.c b/gcc/testsuite/gcc.dg/lineno-2.c deleted file mode 100644 index 77b940f0c13..00000000000 --- a/gcc/testsuite/gcc.dg/lineno-2.c +++ /dev/null @@ -1,26 +0,0 @@ -/* { dg-do run } */ - -/* Test #line with and without macros for the line number. */ - -extern void abort (void); - -#define L 90 - -#line 44 -int i = __LINE__; - -#line L -int j = __LINE__; - -#line 14 /* N.B. the _next_ line is line 14. */ - -int main(void) -{ - if (i != 44) - abort (); - if (j != 90) - abort (); - if (__LINE__ != 21) - abort (); - return 0; -}