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]

Re: Fix to eCos gcc tests - do not fail if target does not support aliases


Hi Guys,

  Following a conversation with Jifl, here are some improvments to my
  earlier patch.  In this version a seperate proc is used to decide if
  the target supports aliases, and the answer is cached, so that
  further calls do not require additional compiles to take place.

  Also the proc will now return a failure result if an ELF based
  toolchain claims that it does not support aliases.

  Any other comments or shall I check this version in ?

Cheers
	Nick


1999-11-04  Nick Clifton  <nickc@cygnus.com>

	* gcc.dg/special/ecos.exp (check_alias_available): New proc:
	Determine of the target toolchain supports the alias
	attribute.
	(alias-1.c): Only perform the test if the target supports
	aliases. 
	(wkali-1.c): Only perform the test if the target supports
	aliases. 
  
Index: gcc.dg/special/ecos.exp
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/testsuite/gcc.dg/special/ecos.exp,v
retrieving revision 1.4
diff -p -r1.4 ecos.exp
*** ecos.exp	1999/09/21 17:43:01	1.4
--- ecos.exp	1999/11/04 14:17:07
*************** proc check_weak_available { } {
*** 59,64 ****
--- 59,110 ----
      }
  }
  
+ ###############################
+ # proc check_alias_available { }
+ ###############################
+ 
+ # Determine if the target toolchain supports the alias attribute.
+ # Parameter is the pathname of a file that can be used to test the alias support.
+ # Returns yes if it does.
+ # Returns no if it does not.
+ # Returns dontknow if something went wrong
+ 
+ proc check_alias_available { testfile } {
+     global alias_available_saved
+     
+     if [info exists alias_available_saved] {
+         verbose "check_alias_available  returning saved $alias_available_saved" 2
+     } else {
+         verbose "check_alias_available  compiling testfile $testfile" 2
+ 	set lines [gcc_target_compile $testfile "tmp.o" object ""]
+ 	
+ 	if [string match "" $lines] then {
+ 	    # No error messages, everything is OK.
+ 	    set alias_available_saved yes
+ 	} else {
+ 	    # Did the compiler tell us that this target does not support aliases ?
+ 	    if [regexp "alias definitions not supported" $lines] {
+ 		verbose "check_alias_available  target does not support aliases" 2
+ 
+ 		set objformat [gcc_target_object_format]
+ 
+ 		if { $objformat == "elf" } {
+ 		    verbose "check_alias_available  but target uses ELF format, so it ought to" 2
+ 		    set alias_available_saved dontknow
+ 		} else {
+ 		    set alias_available_saved no
+ 		}
+ 	    } else {
+ 		set alias_available_saved dontknow
+ 	    }
+ 	}
+ 	
+ 	verbose "check_alias_available  returning $alias_available_saved" 2
+     }
+ 
+     return $alias_available_saved
+ }
+ 
  ##########
  # weak-1.c
  ##########
*************** if { [ check_weak_available ] == 1 } {
*** 111,117 ****
  ###########
  
  dg-init
! dg-runtest "$srcdir/$subdir/alias-1.c" "" ""
  dg-finish
  
  ###########
--- 157,167 ----
  ###########
  
  dg-init
! switch [check_alias_available "$srcdir/$subdir/alias-1.c"] {
!     yes    { dg-runtest "$srcdir/$subdir/alias-1.c" "" "" }
!     no     { unsupported "alias-1.c" }
!     defaut { fail "alias-1.c" }
! }
  dg-finish
  
  ###########
*************** dg-finish
*** 119,125 ****
  ###########
  
  dg-init
! dg-runtest "$srcdir/$subdir/wkali-1.c" "" ""
  dg-finish
  
  ###########
--- 169,179 ----
  ###########
  
  dg-init
! switch [check_alias_available "$srcdir/$subdir/wkali-1.c"] {
!     yes     { dg-runtest "$srcdir/$subdir/wkali-1.c" "" "" }
!     no      { unsupported "wkali-1.c" }
!     default { fail "wkali-1.c" }
! }
  dg-finish
  
  ###########


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