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]

[RFA:] Take 2: Adjust testsuite to "linker input file unused *because* ..."


No, forget the previous patch.  That wasn't enough, and some
*.exp-stuff was just obsolete and redundant (ugh).  The
installed dejagnu applied its now-obsoleted prune_warnings in
default_target_compile which is normally called by
target_compile.  So the correct fix is to apply a filter for
unwanted diagnostics to the return of ${tool}_target_compile,
before returning.  Thankfully, there already existed such
functions, except in g++.exp.  Note that only unimportant
diagnostics are filtered out.

What is *not* in this patch is removal of the redundant
prune_warnings calls and the redundant filtering in lots of
places (like in g??-mike.exp and *deja*.exp); but that was
redundant before too.  I might fix it separately, if wanted; it
will cut off a large piece of those files, and perhaps cut a few
seconds off running the testsuite.  Maybe some of that cruft
catered to old dejagnu releases, but AFAIK we're supposed to be
using the versions pointed to in the FAQ.

This removes spurious failures; no change in test tesults for
i686-pc-linux-gnu without, and now the same results happen with
'RUNTESTFLAGS=--tool_opts -Wl,-Qy'.  The linker option -Qy is
ignored by that GNU ld, but triggers the diagnostic that is now
filtered out again.

Ok to commit?

	* lib/gcc.exp (gcc_target_compile): Apply prune_gcc_output on
	return-value.
	(prune_gcc_output): Adjust pruned message "linking not done" to
	recent change.
	Strip out the first empty lines.
	* lib/g++.exp (g++_target_compile): Apply prune_g++_output on
	return-value.
	(prune_g++_output): New, copy of prune_gcc_output.
	* lib/g77.exp: Corresponding changes.
	* lib/objc.exp: Corresponding changes.

Index: g++.exp
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/lib/g++.exp,v
retrieving revision 1.12
diff -c -p -r1.12 g++.exp
*** g++.exp	2000/10/26 07:28:24	1.12
--- g++.exp	2000/11/07 23:05:21
*************** proc g++_target_compile { source dest ty
*** 256,262 ****
  	exec rm -f $rponame
      }
  
!     return [target_compile $source $dest $type $options]
  }
  
  proc g++_exit { args } {
--- 256,262 ----
  	exec rm -f $rponame
      }
  
!     return [prune_g++_output [target_compile $source $dest $type $options]]
  }
  
  proc g++_exit { args } {
*************** proc ${tool}_option_proc { option } {
*** 326,328 ****
--- 326,351 ----
  	return 0
      }
  }
+ 
+ proc prune_g++_output { text } {
+     #send_user "Before:$text\n"
+     regsub -all "(^|\n)\[^\n\]*: In (function|method) \[^\n\]*" $text "" text
+     regsub -all "(^|\n)\[^\n\]*: At top level:\[^\n\]*" $text "" text
+ 
+     # It would be nice to avoid passing anything to gcc that would cause it to
+     # issue these messages (since ignoring them seems like a hack on our part),
+     # but that's too difficult in the general case.  For example, sometimes
+     # you need to use -B to point gcc at crt0.o, but there are some targets
+     # that don't have crt0.o.
+     regsub -all "(^|\n)\[^\n\]*file path prefix \[^\n\]* never used" $text "" text
+     regsub -all "(^|\n)\[^\n\]*linker input file unused (since|because) linking not done" $text "" text
+ 
+     # We now strip out the *first* empty lines after the stripping
+     # above, just like default_target_compile in target.exp.
+     regsub "^\[\r\n\]+" $text "" text;
+ 
+     #send_user "After:$text\n"
+ 
+     return $text
+ }
+ 
Index: g77.exp
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/lib/g77.exp,v
retrieving revision 1.5
diff -c -p -r1.5 g77.exp
*** g77.exp	1998/12/16 22:24:20	1.5
--- g77.exp	2000/11/07 23:05:21
***************
*** 1,4 ****
! # Copyright (C) 1992, 1993, 1994, 1996, 1997 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
--- 1,4 ----
! # Copyright (C) 1992, 1993, 1994, 1996, 1997, 2000 Free Software Foundation, Inc.
  
  # This program is free software; you can redistribute it and/or modify
  # it under the terms of the GNU General Public License as published by
*************** proc g77_target_compile { source dest ty
*** 151,157 ****
        }
      }
      lappend options "compiler=$G77_UNDER_TEST"
!     return [target_compile $source $dest $type $options]
  }
  
  #
--- 151,157 ----
        }
      }
      lappend options "compiler=$G77_UNDER_TEST"
!     return [prune_g77_output [target_compile $source $dest $type $options]]
  }
  
  #
*************** proc prune_g77_output { text } {
*** 265,271 ****
      # you need to use -B to point g77 at crt0.o, but there are some targets
      # that don't have crt0.o.
      regsub -all "(^|\n)\[^\n\]*file path prefix \[^\n\]* never used" $text "" text
!     regsub -all "(^|\n)\[^\n\]*linker input file unused since linking not done" $text "" text
  
      #send_user "After:$text\n"
  
--- 265,275 ----
      # you need to use -B to point g77 at crt0.o, but there are some targets
      # that don't have crt0.o.
      regsub -all "(^|\n)\[^\n\]*file path prefix \[^\n\]* never used" $text "" text
!     regsub -all "(^|\n)\[^\n\]*linker input file unused (since|because) linking not done" $text "" text
! 
!     # We now strip out the *first* empty lines after the stripping
!     # above, just like default_target_compile in target.exp.
!     regsub "^\[\r\n\]+" $text "" text;
  
      #send_user "After:$text\n"
  
Index: gcc.exp
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/lib/gcc.exp,v
retrieving revision 1.4
diff -c -p -r1.4 gcc.exp
*** gcc.exp	1999/04/07 04:32:04	1.4
--- gcc.exp	2000/11/07 23:05:21
***************
*** 1,4 ****
! # Copyright (C) 1992, 1993, 1994, 1996, 1997, 1999 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
--- 1,4 ----
! # Copyright (C) 1992, 1993, 1994, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
  
  # This program is free software; you can redistribute it and/or modify
  # it under the terms of the GNU General Public License as published by
*************** proc gcc_target_compile { source dest ty
*** 148,154 ****
  	lappend options "timeout=[target_info gcc,timeout]"
      }
      lappend options "compiler=$GCC_UNDER_TEST"
!     return [target_compile $source $dest $type $options]
  }
  
  
--- 148,154 ----
  	lappend options "timeout=[target_info gcc,timeout]"
      }
      lappend options "compiler=$GCC_UNDER_TEST"
!     return [prune_gcc_output [target_compile $source $dest $type $options]]
  }
  
  
*************** proc prune_gcc_output { text } {
*** 316,322 ****
      # you need to use -B to point gcc at crt0.o, but there are some targets
      # that don't have crt0.o.
      regsub -all "(^|\n)\[^\n\]*file path prefix \[^\n\]* never used" $text "" text
!     regsub -all "(^|\n)\[^\n\]*linker input file unused since linking not done" $text "" text
  
      #send_user "After:$text\n"
  
--- 316,326 ----
      # you need to use -B to point gcc at crt0.o, but there are some targets
      # that don't have crt0.o.
      regsub -all "(^|\n)\[^\n\]*file path prefix \[^\n\]* never used" $text "" text
!     regsub -all "(^|\n)\[^\n\]*linker input file unused (since|because) linking not done" $text "" text
! 
!     # We now strip out the *first* empty lines after the stripping
!     # above, just like default_target_compile in target.exp.
!     regsub "^\[\r\n\]+" $text "" text;
  
      #send_user "After:$text\n"
  
Index: objc.exp
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/lib/objc.exp,v
retrieving revision 1.5
diff -c -p -r1.5 objc.exp
*** objc.exp	2000/08/06 18:41:49	1.5
--- objc.exp	2000/11/07 23:05:21
*************** proc objc_target_compile { source dest t
*** 151,157 ****
  	append ld_library_path ":${libobjc_dir}"
      }
      lappend options "compiler=$OBJC_UNDER_TEST"
!     return [target_compile $source $dest $type $options]
  }
  
  #
--- 151,157 ----
  	append ld_library_path ":${libobjc_dir}"
      }
      lappend options "compiler=$OBJC_UNDER_TEST"
!     return [prune_objc_output [target_compile $source $dest $type $options]]
  }
  
  #
*************** proc prune_objc_output { text } {
*** 265,271 ****
      # you need to use -B to point objc at crt0.o, but there are some targets
      # that don't have crt0.o.
      regsub -all "(^|\n)\[^\n\]*file path prefix \[^\n\]* never used" $text "" text
!     regsub -all "(^|\n)\[^\n\]*linker input file unused since linking not done" $text "" text
  
      #send_user "After:$text\n"
  
--- 265,275 ----
      # you need to use -B to point objc at crt0.o, but there are some targets
      # that don't have crt0.o.
      regsub -all "(^|\n)\[^\n\]*file path prefix \[^\n\]* never used" $text "" text
!     regsub -all "(^|\n)\[^\n\]*linker input file unused (since|because) linking not done" $text "" text
! 
!     # We now strip out the *first* empty lines after the stripping
!     # above, just like default_target_compile in target.exp.
!     regsub "^\[\r\n\]+" $text "" text;
  
      #send_user "After:$text\n"
  
brgds, H-P

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