aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2003-06-02 19:21:15 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2003-06-02 19:21:15 +0000
commit5a9f05f2ea3283d0be7884d04df6ba2088a0ec7d (patch)
treeb9ac7ba20a1901ce01adc13a973b730607c0a573
parent245115a4b4946f9ab14e2c012f83d1a82c651607 (diff)
downloadgcc-5a9f05f2ea3283d0be7884d04df6ba2088a0ec7d.zip
gcc-5a9f05f2ea3283d0be7884d04df6ba2088a0ec7d.tar.gz
gcc-5a9f05f2ea3283d0be7884d04df6ba2088a0ec7d.tar.bz2
scanasm.exp (dg-scan): New function, factored out of ...
* lib/scanasm.exp (dg-scan): New function, factored out of ... (scan-assembler): ... here. Use dg-scan. (scan-assembler-not): Likewise. (scan-file): New function. (scan-file-not): Likewise. * gcc.dg/cpp/19990228-1.c: Use scan-file and/or scan-file-not. * gcc.dg/cpp/_Pragma4.c: Likewise. * gcc.dg/cpp/_Pragma5.c: Likewise. * gcc.dg/cpp/avoidpaste1.c: Likewise. * gcc.dg/cpp/avoidpaste2.c: Likewise. * gcc.dg/cpp/cmdlne-C2.c: Likewise. * gcc.dg/cpp/cmdlne-P.c: Likewise. * gcc.dg/cpp/cmdlne-dD-M.c: Likewise. * gcc.dg/cpp/cmdlne-dD-dM.c: Likewise. * gcc.dg/cpp/cmdlne-dI-M.c: Likewise. * gcc.dg/cpp/cmdlne-dM-M.c: Likewise. * gcc.dg/cpp/cmdlne-dM-dD.c: Likewise. * gcc.dg/cpp/cmdlne-dN-M.c: Likewise. * gcc.dg/cpp/cxxcom1.c: Likewise. * gcc.dg/cpp/line1.c: Likewise. * gcc.dg/cpp/maccom1.c: Likewise. * gcc.dg/cpp/maccom2.c: Likewise. * gcc.dg/cpp/maccom3.c: Likewise. * gcc.dg/cpp/maccom4.c: Likewise. * gcc.dg/cpp/maccom5.c: Likewise. * gcc.dg/cpp/maccom6.c: Likewise. * gcc.dg/cpp/multiline.c: Likewise. * gcc.dg/cpp/spacing1.c: Likewise. * gcc.dg/cpp/spacing2.c: Likewise. * gcc.dg/cpp/trad/cmdlne-C2.c: Likewise. * gcc.dg/cpp/trad/maccom1.c: Likewise. * gcc.dg/cpp/trad/maccom2.c: Likewise. * gcc.dg/cpp/trad/maccom3.c: Likewise. * gcc.dg/cpp/trad/maccom4.c: Likewise. * gcc.dg/cpp/trad/maccom6.c: Likewise. * gcc.dg/cpp/cxxcom2.c: Likewise. * gcc.dg/cpp/cxxcom2.h: New file. From-SVN: r67347
-rw-r--r--gcc/testsuite/ChangeLog38
-rw-r--r--gcc/testsuite/gcc.dg/cpp/19990228-1.c10
-rw-r--r--gcc/testsuite/gcc.dg/cpp/_Pragma4.c6
-rw-r--r--gcc/testsuite/gcc.dg/cpp/_Pragma5.c6
-rw-r--r--gcc/testsuite/gcc.dg/cpp/avoidpaste1.c11
-rw-r--r--gcc/testsuite/gcc.dg/cpp/avoidpaste2.c11
-rw-r--r--gcc/testsuite/gcc.dg/cpp/cmdlne-C2.c8
-rw-r--r--gcc/testsuite/gcc.dg/cpp/cmdlne-P.c6
-rw-r--r--gcc/testsuite/gcc.dg/cpp/cmdlne-dD-M.c10
-rw-r--r--gcc/testsuite/gcc.dg/cpp/cmdlne-dD-dM.c8
-rw-r--r--gcc/testsuite/gcc.dg/cpp/cmdlne-dI-M.c10
-rw-r--r--gcc/testsuite/gcc.dg/cpp/cmdlne-dM-M.c10
-rw-r--r--gcc/testsuite/gcc.dg/cpp/cmdlne-dM-dD.c8
-rw-r--r--gcc/testsuite/gcc.dg/cpp/cmdlne-dN-M.c10
-rw-r--r--gcc/testsuite/gcc.dg/cpp/cxxcom1.c11
-rw-r--r--gcc/testsuite/gcc.dg/cpp/cxxcom2.c19
-rw-r--r--gcc/testsuite/gcc.dg/cpp/cxxcom2.h4
-rw-r--r--gcc/testsuite/gcc.dg/cpp/line1.c10
-rw-r--r--gcc/testsuite/gcc.dg/cpp/maccom1.c7
-rw-r--r--gcc/testsuite/gcc.dg/cpp/maccom2.c6
-rw-r--r--gcc/testsuite/gcc.dg/cpp/maccom3.c6
-rw-r--r--gcc/testsuite/gcc.dg/cpp/maccom4.c4
-rw-r--r--gcc/testsuite/gcc.dg/cpp/maccom5.c7
-rw-r--r--gcc/testsuite/gcc.dg/cpp/maccom6.c6
-rw-r--r--gcc/testsuite/gcc.dg/cpp/multiline.c5
-rw-r--r--gcc/testsuite/gcc.dg/cpp/spacing1.c17
-rw-r--r--gcc/testsuite/gcc.dg/cpp/spacing2.c9
-rw-r--r--gcc/testsuite/gcc.dg/cpp/trad/cmdlne-C2.c8
-rw-r--r--gcc/testsuite/gcc.dg/cpp/trad/maccom1.c6
-rw-r--r--gcc/testsuite/gcc.dg/cpp/trad/maccom2.c6
-rw-r--r--gcc/testsuite/gcc.dg/cpp/trad/maccom3.c6
-rw-r--r--gcc/testsuite/gcc.dg/cpp/trad/maccom4.c4
-rw-r--r--gcc/testsuite/gcc.dg/cpp/trad/maccom6.c6
-rw-r--r--gcc/testsuite/lib/scanasm.exp108
34 files changed, 162 insertions, 245 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a56f2d5..be88c11 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,43 @@
2003-06-02 Mark Mitchell <mark@codesourcery.com>
+ * lib/scanasm.exp (dg-scan): New function, factored out of ...
+ (scan-assembler): ... here. Use dg-scan.
+ (scan-assembler-not): Likewise.
+ (scan-file): New function.
+ (scan-file-not): Likewise.
+ * gcc.dg/cpp/19990228-1.c: Use scan-file and/or scan-file-not.
+ * gcc.dg/cpp/_Pragma4.c: Likewise.
+ * gcc.dg/cpp/_Pragma5.c: Likewise.
+ * gcc.dg/cpp/avoidpaste1.c: Likewise.
+ * gcc.dg/cpp/avoidpaste2.c: Likewise.
+ * gcc.dg/cpp/cmdlne-C2.c: Likewise.
+ * gcc.dg/cpp/cmdlne-P.c: Likewise.
+ * gcc.dg/cpp/cmdlne-dD-M.c: Likewise.
+ * gcc.dg/cpp/cmdlne-dD-dM.c: Likewise.
+ * gcc.dg/cpp/cmdlne-dI-M.c: Likewise.
+ * gcc.dg/cpp/cmdlne-dM-M.c: Likewise.
+ * gcc.dg/cpp/cmdlne-dM-dD.c: Likewise.
+ * gcc.dg/cpp/cmdlne-dN-M.c: Likewise.
+ * gcc.dg/cpp/cxxcom1.c: Likewise.
+ * gcc.dg/cpp/line1.c: Likewise.
+ * gcc.dg/cpp/maccom1.c: Likewise.
+ * gcc.dg/cpp/maccom2.c: Likewise.
+ * gcc.dg/cpp/maccom3.c: Likewise.
+ * gcc.dg/cpp/maccom4.c: Likewise.
+ * gcc.dg/cpp/maccom5.c: Likewise.
+ * gcc.dg/cpp/maccom6.c: Likewise.
+ * gcc.dg/cpp/multiline.c: Likewise.
+ * gcc.dg/cpp/spacing1.c: Likewise.
+ * gcc.dg/cpp/spacing2.c: Likewise.
+ * gcc.dg/cpp/trad/cmdlne-C2.c: Likewise.
+ * gcc.dg/cpp/trad/maccom1.c: Likewise.
+ * gcc.dg/cpp/trad/maccom2.c: Likewise.
+ * gcc.dg/cpp/trad/maccom3.c: Likewise.
+ * gcc.dg/cpp/trad/maccom4.c: Likewise.
+ * gcc.dg/cpp/trad/maccom6.c: Likewise.
+ * gcc.dg/cpp/cxxcom2.c: Likewise.
+ * gcc.dg/cpp/cxxcom2.h: New file.
+
* gcc.dg/cpp/truefalse.cpp: Move it to ...
* g++.dg/cpp/truefalse.C: Here.
* gcc.dg/cpp/cpp.exp: Remove scanning of ".cpp" files.
diff --git a/gcc/testsuite/gcc.dg/cpp/19990228-1.c b/gcc/testsuite/gcc.dg/cpp/19990228-1.c
index 4b846ea..acae116 100644
--- a/gcc/testsuite/gcc.dg/cpp/19990228-1.c
+++ b/gcc/testsuite/gcc.dg/cpp/19990228-1.c
@@ -18,12 +18,4 @@ foo ("\
",
NULL);
-/*
- { dg-final { if ![file exists 990228-1.i] { return } } }
- { dg-final { set tmp [grep 990228-1.i ".#"] } }
- { dg-final { if { [string length $tmp] == 0 } \{ } }
- { dg-final { pass "990228-1.c: linemarkers in middle of line" } }
- { dg-final { \} else \{ } }
- { dg-final { fail "990228-1.c: linemarkers in middle of line" } }
- { dg-final { \} } }
- */
+/* { dg-final { scan-file-not 19990228-1.i "\[^\\n\]#" } } */
diff --git a/gcc/testsuite/gcc.dg/cpp/_Pragma4.c b/gcc/testsuite/gcc.dg/cpp/_Pragma4.c
index 5c86b02..f6f43d6 100644
--- a/gcc/testsuite/gcc.dg/cpp/_Pragma4.c
+++ b/gcc/testsuite/gcc.dg/cpp/_Pragma4.c
@@ -5,8 +5,4 @@
#define b foo _Pragma ("bar") baz
a b c
-/*
- { dg-final { if ![file exists _Pragma4.i] { return } } }
- { dg-final { if { [grep _Pragma4.i "#pragma bar"] != "" } { return } } }
- { dg-final { fail "_Pragma4.c: #pragma appearing on its own line" } }
-*/
+/* { dg-final { scan-file "_Pragma4.i" "(^|\\n)#pragma bar($|\\n)" } } */
diff --git a/gcc/testsuite/gcc.dg/cpp/_Pragma5.c b/gcc/testsuite/gcc.dg/cpp/_Pragma5.c
index ace5041..141d56b 100644
--- a/gcc/testsuite/gcc.dg/cpp/_Pragma5.c
+++ b/gcc/testsuite/gcc.dg/cpp/_Pragma5.c
@@ -7,8 +7,4 @@
#define GAMMA(C) _Pragma("moose") ALPHA(C) BETA(C)
GAMMA(baz);
-/*
- { dg-final { if ![file exists _Pragma5.i] { return } } }
- { dg-final { if { [grep _Pragma5.i "alpha_baz beta_baz;"] != "" } { return } } }
- { dg-final { fail "_Pragma5.c: _Pragma in macro" } }
-*/
+/* { dg-final { scan-file "_Pragma5.i" "alpha_baz beta_baz;" } } */
diff --git a/gcc/testsuite/gcc.dg/cpp/avoidpaste1.c b/gcc/testsuite/gcc.dg/cpp/avoidpaste1.c
index f2905c3..d304a74 100644
--- a/gcc/testsuite/gcc.dg/cpp/avoidpaste1.c
+++ b/gcc/testsuite/gcc.dg/cpp/avoidpaste1.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc. */
+/* Copyright (C) 2001, 2003 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
@@ -24,10 +24,5 @@ in future, this test needs to change. */
:: :g: :f(): :f(^): tricky
:f(:): .. .__INCLUDE_LEVEL__ __INCLUDE_LEVEL__. /* Check builtins, too. */
-/*
- { dg-final { if ![file exists avoidpaste1.i] { return } } }
- { dg-final { if { [grep avoidpaste1.i ":: : : : : :\\^: 1.0e- 1"] != "" } \{ } }
- { dg-final { if { [grep avoidpaste1.i ": : : \\\.\\\. \\\. 0 0 \\\."] != "" } \{ } }
- { dg-final { return \} \} } }
- { dg-final { fail "avoidpaste1.c: paste avoidance" } }
-*/
+/* { dg-final { scan-file avoidpaste1.i ":: : : : : :\\^: 1.0e- 1" } }
+ { dg-final { scan-file avoidpaste1.i ": : : \\\.\\\. \\\. 0 0 \\\." } } */
diff --git a/gcc/testsuite/gcc.dg/cpp/avoidpaste2.c b/gcc/testsuite/gcc.dg/cpp/avoidpaste2.c
index 5094e3d..42b549c 100644
--- a/gcc/testsuite/gcc.dg/cpp/avoidpaste2.c
+++ b/gcc/testsuite/gcc.dg/cpp/avoidpaste2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc. */
+/* Copyright (C) 2001, 2003 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
@@ -26,10 +26,5 @@ We used to get a space at the start of the line. */
f(:,)
g(2, 2)
-/*
- { dg-final { if ![file exists avoidpaste2.i] { return } } }
- { dg-final { if { [grep avoidpaste2.i "^: : : - > - >"] != "" } \{ } }
- { dg-final { if { [grep avoidpaste2.i "^:2: :22 22:"] != "" } \{ } }
- { dg-final { return \} \} } }
- { dg-final { fail "avoidpaste2.c: paste avoidance" } }
-*/
+/* { dg-final { scan-file avoidpaste2.i "(^|\\n): : : - > - >" } }
+ { dg-final { scan-file avoidpaste2.i "(^|\\n):2: :22 22:" } } */
diff --git a/gcc/testsuite/gcc.dg/cpp/cmdlne-C2.c b/gcc/testsuite/gcc.dg/cpp/cmdlne-C2.c
index 13f5a09..be04670 100644
--- a/gcc/testsuite/gcc.dg/cpp/cmdlne-C2.c
+++ b/gcc/testsuite/gcc.dg/cpp/cmdlne-C2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. */
+/* Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
/* { dg-options "-C" } */
@@ -13,9 +13,5 @@
ZERO:
-/*
- { dg-final { if ![file exists cmdlne-C2.i] { return } } }
- { dg-final { if { [grep cmdlne-C2.i "c+omment:"] == "" } { return } } }
- { dg-final { fail "cmdlne-C2.i: C++ comments in macros with -C" } }
-*/
+/* { dg-final { scan-file-not cmdlne-C2.i "c+omment:" } } */
diff --git a/gcc/testsuite/gcc.dg/cpp/cmdlne-P.c b/gcc/testsuite/gcc.dg/cpp/cmdlne-P.c
index 117c0ef..faadf9f 100644
--- a/gcc/testsuite/gcc.dg/cpp/cmdlne-P.c
+++ b/gcc/testsuite/gcc.dg/cpp/cmdlne-P.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc. */
+/* Copyright (C) 2000, 2003 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
/* { dg-options "-P" } */
@@ -8,6 +8,4 @@
int x = 1;
-/* { dg-final { if ![file exists cmdlne-P.i] { return } } }
- { dg-final { if { [grep cmdlne-P.i "^int x = 1;$"] != "" } { return } } }
- { dg-final { fail "cmdlne-P.c: stair-stepping with -P" } } */
+/* { dg-final { scan-file cmdlne-P.i "(^|\n)int x = 1;($|\n)" } } */
diff --git a/gcc/testsuite/gcc.dg/cpp/cmdlne-dD-M.c b/gcc/testsuite/gcc.dg/cpp/cmdlne-dD-M.c
index 1a0adc0..1bc7916 100644
--- a/gcc/testsuite/gcc.dg/cpp/cmdlne-dD-M.c
+++ b/gcc/testsuite/gcc.dg/cpp/cmdlne-dD-M.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc. */
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
/* { dg-options "-dD -M" } */
@@ -10,8 +10,6 @@
#define funlike(like) fun like
int variable;
-/* { dg-final { if ![file exists cmdlne-dD-M.i] { return } } }
- { dg-final { if { [grep cmdlne-dD-M.i "^#define foo bar$"] != "" } { fail "cmdlne-dD-M.c: #define line printed" } } }
- { dg-final { if { [grep cmdlne-dD-M.i "variable"] != "" } { fail "cmdlne-dD-M.c: non-#define line printed" } } }
- { dg-final { if { [grep cmdlne-dD-M.i "^cmdlne-dD-M.*:.*cmdlne-dD-M.c"] == "" } { xfail "cmdlne-dD-M.c: dependency rule not printed" } } }
- { dg-final { return } } */
+/* { dg-final { scan-file-not cmdlne-dD-M.i "(^|\\n)#define foo bar($|\\n)" } }
+ { dg-final { scan-file-not cmdlne-dD-M.i "variable" } }
+ { dg-final { scan-file-not cmdlne-dD-M.i "(^|\n)cmdlne-dD-M.*:.*cmdlne-dD-M.c" { xfail *-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/cpp/cmdlne-dD-dM.c b/gcc/testsuite/gcc.dg/cpp/cmdlne-dD-dM.c
index 8a3fb34..9e3c732 100644
--- a/gcc/testsuite/gcc.dg/cpp/cmdlne-dD-dM.c
+++ b/gcc/testsuite/gcc.dg/cpp/cmdlne-dD-dM.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc. */
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
/* { dg-options "-dD -dM" } */
@@ -10,7 +10,5 @@
#define funlike(like) fun like
int variable;
-/* { dg-final { if ![file exists cmdlne-dD-dM.i] { return } } }
- { dg-final { if { [grep cmdlne-dD-dM.i "^#define foo bar$"] == "" } { fail "cmdlne-dD-dM.c: #define line not printed" } } }
- { dg-final { if { [grep cmdlne-dD-dM.i "variable"] != "" } { fail "cmdlne-dD-dM.c: non-#define line printed" } } }
- { dg-final { return } } */
+/* { dg-final { scan-file cmdlne-dD-dM.i "(^|\\n)#define foo bar($|\\n)" } }
+ { dg-final { scan-file-not cmdlne-dD-dM.i "variable" } } */
diff --git a/gcc/testsuite/gcc.dg/cpp/cmdlne-dI-M.c b/gcc/testsuite/gcc.dg/cpp/cmdlne-dI-M.c
index afa54f7..c003d5a 100644
--- a/gcc/testsuite/gcc.dg/cpp/cmdlne-dI-M.c
+++ b/gcc/testsuite/gcc.dg/cpp/cmdlne-dI-M.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc. */
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
/* { dg-options "-dI -M" } */
@@ -11,8 +11,6 @@
#define funlike(like) fun like
int variable;
-/* { dg-final { if ![file exists cmdlne-dI-M.i] { return } } }
- { dg-final { if { [grep cmdlne-dI-M.i "^#define foo bar$"] != "" } { fail "cmdlne-dI-M.c: #define line printed" } } }
- { dg-final { if { [grep cmdlne-dI-M.i "variable"] != "" } { fail "cmdlne-dI-M.c: non-#define line printed" } } }
- { dg-final { if { [grep cmdlne-dI-M.i "^cmdlne-dI-M.*:.*cmdlne-dI-M.c"] == "" } { xfail "cmdlne-dI-M.c: dependency rule not printed" } } }
- { dg-final { return } } */
+/* { dg-final { scan-file-not cmdlne-dI-M.i "(^|\\n)#define foo bar($|\\n)" } }
+ { dg-final { scan-file-not cmdlne-dI-M.i "variable" } }
+ { dg-final { scan-file cmdlne-dI-M.i "(^|\\n)cmdlne-dI-M.*:\[^\\n\]*cmdlne-dI-M.c" { xfail *-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/cpp/cmdlne-dM-M.c b/gcc/testsuite/gcc.dg/cpp/cmdlne-dM-M.c
index 9d5a7df..fb21f40 100644
--- a/gcc/testsuite/gcc.dg/cpp/cmdlne-dM-M.c
+++ b/gcc/testsuite/gcc.dg/cpp/cmdlne-dM-M.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc. */
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
/* { dg-options "-dM -M" } */
@@ -10,8 +10,6 @@
#define funlike(like) fun like
int variable;
-/* { dg-final { if ![file exists cmdlne-dM-M.i] { return } } }
- { dg-final { if { [grep cmdlne-dM-M.i "^#define foo bar$"] == "" } { fail "cmdlne-dM-M.c: #define line not printed" } } }
- { dg-final { if { [grep cmdlne-dM-M.i "variable"] != "" } { fail "cmdlne-dM-M.c: non-#define line printed" } } }
- { dg-final { if { [grep cmdlne-dM-M.i "^cmdlne-dM-M.*:.*cmdlne-dM-M.c"] == "" } { xfail "cmdlne-dM-M.c: dependency rule not printed" } } }
- { dg-final { return } } */
+/* { dg-final { scan-file cmdlne-dM-M.i "(^|\\n)#define foo bar($|\\n)" } }
+ { dg-final { scan-file-not cmdlne-dM-M.i "variable" } }
+ { dg-final { scan-file cmdlne-dM-M.i "(^|\\n)cmdlne-dM-M\[^\\n\]*:\[^\\n\]*cmdlne-dM-M.c" { xfail *-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/cpp/cmdlne-dM-dD.c b/gcc/testsuite/gcc.dg/cpp/cmdlne-dM-dD.c
index 0d3bb9c..66ec7dd 100644
--- a/gcc/testsuite/gcc.dg/cpp/cmdlne-dM-dD.c
+++ b/gcc/testsuite/gcc.dg/cpp/cmdlne-dM-dD.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc. */
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
/* { dg-options "-dM -dD" } */
@@ -10,7 +10,5 @@
#define funlike(like) fun like
int variable;
-/* { dg-final { if ![file exists cmdlne-dM-dD.i] { return } } }
- { dg-final { if { [grep cmdlne-dM-dD.i "^#define foo bar$"] == "" } { fail "cmdlne-dM-dD.c: #define line not printed" } } }
- { dg-final { if { [grep cmdlne-dM-dD.i "variable"] == "" } { fail "cmdlne-dM-dD.c: non-#define line not printed" } } }
- { dg-final { return } } */
+/* { dg-final { scan-file cmdlne-dM-dD.i "(^|\\n)#define foo bar($|\\n)" } }
+ { dg-final { scan-file cmdlne-dM-dD.i "variable" } } */
diff --git a/gcc/testsuite/gcc.dg/cpp/cmdlne-dN-M.c b/gcc/testsuite/gcc.dg/cpp/cmdlne-dN-M.c
index c4549fc..7d8c16b 100644
--- a/gcc/testsuite/gcc.dg/cpp/cmdlne-dN-M.c
+++ b/gcc/testsuite/gcc.dg/cpp/cmdlne-dN-M.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc. */
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
/* { dg-options "-dN -M" } */
@@ -10,8 +10,6 @@
#define funlike(like) fun like
int variable;
-/* { dg-final { if ![file exists cmdlne-dN-M.i] { return } } }
- { dg-final { if { [grep cmdlne-dN-M.i "^#define foo"] != "" } { fail "cmdlne-dN-M.c: #define line printed" } } }
- { dg-final { if { [grep cmdlne-dN-M.i "variable"] != "" } { fail "cmdlne-dN-M.c: non-#define line printed" } } }
- { dg-final { if { [grep cmdlne-dN-M.i "^cmdlne-dN-M.*:.*cmdlne-dN-M.c"] == "" } { xfail "cmdlne-dN-M.c: dependency rule not printed" } } }
- { dg-final { return } } */
+/* { dg-final { scan-file-not cmdlne-dN-M.i "(^|\\n)#define foo" } }
+ { dg-final { scan-file-not cmdlne-dN-M.i "variable" } }
+ { dg-final { scan-file cmdlne-dN-M.i "(^|\\n)cmdlne-dM-M\[^\\n\]*:\[^\\n\]*cmdlne-dM-M.c" { xfail *-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/cpp/cxxcom1.c b/gcc/testsuite/gcc.dg/cpp/cxxcom1.c
index c7c51d6..8e254ff 100644
--- a/gcc/testsuite/gcc.dg/cpp/cxxcom1.c
+++ b/gcc/testsuite/gcc.dg/cpp/cxxcom1.c
@@ -7,14 +7,5 @@
/* ...but we don't bitch about it more than once. */
// C++ comment is not in C89 { dg-bogus "style comment" "bad warning" }
-/*
- { dg-final { if ![file exists cxx-comments-1.i] { return } } }
- { dg-final { set tmp [grep cxx-comments-1.i "is not in C89" line] } }
- { dg-final { # send_user "$tmp\n" } }
- { dg-final { if [regexp "is not in C89" $tmp] \{ } }
- { dg-final { fail "cxx-comments-1: comment strip check" } }
- { dg-final { \} else \{ } }
- { dg-final { pass "cxx-comments-1: comment strip check" } }
- { dg-final { \} } }
-*/
+/* { dg-final { scan-file-not cxxcom1.i "is not in C89" } } */
diff --git a/gcc/testsuite/gcc.dg/cpp/cxxcom2.c b/gcc/testsuite/gcc.dg/cpp/cxxcom2.c
index f0fb2d0..0dbb8f2 100644
--- a/gcc/testsuite/gcc.dg/cpp/cxxcom2.c
+++ b/gcc/testsuite/gcc.dg/cpp/cxxcom2.c
@@ -1,20 +1,7 @@
/* { dg-do preprocess } */
-/* { dg-options "-pedantic -std=c89" } */
+/* { dg-options "-pedantic -std=c89 -Wall" } */
-/* This is an extension and therefore gets a warning. */
-#line 5 "cxx-comments-2.c" 3 /* { dg-warning "extra tokens" "#line extension" } */
+#include "cxxcom2.h"
-/* A system header may contain C++ comments irrespective of mode. */
-// C++ comment is not in C89 { dg-bogus "style comment" "bad warning" }
-
-/*
- { dg-final { if ![file exists cxx-comments-2.i] { return } } }
- { dg-final { set tmp [grep cxx-comments-2.i "is not in C89" line] } }
- { dg-final { # send_user "$tmp\n" } }
- { dg-final { if [regexp "is not in C89" $tmp] \{ } }
- { dg-final { fail "cxx-comments-2: comment strip check" } }
- { dg-final { \} else \{ } }
- { dg-final { pass "cxx-comments-2: comment strip check" } }
- { dg-final { \} } }
-*/
+/* { dg-final { scan-file-not cxxcom2.i "is not in C89" } } */
diff --git a/gcc/testsuite/gcc.dg/cpp/cxxcom2.h b/gcc/testsuite/gcc.dg/cpp/cxxcom2.h
new file mode 100644
index 0000000..546b8fd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/cxxcom2.h
@@ -0,0 +1,4 @@
+/* A system header may contain C++ comments irrespective of mode. */
+#pragma GCC system_header
+// C++ comment is not in C89 { dg-bogus "style comment" "bad warning" }
+
diff --git a/gcc/testsuite/gcc.dg/cpp/line1.c b/gcc/testsuite/gcc.dg/cpp/line1.c
index 376df9c..b13c122 100644
--- a/gcc/testsuite/gcc.dg/cpp/line1.c
+++ b/gcc/testsuite/gcc.dg/cpp/line1.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation.
+/* Copyright (C) 2000, 2003 Free Software Foundation.
by Alexandre Oliva <oliva@lsd.ic.unicamp.br> */
@@ -9,10 +9,4 @@
#line 10 "baz"
wibble
-/*
- { dg-final { if \{ [grep line1.i baz] != "" \} \{ } }
- { dg-final { pass "line1.i: #line directive optimization" } }
- { dg-final { \} else \{ } }
- { dg-final { fail "line1.i: #line directive optimization" } }
- { dg-final { \} } }
-*/
+/* { dg-final { scan-file line1.i baz } } */
diff --git a/gcc/testsuite/gcc.dg/cpp/maccom1.c b/gcc/testsuite/gcc.dg/cpp/maccom1.c
index 7660dff..2e01911 100644
--- a/gcc/testsuite/gcc.dg/cpp/maccom1.c
+++ b/gcc/testsuite/gcc.dg/cpp/maccom1.c
@@ -10,8 +10,5 @@
def
-/*
- { dg-final { if ![file exists maccom1.i] { return } } }
- { dg-final { if { [grep maccom1.i "^passed"] != "" } { return } } }
- { dg-final { fail "maccom1.c: comment between # and directive name with -CC" } }
-*/
+/* { dg-final { scan-file maccom1.i "(^|\\n)passed" } } */
+
diff --git a/gcc/testsuite/gcc.dg/cpp/maccom2.c b/gcc/testsuite/gcc.dg/cpp/maccom2.c
index dcaf37a..a448082 100644
--- a/gcc/testsuite/gcc.dg/cpp/maccom2.c
+++ b/gcc/testsuite/gcc.dg/cpp/maccom2.c
@@ -11,8 +11,4 @@
def
-/*
- { dg-final { if ![file exists maccom2.i] { return } } }
- { dg-final { if { [grep maccom2.i "^passed"] != "" } { return } } }
- { dg-final { fail "maccom2.c: comment between #define and identifier with -CC" } }
-*/
+/* { dg-final { scan-file maccom2.i "(^|\n)passed" } } */
diff --git a/gcc/testsuite/gcc.dg/cpp/maccom3.c b/gcc/testsuite/gcc.dg/cpp/maccom3.c
index 1984535..580c52c 100644
--- a/gcc/testsuite/gcc.dg/cpp/maccom3.c
+++ b/gcc/testsuite/gcc.dg/cpp/maccom3.c
@@ -10,8 +10,4 @@
def(x,y)
-/*
- { dg-final { if ![file exists maccom3.i] { return } } }
- { dg-final { if { [grep maccom3.i "^passed"] != "" } { return } } }
- { dg-final { fail "maccom3.c: comment in macro parameter list with -CC" } }
-*/
+/* { dg-final { scan-file maccom3.i "(^|\n)passed" } } */
diff --git a/gcc/testsuite/gcc.dg/cpp/maccom4.c b/gcc/testsuite/gcc.dg/cpp/maccom4.c
index b8a136f..54806c15 100644
--- a/gcc/testsuite/gcc.dg/cpp/maccom4.c
+++ b/gcc/testsuite/gcc.dg/cpp/maccom4.c
@@ -13,7 +13,5 @@ def
/*
/* The + in the regexp prevents it from matching itself. */
- { dg-final { if ![file exists maccom4.i] { return } } }
- { dg-final { if { [grep maccom4.i "p+assed"] != "" } { return } } }
- { dg-final { fail "maccom4.c: comment in macro expansion with -CC" } }
+ { dg-final { scan-file maccom4.i "p+assed" } }
*/
diff --git a/gcc/testsuite/gcc.dg/cpp/maccom5.c b/gcc/testsuite/gcc.dg/cpp/maccom5.c
index f92f8bf..b01a045 100644
--- a/gcc/testsuite/gcc.dg/cpp/maccom5.c
+++ b/gcc/testsuite/gcc.dg/cpp/maccom5.c
@@ -13,9 +13,6 @@ def:
/*
/* The + in the regexp prevents it from matching itself. */
- { dg-final { if ![file exists maccom5.i] { return } } }
- { dg-final { if \{ [grep maccom5.i "p+assed"] != "" \} \{ } }
- { dg-final { if \{ [grep maccom5.i "p+assed:"] == "" \} \{ } }
- { dg-final { return \} \} } }
- { dg-final { fail "maccom5.c: C++ comment in macro expansion with -CC" } }
+ { dg-final { scan-file maccom5.i "p+assed" } }
+ { dg-final { scan-file-not maccom5.i "p+assed:" } }
*/
diff --git a/gcc/testsuite/gcc.dg/cpp/maccom6.c b/gcc/testsuite/gcc.dg/cpp/maccom6.c
index 0b86c05..09ca87d 100644
--- a/gcc/testsuite/gcc.dg/cpp/maccom6.c
+++ b/gcc/testsuite/gcc.dg/cpp/maccom6.c
@@ -17,8 +17,4 @@ failed
passed
#endif
-/*
- { dg-final { if ![file exists maccom6.i] { return } } }
- { dg-final { if { [grep maccom6.i "^passed"] != "" } { return } } }
- { dg-final { fail "maccom6.c: comments in macro expressions with -CC" } }
-*/
+/* { dg-final { scan-file maccom6.i "(^|\n)passed" } } */
diff --git a/gcc/testsuite/gcc.dg/cpp/multiline.c b/gcc/testsuite/gcc.dg/cpp/multiline.c
index 103f9f6..a71ebc6 100644
--- a/gcc/testsuite/gcc.dg/cpp/multiline.c
+++ b/gcc/testsuite/gcc.dg/cpp/multiline.c
@@ -18,9 +18,6 @@ L"line 1
line 4"
/* Nowhere in the output of this file should there be a blank line.
We check for that in the .i file.
- { dg-final { if ![file exists multiline.i] { return } } }
- { dg-final { if \{ [grep multiline.i "^$"] == "" \} \{ } }
- { dg-final { return \} } }
- { dg-final { fail "multiline.c: multi-line tokens" } } */
+ { dg-final { scan-file-not multiline.i "(^|\\n)\\n" } } */
/* { dg-bogus "missing term" "multiline strings" { target *-*-* } 11 } */
/* { dg-bogus "warning" "warning in place of error" { target *-*-* } 15 } */
diff --git a/gcc/testsuite/gcc.dg/cpp/spacing1.c b/gcc/testsuite/gcc.dg/cpp/spacing1.c
index ad1af4e..2724960 100644
--- a/gcc/testsuite/gcc.dg/cpp/spacing1.c
+++ b/gcc/testsuite/gcc.dg/cpp/spacing1.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. */
+/* Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
@@ -43,13 +43,8 @@ f (g) str
) f
(bam) baz
-/*
- { dg-final { if ![file exists spacing1.i] { return } } }
- { dg-final { if \{ [grep spacing1.i " 44 ;"] != "" \} \{ } }
- { dg-final { if \{ [grep spacing1.i "B Q B Q A Q A:"] != "" \} \{ } }
- { dg-final { if \{ [grep spacing1.i "f.*bar"] == "" \} \{ } }
- { dg-final { if \{ [grep spacing1.i "^bar"] != "" \} \{ } }
- { dg-final { if \{ [grep spacing1.i "g \"1 2\" bam baz"] != "" \} \{ } }
- { dg-final { return \} \} \} \} \} } }
- { dg-final { fail "spacing1.c: spacing and new-line preservation" } }
-*/
+/* { dg-final { scan-file spacing1.i " 44 ;" } }
+ { dg-final { scan-file spacing1.i "B Q B Q A Q A:" } }
+ { dg-final { scan-file-not spacing1.i "f\[^\n\]*bar" } }
+ { dg-final { scan-file spacing1.i "(^|\n)bar" } }
+ { dg-final { scan-file spacing1.i "g \"1 2\" bam baz" } } */
diff --git a/gcc/testsuite/gcc.dg/cpp/spacing2.c b/gcc/testsuite/gcc.dg/cpp/spacing2.c
index 760872a..6cfa5a3 100644
--- a/gcc/testsuite/gcc.dg/cpp/spacing2.c
+++ b/gcc/testsuite/gcc.dg/cpp/spacing2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc. */
+/* Copyright (C) 2001, 2003 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
@@ -13,9 +13,4 @@
a = EMPTY
foo.. /* No leading space on output. */
-/*
- { dg-final { if ![file exists spacing2.i] { return } } }
- { dg-final { if \{ [grep spacing2.i "^bar\.\."] != "" \} \{ } }
- { dg-final { return \} } }
- { dg-final { fail "spacing2.c: spacing issues" } }
-*/
+/* { dg-final { scan-file spacing2.i "(^|\n)bar\.\." } } */
diff --git a/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-C2.c b/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-C2.c
index 6836e9e..96bd371 100644
--- a/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-C2.c
+++ b/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-C2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc. */
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
/* { dg-options "-C -traditional-cpp" } */
@@ -7,9 +7,5 @@
Neil Booth, 24 Jun 2002. */
-/*
- { dg-final { if ![file exists cmdlne-C2.i] { return } } }
- { dg-final { if { [grep cmdlne-C2.i "dg-final"] != "" } { return } } }
- { dg-final { fail "cmdlne-C2.i: C comments output with -C" } }
-*/
+/* { dg-final { scan-file cmdlne-C2.i "dg-final" } } */
diff --git a/gcc/testsuite/gcc.dg/cpp/trad/maccom1.c b/gcc/testsuite/gcc.dg/cpp/trad/maccom1.c
index da9c4a1..28602a5 100644
--- a/gcc/testsuite/gcc.dg/cpp/trad/maccom1.c
+++ b/gcc/testsuite/gcc.dg/cpp/trad/maccom1.c
@@ -10,8 +10,4 @@
def
-/*
- { dg-final { if ![file exists maccom1.i] { return } } }
- { dg-final { if { [grep maccom1.i "^passed"] != "" } { return } } }
- { dg-final { fail "maccom1.c: comment between # and directive name with -CC" } }
-*/
+/* { dg-final { scan-file maccom1.i "(^|\n)passed" } } */
diff --git a/gcc/testsuite/gcc.dg/cpp/trad/maccom2.c b/gcc/testsuite/gcc.dg/cpp/trad/maccom2.c
index 331c9fc..068c357 100644
--- a/gcc/testsuite/gcc.dg/cpp/trad/maccom2.c
+++ b/gcc/testsuite/gcc.dg/cpp/trad/maccom2.c
@@ -11,8 +11,4 @@
def
-/*
- { dg-final { if ![file exists maccom2.i] { return } } }
- { dg-final { if { [grep maccom2.i "^passed"] != "" } { return } } }
- { dg-final { fail "maccom2.c: comment between #define and identifier with -CC" } }
-*/
+/* { dg-final { scan-file maccom2.i "(^|\n)passed" } } */
diff --git a/gcc/testsuite/gcc.dg/cpp/trad/maccom3.c b/gcc/testsuite/gcc.dg/cpp/trad/maccom3.c
index b3dd3ac..a6eb3f8 100644
--- a/gcc/testsuite/gcc.dg/cpp/trad/maccom3.c
+++ b/gcc/testsuite/gcc.dg/cpp/trad/maccom3.c
@@ -10,8 +10,4 @@
def(x,y)
-/*
- { dg-final { if ![file exists maccom3.i] { return } } }
- { dg-final { if { [grep maccom3.i "^passed"] != "" } { return } } }
- { dg-final { fail "maccom3.c: comment in macro parameter list with -CC" } }
-*/
+/* { dg-final { scan-file maccom3.i "(^|\n)passed" } } */
diff --git a/gcc/testsuite/gcc.dg/cpp/trad/maccom4.c b/gcc/testsuite/gcc.dg/cpp/trad/maccom4.c
index e962d28..eac52da 100644
--- a/gcc/testsuite/gcc.dg/cpp/trad/maccom4.c
+++ b/gcc/testsuite/gcc.dg/cpp/trad/maccom4.c
@@ -13,7 +13,5 @@ def
/*
/* The + in the regexp prevents it from matching itself. */
- { dg-final { if ![file exists maccom4.i] { return } } }
- { dg-final { if { [grep maccom4.i "p+assed"] != "" } { return } } }
- { dg-final { fail "maccom4.c: comment in macro expansion with -CC" } }
+ { dg-final { scan-file maccom4.i "p+assed" } }
*/
diff --git a/gcc/testsuite/gcc.dg/cpp/trad/maccom6.c b/gcc/testsuite/gcc.dg/cpp/trad/maccom6.c
index 13f0fc5..baf5e98 100644
--- a/gcc/testsuite/gcc.dg/cpp/trad/maccom6.c
+++ b/gcc/testsuite/gcc.dg/cpp/trad/maccom6.c
@@ -17,8 +17,4 @@ failed
passed
#endif
-/*
- { dg-final { if ![file exists maccom6.i] { return } } }
- { dg-final { if { [grep maccom6.i "^passed"] != "" } { return } } }
- { dg-final { fail "maccom6.c: comments in macro expressions with -CC" } }
-*/
+/* { dg-final { scan-file maccom6.i "(^|\n)passed" } } */
diff --git a/gcc/testsuite/lib/scanasm.exp b/gcc/testsuite/lib/scanasm.exp
index 133516d..cf414fb 100644
--- a/gcc/testsuite/lib/scanasm.exp
+++ b/gcc/testsuite/lib/scanasm.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2000, 2002 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2002, 2003 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
@@ -18,18 +18,25 @@
# g++-dg.exp.
# Utility for scanning compiler result, invoked via dg-final.
-# Call pass if pattern is present, otherwise fail.
-proc scan-assembler { args } {
- if { [llength $args] < 1 } {
- error "scan-assembler: too few arguments"
+
+# Scan the OUTPUT_FILE for a pattern. If it is present and POSITIVE
+# is non-zero, or it is not present and POSITIVE is zero, the test
+# passes. The ORIG_ARGS is the list of arguments provided by dg-final
+# to scan-assembler. The first element in ORIG_ARGS is the regular
+# expression to look for in the file. The second element, if present,
+# is a DejaGNU target selector.
+
+proc dg-scan { name positive testcase output_file orig_args } {
+ if { [llength $orig_args] < 1 } {
+ error "$name: too few arguments"
return
}
- if { [llength $args] > 2 } {
- error "scan-assembler: too many arguments"
+ if { [llength $orig_args] > 2 } {
+ error "$name: too many arguments"
return
}
- if { [llength $args] >= 2 } {
- switch [dg-process-target [lindex $args 1]] {
+ if { [llength $orig_args] >= 2 } {
+ switch [dg-process-target [lindex $orig_args 1]] {
"S" { }
"N" { return }
"F" { setup_xfail "*-*-*" }
@@ -37,25 +44,53 @@ proc scan-assembler { args } {
}
}
- # This assumes that we are two frames down from dg-test, and that
- # it still stores the filename of the testcase in a local variable "name".
- # A cleaner solution would require a new dejagnu release.
- upvar 2 name testcase
-
- # This must match the rule in gcc-dg.exp.
- set output_file "[file rootname [file tail $testcase]].s"
-
set fd [open $output_file r]
set text [read $fd]
close $fd
- if [regexp -- [lindex $args 0] $text] {
- pass "$testcase scan-assembler [lindex $args 0]"
+ set match [regexp -- [lindex $orig_args 0] $text]
+ if { $match == $positive } {
+ pass "$testcase $name [lindex $orig_args 0]"
} else {
- fail "$testcase scan-assembler [lindex $args 0]"
+ fail "$testcase $name [lindex $orig_args 0]"
}
}
+# Look for a pattern in the .s file produced by the compiler. See
+# dg-scan for details.
+
+proc scan-assembler { args } {
+ upvar 2 name testcase
+ set output_file "[file rootname [file tail $testcase]].s"
+
+ dg-scan "scan-assembler" 1 $testcase $output_file $args
+}
+
+# Check that a pattern is not present in the .s file produced by the
+# compiler. See dg-scan for details.
+
+proc scan-assembler-not { args } {
+ upvar 2 name testcase
+ set output_file "[file rootname [file tail $testcase]].s"
+
+ dg-scan "scan-assembler-not" 0 $testcase $output_file $args
+}
+
+# Look for a pattern in OUTPUT_FILE. See dg-scan for details.
+
+proc scan-file { output_file args } {
+ upvar 2 name testcase
+ dg-scan "scan-file" 1 $testcase $output_file $args
+}
+
+# Check that a pattern is not present in the OUTPUT_FILE. See dg-scan
+# for details.
+
+proc scan-file-not { output_file args } {
+ upvar 2 name testcase
+ dg-scan "scan-file-not" 0 $testcase $output_file $args
+}
+
# Call pass if pattern is present given number of times, otherwise fail.
proc scan-assembler-times { args } {
if { [llength $args] < 2 } {
@@ -94,39 +129,6 @@ proc scan-assembler-times { args } {
}
}
-# Call pass if pattern is not present, otherwise fail.
-proc scan-assembler-not { args } {
- if { [llength $args] < 1 } {
- error "scan-assembler-not: too few arguments"
- return
- }
- if { [llength $args] > 2 } {
- error "scan-assembler-not: too many arguments"
- return
- }
- if { [llength $args] >= 2 } {
- switch [dg-process-target [lindex $args 1]] {
- "S" { }
- "N" { return }
- "F" { setup_xfail "*-*-*" }
- "P" { }
- }
- }
-
- upvar 2 name testcase
- set output_file "[file rootname [file tail $testcase]].s"
-
- set fd [open $output_file r]
- set text [read $fd]
- close $fd
-
- if ![regexp -- [lindex $args 0] $text] {
- pass "$testcase scan-assembler-not [lindex $args 0]"
- } else {
- fail "$testcase scan-assembler-not [lindex $args 0]"
- }
-}
-
# Utility for scanning demangled compiler result, invoked via dg-final.
# Call pass if pattern is present, otherwise fail.
proc scan-assembler-dem { args } {