Commit 5a9f05f2 by Mark Mitchell Committed by Mark Mitchell

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
parent 245115a4
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.
......
......@@ -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\]#" } } */
......@@ -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)" } } */
......@@ -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;" } } */
/* 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 \\\." } } */
/* 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:" } } */
/* 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:" } } */
/* 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)" } } */
/* 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 *-*-* } } } */
/* 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" } } */
/* 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 *-*-* } } } */
/* 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 *-*-* } } } */
/* 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" } } */
/* 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 *-*-* } } } */
......@@ -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" } } */
/* { 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" } } */
/* 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" }
/* 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 } } */
......@@ -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" } } */
......@@ -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" } } */
......@@ -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" } } */
......@@ -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" } }
*/
......@@ -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:" } }
*/
......@@ -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" } } */
......@@ -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 } */
/* 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" } } */
/* 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\.\." } } */
/* 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" } } */
......@@ -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" } } */
......@@ -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" } } */
......@@ -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" } } */
......@@ -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" } }
*/
......@@ -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" } } */
# 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 } {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment