This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: CPP testsuite cleanup


This patch cleans up the preprocessor testsuite by eliminating this
kind of thing:

   { 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 { \}							} }

from the testcases.  Ugh!

The new version:

   { dg-final { scan-file-not cxxcom2.i "is not in C89" } }

is considerably nicer.

In making this transition, I found that a few of the existing tests
weren't working as expected due to mistakes in the Tcl code.  With
Zack's help, I've fixed these as well.  I also began to reduce the
gratuitous code-duplication of code in scanasm.exp.

In general, there shouldn't be raw Tcl code in our tests.  We should
be encapsulating things in Tcl procedures (as above) so that the tests
are easier to maintain.

Tested on i686-pc-linux-gnu, applied on the mainline.

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

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.

Index: lib/scanasm.exp
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/lib/scanasm.exp,v
retrieving revision 1.10
retrieving revision 1.11
diff -c -5 -p -r1.10 -r1.11
*** lib/scanasm.exp	4 Apr 2003 01:18:02 -0000	1.10
--- lib/scanasm.exp	2 Jun 2003 19:21:14 -0000	1.11
***************
*** 1,6 ****
! #   Copyright (C) 2000, 2002 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.
--- 1,6 ----
! #   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
  # the Free Software Foundation; either version 2 of the License, or
  # (at your option) any later version.
***************
*** 16,63 ****
  
  # Various utilities for scanning assembler output, used by gcc-dg.exp and
  # 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"
          return
      }
!     if { [llength $args] > 2 } {
! 	error "scan-assembler: too many arguments"
  	return
      }
!     if { [llength $args] >= 2 } {
! 	switch [dg-process-target [lindex $args 1]] {
  	    "S" { }
  	    "N" { return }
  	    "F" { setup_xfail "*-*-*" }
  	    "P" { }
  	}
      }
  
-     # 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]"
      } else {
! 	fail "$testcase scan-assembler [lindex $args 0]"
      }
  }
  
  # Call pass if pattern is present given number of times, otherwise fail.
  proc scan-assembler-times { args } {
      if { [llength $args] < 2 } {
  	error "scan-assembler: too few arguments"
          return
--- 16,98 ----
  
  # Various utilities for scanning assembler output, used by gcc-dg.exp and
  # g++-dg.exp.
  
  # Utility for scanning compiler result, invoked via dg-final.
! 
! # 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 $orig_args] > 2 } {
! 	error "$name: too many arguments"
  	return
      }
!     if { [llength $orig_args] >= 2 } {
! 	switch [dg-process-target [lindex $orig_args 1]] {
  	    "S" { }
  	    "N" { return }
  	    "F" { setup_xfail "*-*-*" }
  	    "P" { }
  	}
      }
  
      set fd [open $output_file r]
      set text [read $fd]
      close $fd
  
!     set match [regexp -- [lindex $orig_args 0] $text]
!     if { $match == $positive } {
! 	pass "$testcase $name [lindex $orig_args 0]"
      } else {
! 	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 } {
  	error "scan-assembler: too few arguments"
          return
*************** proc scan-assembler-times { args } {
*** 89,131 ****
  
      if { [llength [regexp -inline -all -- [lindex $args 0] $text]] == [lindex $args 1]} {
  	pass "$testcase scan-assembler-times [lindex $args 0] [lindex $args 1]"
      } else {
  	fail "$testcase scan-assembler-times [lindex $args 0] [lindex $args 1]"
-     }
- }
- 
- # 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.
--- 124,133 ----
Index: gcc.dg/cpp/19990228-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/19990228-1.c,v
retrieving revision 1.1
diff -c -5 -p -r1.1 19990228-1.c
*** gcc.dg/cpp/19990228-1.c	27 Jun 2000 22:26:11 -0000	1.1
--- gcc.dg/cpp/19990228-1.c	2 Jun 2003 18:54:07 -0000
*************** foo ("\
*** 16,29 ****
  \
  \
  ",
  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 { \}							} }
!  */
--- 16,21 ----
  \
  \
  ",
  NULL);
  
! /* { dg-final { scan-file-not 19990228-1.i "\[^\\n\]#" } } */
Index: gcc.dg/cpp/_Pragma4.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/_Pragma4.c,v
retrieving revision 1.3
diff -c -5 -p -r1.3 _Pragma4.c
*** gcc.dg/cpp/_Pragma4.c	19 Apr 2003 00:22:51 -0000	1.3
--- gcc.dg/cpp/_Pragma4.c	2 Jun 2003 18:54:07 -0000
***************
*** 3,12 ****
  /* Based on Debian GNATS PR 157416.  3 Sep 2002.  */
  
  #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"      } }
! */
--- 3,8 ----
  /* Based on Debian GNATS PR 157416.  3 Sep 2002.  */
  
  #define b foo _Pragma ("bar") baz
  a b c 
  
! /* { dg-final { scan-file "_Pragma4.i" "(^|\\n)#pragma bar($|\\n)" } } */
Index: gcc.dg/cpp/_Pragma5.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/_Pragma5.c,v
retrieving revision 1.1
diff -c -5 -p -r1.1 _Pragma5.c
*** gcc.dg/cpp/_Pragma5.c	18 Nov 2002 20:43:40 -0000	1.1
--- gcc.dg/cpp/_Pragma5.c	2 Jun 2003 18:54:07 -0000
***************
*** 5,14 ****
  #define ALPHA(A) alpha_ ## A
  #define BETA(B) beta_ ## B
  #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"                       } }
! */
--- 5,10 ----
  #define ALPHA(A) alpha_ ## A
  #define BETA(B) beta_ ## B
  #define GAMMA(C) _Pragma("moose") ALPHA(C) BETA(C)
  GAMMA(baz);
  
! /* { dg-final { scan-file "_Pragma5.i" "alpha_baz beta_baz;" } } */
Index: gcc.dg/cpp/avoidpaste1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/avoidpaste1.c,v
retrieving revision 1.5
diff -c -5 -p -r1.5 avoidpaste1.c
*** gcc.dg/cpp/avoidpaste1.c	16 Sep 2002 13:29:50 -0000	1.5
--- gcc.dg/cpp/avoidpaste1.c	2 Jun 2003 18:54:07 -0000
***************
*** 1,6 ****
! /* Copyright (C) 2001 Free Software Foundation, Inc.  */
  
  /* { dg-do preprocess } */
  
  /* This tests that we avoid accidental pasting only before and after
     macros and arguments, and not when the tokens are already pasted
--- 1,6 ----
! /* Copyright (C) 2001, 2003 Free Software Foundation, Inc.  */
  
  /* { dg-do preprocess } */
  
  /* This tests that we avoid accidental pasting only before and after
     macros and arguments, and not when the tokens are already pasted
*************** the colons of C++'s :: operator.  If we 
*** 22,33 ****
  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"                     } }
! */
--- 22,28 ----
  in future, this test needs to change.  */
  
  :: :g: :f(): :f(^): tricky
  :f(:): .. .__INCLUDE_LEVEL__ __INCLUDE_LEVEL__. /* Check builtins, too.  */
  
! /* { dg-final { scan-file avoidpaste1.i ":: : : : : :\\^: 1.0e- 1" } }
!    { dg-final { scan-file avoidpaste1.i ": : : \\\.\\\. \\\. 0 0 \\\." } } */
Index: gcc.dg/cpp/avoidpaste2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/avoidpaste2.c,v
retrieving revision 1.1
diff -c -5 -p -r1.1 avoidpaste2.c
*** gcc.dg/cpp/avoidpaste2.c	1 Feb 2001 19:15:06 -0000	1.1
--- gcc.dg/cpp/avoidpaste2.c	2 Jun 2003 18:54:07 -0000
***************
*** 1,6 ****
! /* Copyright (C) 2001 Free Software Foundation, Inc.  */
  
  /* { dg-do preprocess } */
  
  /* This tests that we avoid accidental pasting, as well as gratuitous
     space insertion, in various nasty places _inside_ a macro's
--- 1,6 ----
! /* Copyright (C) 2001, 2003 Free Software Foundation, Inc.  */
  
  /* { dg-do preprocess } */
  
  /* This tests that we avoid accidental pasting, as well as gratuitous
     space insertion, in various nasty places _inside_ a macro's
*************** We used to get a space at the start of t
*** 24,35 ****
  
   EMPTY_WITH_LEADING_SPACE
  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"                     } }
! */
--- 24,30 ----
  
   EMPTY_WITH_LEADING_SPACE
  f(:,) 
  g(2, 2)
  
! /* { dg-final { scan-file avoidpaste2.i "(^|\\n): : : - > - >" } } 
!    { dg-final { scan-file avoidpaste2.i "(^|\\n):2: :22 22:" } } */
Index: gcc.dg/cpp/cmdlne-C2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/cmdlne-C2.c,v
retrieving revision 1.1
diff -c -5 -p -r1.1 cmdlne-C2.c
*** gcc.dg/cpp/cmdlne-C2.c	9 Oct 2001 06:16:25 -0000	1.1
--- gcc.dg/cpp/cmdlne-C2.c	2 Jun 2003 18:54:07 -0000
***************
*** 1,6 ****
! /* Copyright (C) 2000, 2001 Free Software Foundation, Inc.  */
  
  /* { dg-do preprocess } */
  /* { dg-options "-C" } */
  
  /* This tests that C++ comments are either dropped, or converted to C
--- 1,6 ----
! /* Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.  */
  
  /* { dg-do preprocess } */
  /* { dg-options "-C" } */
  
  /* This tests that C++ comments are either dropped, or converted to C
***************
*** 11,21 ****
  
  #define ZERO 0 // A comment
  
  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"        } }
! */
  
--- 11,17 ----
  
  #define ZERO 0 // A comment
  
  ZERO:
  
! /* { dg-final { scan-file-not cmdlne-C2.i "c+omment:" } } */
  
Index: gcc.dg/cpp/cmdlne-P.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/cmdlne-P.c,v
retrieving revision 1.1
diff -c -5 -p -r1.1 cmdlne-P.c
*** gcc.dg/cpp/cmdlne-P.c	18 Dec 2000 19:37:18 -0000	1.1
--- gcc.dg/cpp/cmdlne-P.c	2 Jun 2003 18:54:07 -0000
***************
*** 1,13 ****
! /* Copyright (C) 2000 Free Software Foundation, Inc.  */
  
  /* { dg-do preprocess } */
  /* { dg-options "-P" } */
  
  /* Test that we don't stair-step output with -P.  Source: Neil Booth,
     18 Dec 2000.  */
  
  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"              } } */
--- 1,11 ----
! /* Copyright (C) 2000, 2003 Free Software Foundation, Inc.  */
  
  /* { dg-do preprocess } */
  /* { dg-options "-P" } */
  
  /* Test that we don't stair-step output with -P.  Source: Neil Booth,
     18 Dec 2000.  */
  
  int x = 1;
  
! /* { dg-final { scan-file cmdlne-P.i "(^|\n)int x = 1;($|\n)" } } */
Index: gcc.dg/cpp/cmdlne-dD-M.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/cmdlne-dD-M.c,v
retrieving revision 1.2
diff -c -5 -p -r1.2 cmdlne-dD-M.c
*** gcc.dg/cpp/cmdlne-dD-M.c	3 May 2002 20:28:09 -0000	1.2
--- gcc.dg/cpp/cmdlne-dD-M.c	2 Jun 2003 18:54:07 -0000
***************
*** 1,6 ****
! /* Copyright (C) 2002 Free Software Foundation, Inc.  */
  
  /* { dg-do preprocess } */
  /* { dg-options "-dD -M" } */
  
  /* Test -dD -M does not fail.  It should print just
--- 1,6 ----
! /* Copyright (C) 2002, 2003 Free Software Foundation, Inc.  */
  
  /* { dg-do preprocess } */
  /* { dg-options "-dD -M" } */
  
  /* Test -dD -M does not fail.  It should print just
***************
*** 8,17 ****
  
  #define foo bar
  #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 } }  */
--- 8,15 ----
  
  #define foo bar
  #define funlike(like) fun like
  int variable;
  
! /* { 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 *-*-* } } } */
Index: gcc.dg/cpp/cmdlne-dD-dM.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/cmdlne-dD-dM.c,v
retrieving revision 1.2
diff -c -5 -p -r1.2 cmdlne-dD-dM.c
*** gcc.dg/cpp/cmdlne-dD-dM.c	3 May 2002 20:28:09 -0000	1.2
--- gcc.dg/cpp/cmdlne-dD-dM.c	2 Jun 2003 18:54:07 -0000
***************
*** 1,6 ****
! /* Copyright (C) 2002 Free Software Foundation, Inc.  */
  
  /* { dg-do preprocess } */
  /* { dg-options "-dD -dM" } */
  
  /* Test -dD -dM does not fail.  It should give the same output
--- 1,6 ----
! /* Copyright (C) 2002, 2003 Free Software Foundation, Inc.  */
  
  /* { dg-do preprocess } */
  /* { dg-options "-dD -dM" } */
  
  /* Test -dD -dM does not fail.  It should give the same output
***************
*** 8,16 ****
  
  #define foo bar
  #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 } }  */
--- 8,14 ----
  
  #define foo bar
  #define funlike(like) fun like
  int variable;
  
! /* { dg-final { scan-file cmdlne-dD-dM.i "(^|\\n)#define foo bar($|\\n)" } }
!    { dg-final { scan-file-not cmdlne-dD-dM.i "variable" } } */
Index: gcc.dg/cpp/cmdlne-dI-M.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/cmdlne-dI-M.c,v
retrieving revision 1.2
diff -c -5 -p -r1.2 cmdlne-dI-M.c
*** gcc.dg/cpp/cmdlne-dI-M.c	3 May 2002 20:28:09 -0000	1.2
--- gcc.dg/cpp/cmdlne-dI-M.c	2 Jun 2003 18:54:07 -0000
***************
*** 1,6 ****
! /* Copyright (C) 2002 Free Software Foundation, Inc.  */
  
  /* { dg-do preprocess } */
  /* { dg-options "-dI -M" } */
  
  /* Test -dI -M does not fail.  It should print just
--- 1,6 ----
! /* Copyright (C) 2002, 2003 Free Software Foundation, Inc.  */
  
  /* { dg-do preprocess } */
  /* { dg-options "-dI -M" } */
  
  /* Test -dI -M does not fail.  It should print just
***************
*** 9,18 ****
  #define foo bar
  #include "cmdlne-dI-M.h"
  #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 } }  */
--- 9,16 ----
  #define foo bar
  #include "cmdlne-dI-M.h"
  #define funlike(like) fun like
  int variable;
  
! /* { 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 *-*-* } } } */
Index: gcc.dg/cpp/cmdlne-dM-M.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/cmdlne-dM-M.c,v
retrieving revision 1.2
diff -c -5 -p -r1.2 cmdlne-dM-M.c
*** gcc.dg/cpp/cmdlne-dM-M.c	3 May 2002 20:28:09 -0000	1.2
--- gcc.dg/cpp/cmdlne-dM-M.c	2 Jun 2003 18:54:07 -0000
***************
*** 1,6 ****
! /* Copyright (C) 2002 Free Software Foundation, Inc.  */
  
  /* { dg-do preprocess } */
  /* { dg-options "-dM -M" } */
  
  /* Test -dM -M does not fail.  It should print both the
--- 1,6 ----
! /* Copyright (C) 2002, 2003 Free Software Foundation, Inc.  */
  
  /* { dg-do preprocess } */
  /* { dg-options "-dM -M" } */
  
  /* Test -dM -M does not fail.  It should print both the
***************
*** 8,17 ****
  
  #define foo bar
  #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 } }  */
--- 8,15 ----
  
  #define foo bar
  #define funlike(like) fun like
  int variable;
  
! /* { 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 *-*-* } } } */
Index: gcc.dg/cpp/cmdlne-dM-dD.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/cmdlne-dM-dD.c,v
retrieving revision 1.2
diff -c -5 -p -r1.2 cmdlne-dM-dD.c
*** gcc.dg/cpp/cmdlne-dM-dD.c	3 May 2002 20:28:09 -0000	1.2
--- gcc.dg/cpp/cmdlne-dM-dD.c	2 Jun 2003 18:54:07 -0000
***************
*** 1,6 ****
! /* Copyright (C) 2002 Free Software Foundation, Inc.  */
  
  /* { dg-do preprocess } */
  /* { dg-options "-dM -dD" } */
  
  /* Test -dM -dD does not fail.  It should give the same output
--- 1,6 ----
! /* Copyright (C) 2002, 2003 Free Software Foundation, Inc.  */
  
  /* { dg-do preprocess } */
  /* { dg-options "-dM -dD" } */
  
  /* Test -dM -dD does not fail.  It should give the same output
***************
*** 8,16 ****
  
  #define foo bar
  #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 } }  */
--- 8,14 ----
  
  #define foo bar
  #define funlike(like) fun like
  int variable;
  
! /* { dg-final { scan-file cmdlne-dM-dD.i "(^|\\n)#define foo bar($|\\n)" } }
!    { dg-final { scan-file cmdlne-dM-dD.i "variable" } } */
Index: gcc.dg/cpp/cmdlne-dN-M.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/cmdlne-dN-M.c,v
retrieving revision 1.2
diff -c -5 -p -r1.2 cmdlne-dN-M.c
*** gcc.dg/cpp/cmdlne-dN-M.c	3 May 2002 20:28:09 -0000	1.2
--- gcc.dg/cpp/cmdlne-dN-M.c	2 Jun 2003 18:54:07 -0000
***************
*** 1,6 ****
! /* Copyright (C) 2002 Free Software Foundation, Inc.  */
  
  /* { dg-do preprocess } */
  /* { dg-options "-dN -M" } */
  
  /* Test -dN -M does not fail.  It should print just
--- 1,6 ----
! /* Copyright (C) 2002, 2003 Free Software Foundation, Inc.  */
  
  /* { dg-do preprocess } */
  /* { dg-options "-dN -M" } */
  
  /* Test -dN -M does not fail.  It should print just
***************
*** 8,17 ****
  
  #define foo bar
  #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 } }  */
--- 8,15 ----
  
  #define foo bar
  #define funlike(like) fun like
  int variable;
  
! /* { 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 *-*-* } } } */
Index: gcc.dg/cpp/cxxcom1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/cxxcom1.c,v
retrieving revision 1.1
diff -c -5 -p -r1.1 cxxcom1.c
*** gcc.dg/cpp/cxxcom1.c	27 Jun 2000 22:26:11 -0000	1.1
--- gcc.dg/cpp/cxxcom1.c	2 Jun 2003 18:54:07 -0000
***************
*** 5,20 ****
  // C++ comment is not in C89  { dg-warning "style comment|reported only once" "good warning" }
  
  /* ...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 { \}							} }
! */
  
--- 5,11 ----
  // C++ comment is not in C89  { dg-warning "style comment|reported only once" "good warning" }
  
  /* ...but we don't bitch about it more than once.  */
  // C++ comment is not in C89  { dg-bogus "style comment" "bad warning" }
  
! /* { dg-final { scan-file-not cxxcom1.i "is not in C89" } } */
  
Index: gcc.dg/cpp/cxxcom2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/cxxcom2.c,v
retrieving revision 1.2
diff -c -5 -p -r1.2 cxxcom2.c
*** gcc.dg/cpp/cxxcom2.c	28 Oct 2000 18:01:40 -0000	1.2
--- gcc.dg/cpp/cxxcom2.c	2 Jun 2003 18:54:07 -0000
***************
*** 1,20 ****
  /* { dg-do preprocess } */
! /* { dg-options "-pedantic -std=c89" } */
  
! /* This is an extension and therefore gets a warning.  */
! #line 5 "cxx-comments-2.c" 3  /* { dg-warning "extra tokens" "#line extension" } */
  
! /* 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 { \}							} }
! */
  
--- 1,7 ----
  /* { dg-do preprocess } */
! /* { dg-options "-pedantic -std=c89 -Wall" } */
  
! #include "cxxcom2.h"
  
! /* { dg-final { scan-file-not cxxcom2.i "is not in C89" } } */
  
Index: gcc.dg/cpp/cxxcom2.h
===================================================================
RCS file: gcc.dg/cpp/cxxcom2.h
diff -N gcc.dg/cpp/cxxcom2.h
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- gcc.dg/cpp/cxxcom2.h	2 Jun 2003 18:54:07 -0000
***************
*** 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" }
+ 
Index: gcc.dg/cpp/line1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/line1.c,v
retrieving revision 1.1
diff -c -5 -p -r1.1 line1.c
*** gcc.dg/cpp/line1.c	27 Jun 2000 22:26:11 -0000	1.1
--- gcc.dg/cpp/line1.c	2 Jun 2003 18:54:07 -0000
***************
*** 1,18 ****
! /* Copyright (C) 2000  Free Software Foundation.
  
     by Alexandre Oliva  <oliva@lsd.ic.unicamp.br>  */
  
  /* { dg-do preprocess } */
  
  /* The line number below must be just a few lines greater than the
     actual line number. */
  #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 { \} } }
! */
--- 1,12 ----
! /* Copyright (C) 2000, 2003  Free Software Foundation.
  
     by Alexandre Oliva  <oliva@lsd.ic.unicamp.br>  */
  
  /* { dg-do preprocess } */
  
  /* The line number below must be just a few lines greater than the
     actual line number. */
  #line 10 "baz"
  wibble
  
! /* { dg-final { scan-file line1.i baz } } */
Index: gcc.dg/cpp/maccom1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/maccom1.c,v
retrieving revision 1.1
diff -c -5 -p -r1.1 maccom1.c
*** gcc.dg/cpp/maccom1.c	7 Apr 2002 03:12:23 -0000	1.1
--- gcc.dg/cpp/maccom1.c	2 Jun 2003 18:54:07 -0000
***************
*** 8,17 ****
  
  #/**/define def passed
  
  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" } }
! */
--- 8,14 ----
  
  #/**/define def passed
  
  def
  
! /* { dg-final { scan-file maccom1.i "(^|\\n)passed" } } */
! 
Index: gcc.dg/cpp/maccom2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/maccom2.c,v
retrieving revision 1.1
diff -c -5 -p -r1.1 maccom2.c
*** gcc.dg/cpp/maccom2.c	7 Apr 2002 03:12:23 -0000	1.1
--- gcc.dg/cpp/maccom2.c	2 Jun 2003 18:54:07 -0000
***************
*** 9,18 ****
  
  #define/**/def passed
  
  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" } }
! */
--- 9,14 ----
  
  #define/**/def passed
  
  def
  
! /* { dg-final { scan-file maccom2.i "(^|\n)passed" } } */
Index: gcc.dg/cpp/maccom3.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/maccom3.c,v
retrieving revision 1.1
diff -c -5 -p -r1.1 maccom3.c
*** gcc.dg/cpp/maccom3.c	7 Apr 2002 03:12:23 -0000	1.1
--- gcc.dg/cpp/maccom3.c	2 Jun 2003 18:54:07 -0000
***************
*** 8,17 ****
  
  #define def(x /**/, y) passed
  
  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" } }
! */
--- 8,13 ----
  
  #define def(x /**/, y) passed
  
  def(x,y)
  
! /* { dg-final { scan-file maccom3.i "(^|\n)passed" } } */
Index: gcc.dg/cpp/maccom4.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/maccom4.c,v
retrieving revision 1.1
diff -c -5 -p -r1.1 maccom4.c
*** gcc.dg/cpp/maccom4.c	7 Apr 2002 03:12:23 -0000	1.1
--- gcc.dg/cpp/maccom4.c	2 Jun 2003 18:54:07 -0000
***************
*** 11,19 ****
  
  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"     } }
  */
--- 11,17 ----
  
  def
  
  /*
     /* The + in the regexp prevents it from matching itself.  */
!    { dg-final { scan-file maccom4.i "p+assed" } }
  */
Index: gcc.dg/cpp/maccom5.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/maccom5.c,v
retrieving revision 1.1
diff -c -5 -p -r1.1 maccom5.c
*** gcc.dg/cpp/maccom5.c	7 Apr 2002 03:12:23 -0000	1.1
--- gcc.dg/cpp/maccom5.c	2 Jun 2003 18:54:07 -0000
***************
*** 11,21 ****
  
  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" } }
  */
--- 11,18 ----
  
  def:
  
  /*
     /* The + in the regexp prevents it from matching itself.  */
!    { dg-final { scan-file maccom5.i "p+assed" } }
!    { dg-final { scan-file-not maccom5.i "p+assed:" } }
  */
Index: gcc.dg/cpp/maccom6.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/maccom6.c,v
retrieving revision 1.1
diff -c -5 -p -r1.1 maccom6.c
*** gcc.dg/cpp/maccom6.c	7 Apr 2002 03:12:23 -0000	1.1
--- gcc.dg/cpp/maccom6.c	2 Jun 2003 18:54:07 -0000
***************
*** 15,24 ****
  failed
  #else
  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"  } }
! */
--- 15,20 ----
  failed
  #else
  passed
  #endif
  
! /* { dg-final { scan-file maccom6.i "(^|\n)passed" } } */
Index: gcc.dg/cpp/multiline.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/multiline.c,v
retrieving revision 1.5
diff -c -5 -p -r1.5 multiline.c
*** gcc.dg/cpp/multiline.c	23 Apr 2003 22:44:05 -0000	1.5
--- gcc.dg/cpp/multiline.c	2 Jun 2003 18:54:07 -0000
*************** L"line 1
*** 16,26 ****
    line 2
    line 3
    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-bogus "missing term" "multiline strings" { target *-*-* } 11 } */
  /* { dg-bogus "warning" "warning in place of error" { target *-*-* } 15 } */
--- 16,23 ----
    line 2
    line 3
    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 { 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 } */
Index: gcc.dg/cpp/spacing1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/spacing1.c,v
retrieving revision 1.3
diff -c -5 -p -r1.3 spacing1.c
*** gcc.dg/cpp/spacing1.c	8 Oct 2001 06:15:14 -0000	1.3
--- gcc.dg/cpp/spacing1.c	2 Jun 2003 18:54:07 -0000
***************
*** 1,6 ****
! /* Copyright (C) 2000, 2001 Free Software Foundation, Inc.  */
  
  /* { dg-do preprocess } */
  
  /* This tests correct spacing of macro expansion output, as well as
     the line it falls on.  This is quite subtle; it involves newlines
--- 1,6 ----
! /* Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.  */
  
  /* { dg-do preprocess } */
  
  /* This tests correct spacing of macro expansion output, as well as
     the line it falls on.  This is quite subtle; it involves newlines
*************** f (g) str
*** 41,55 ****
  1
  2
  ) 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"      } }
! */
--- 41,50 ----
  1
  2
  ) f
  (bam) baz
  
! /* { 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" } } */
Index: gcc.dg/cpp/spacing2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/spacing2.c,v
retrieving revision 1.1
diff -c -5 -p -r1.1 spacing2.c
*** gcc.dg/cpp/spacing2.c	12 Oct 2001 22:31:04 -0000	1.1
--- gcc.dg/cpp/spacing2.c	2 Jun 2003 18:54:07 -0000
***************
*** 1,6 ****
! /* Copyright (C) 2001 Free Software Foundation, Inc.  */
  
  /* { dg-do preprocess } */
  
  /* We used to output an unnecessary leading space, leading to Emacs
     confusion with its Makefile abuse.
--- 1,6 ----
! /* Copyright (C) 2001, 2003 Free Software Foundation, Inc.  */
  
  /* { dg-do preprocess } */
  
  /* We used to output an unnecessary leading space, leading to Emacs
     confusion with its Makefile abuse.
***************
*** 11,21 ****
  #define foo bar
  
  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"			  } }
! */
--- 11,16 ----
  #define foo bar
  
  a = EMPTY
  foo..				/* No leading space on output.  */
  
! /* { dg-final { scan-file spacing2.i "(^|\n)bar\.\." } } */
Index: gcc.dg/cpp/trad/cmdlne-C2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/trad/cmdlne-C2.c,v
retrieving revision 1.1
diff -c -5 -p -r1.1 cmdlne-C2.c
*** gcc.dg/cpp/trad/cmdlne-C2.c	25 Jun 2002 06:00:28 -0000	1.1
--- gcc.dg/cpp/trad/cmdlne-C2.c	2 Jun 2003 18:54:07 -0000
***************
*** 1,15 ****
! /* Copyright (C) 2002 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 { 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"        } }
! */
  
--- 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" } } */
  
Index: gcc.dg/cpp/trad/maccom1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/trad/maccom1.c,v
retrieving revision 1.1
diff -c -5 -p -r1.1 maccom1.c
*** gcc.dg/cpp/trad/maccom1.c	25 Jun 2002 06:00:28 -0000	1.1
--- gcc.dg/cpp/trad/maccom1.c	2 Jun 2003 18:54:07 -0000
***************
*** 8,17 ****
  
  #/**/define def passed
  
  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" } }
! */
--- 8,13 ----
  
  #/**/define def passed
  
  def
  
! /* { dg-final { scan-file maccom1.i "(^|\n)passed" } } */
Index: gcc.dg/cpp/trad/maccom2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/trad/maccom2.c,v
retrieving revision 1.1
diff -c -5 -p -r1.1 maccom2.c
*** gcc.dg/cpp/trad/maccom2.c	25 Jun 2002 06:00:28 -0000	1.1
--- gcc.dg/cpp/trad/maccom2.c	2 Jun 2003 18:54:07 -0000
***************
*** 9,18 ****
  
  #define/**/def passed
  
  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" } }
! */
--- 9,14 ----
  
  #define/**/def passed
  
  def
  
! /* { dg-final { scan-file maccom2.i "(^|\n)passed" } } */
Index: gcc.dg/cpp/trad/maccom3.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/trad/maccom3.c,v
retrieving revision 1.1
diff -c -5 -p -r1.1 maccom3.c
*** gcc.dg/cpp/trad/maccom3.c	25 Jun 2002 06:00:28 -0000	1.1
--- gcc.dg/cpp/trad/maccom3.c	2 Jun 2003 18:54:07 -0000
***************
*** 8,17 ****
  
  #define def(x /**/, y) passed
  
  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" } }
! */
--- 8,13 ----
  
  #define def(x /**/, y) passed
  
  def(x,y)
  
! /* { dg-final { scan-file maccom3.i "(^|\n)passed" } } */
Index: gcc.dg/cpp/trad/maccom4.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/trad/maccom4.c,v
retrieving revision 1.1
diff -c -5 -p -r1.1 maccom4.c
*** gcc.dg/cpp/trad/maccom4.c	25 Jun 2002 06:00:28 -0000	1.1
--- gcc.dg/cpp/trad/maccom4.c	2 Jun 2003 18:54:07 -0000
***************
*** 11,19 ****
  
  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"     } }
  */
--- 11,17 ----
  
  def
  
  /*
     /* The + in the regexp prevents it from matching itself.  */
!    { dg-final { scan-file maccom4.i "p+assed" } }
  */
Index: gcc.dg/cpp/trad/maccom6.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/trad/maccom6.c,v
retrieving revision 1.1
diff -c -5 -p -r1.1 maccom6.c
*** gcc.dg/cpp/trad/maccom6.c	25 Jun 2002 06:00:28 -0000	1.1
--- gcc.dg/cpp/trad/maccom6.c	2 Jun 2003 18:54:07 -0000
***************
*** 15,24 ****
  failed
  #else
  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"  } }
! */
--- 15,20 ----
  failed
  #else
  passed
  #endif
  
! /* { dg-final { scan-file maccom6.i "(^|\n)passed" } } */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]