Blame SOURCES/gcc49-alt-compat-test2.patch

72e591
2014-05-29  Jakub Jelinek  <jakub@redhat.com>
72e591
72e591
	* lib/target-libpath.exp (set_gcc_exec_prefix_env_var,
72e591
	restore_gcc_exec_prefix_env_var): New procedures.
72e591
	(set_ld_library_path_env_vars,
72e591
	restore_ld_library_path_env_vars): Use them.
72e591
	* lib/c-compat.exp: Load target-libpath.exp.
72e591
	(compat-use-alt-compiler): Call restore_gcc_exec_prefix_env_var.
72e591
	(compat-use-tst-compiler): Call set_gcc_exec_prefix_env_var.
72e591
	* g++.dg/compat/compat.exp (compat-use-alt-compiler): Call
72e591
	restore_gcc_exec_prefix_env_var.
72e591
	* g++.dg/compat/struct-layout-1.exp (compat-use-alt-compiler):
72e591
	Likewise.
72e591
72e591
--- gcc/testsuite/lib/target-libpath.exp.jj	2014-03-20 16:29:20.000000000 +0100
72e591
+++ gcc/testsuite/lib/target-libpath.exp	2014-05-29 19:32:58.192043417 +0200
72e591
@@ -28,6 +28,21 @@ set orig_gcc_exec_prefix_checked 0
72e591
 
72e591
 
72e591
 #######################################
72e591
+# proc set_gcc_exec_prefix_env_var { }
72e591
+#######################################
72e591
+
72e591
+proc set_gcc_exec_prefix_env_var { } {
72e591
+  global TEST_GCC_EXEC_PREFIX
72e591
+  global env
72e591
+
72e591
+  # Set GCC_EXEC_PREFIX for the compiler under test to pick up files not in
72e591
+  # the build tree from a specified location (normally the install tree).
72e591
+  if [info exists TEST_GCC_EXEC_PREFIX] {
72e591
+    setenv GCC_EXEC_PREFIX "$TEST_GCC_EXEC_PREFIX"
72e591
+  }
72e591
+}
72e591
+
72e591
+#######################################
72e591
 # proc set_ld_library_path_env_vars { }
72e591
 #######################################
72e591
 
72e591
@@ -49,7 +64,6 @@ proc set_ld_library_path_env_vars { } {
72e591
   global orig_ld_library_path_64
72e591
   global orig_dyld_library_path
72e591
   global orig_gcc_exec_prefix
72e591
-  global TEST_GCC_EXEC_PREFIX
72e591
   global env
72e591
 
72e591
   # Save the original GCC_EXEC_PREFIX.
72e591
@@ -61,11 +75,7 @@ proc set_ld_library_path_env_vars { } {
72e591
     set orig_gcc_exec_prefix_checked 1
72e591
   }
72e591
 
72e591
-  # Set GCC_EXEC_PREFIX for the compiler under test to pick up files not in
72e591
-  # the build tree from a specified location (normally the install tree).
72e591
-  if [info exists TEST_GCC_EXEC_PREFIX] {
72e591
-    setenv GCC_EXEC_PREFIX "$TEST_GCC_EXEC_PREFIX"
72e591
-  }
72e591
+  set_gcc_exec_prefix_env_var
72e591
 
72e591
   # Setting the ld library path causes trouble when testing cross-compilers.
72e591
   if { [is_remote target] } {
72e591
@@ -164,6 +174,22 @@ proc set_ld_library_path_env_vars { } {
72e591
 }
72e591
 
72e591
 #######################################
72e591
+# proc restore_gcc_exec_prefix_env_var { }
72e591
+#######################################
72e591
+
72e591
+proc restore_gcc_exec_prefix_env_var { } {
72e591
+  global orig_gcc_exec_prefix_saved
72e591
+  global orig_gcc_exec_prefix
72e591
+  global env
72e591
+
72e591
+  if { $orig_gcc_exec_prefix_saved } {
72e591
+    setenv GCC_EXEC_PREFIX "$orig_gcc_exec_prefix"
72e591
+  } elseif [info exists env(GCC_EXEC_PREFIX)] {
72e591
+    unsetenv GCC_EXEC_PREFIX
72e591
+  }
72e591
+}
72e591
+
72e591
+#######################################
72e591
 # proc restore_ld_library_path_env_vars { }
72e591
 #######################################
72e591
 
72e591
@@ -175,21 +201,15 @@ proc restore_ld_library_path_env_vars {
72e591
   global orig_ld_library_path_32_saved
72e591
   global orig_ld_library_path_64_saved
72e591
   global orig_dyld_library_path_saved
72e591
-  global orig_gcc_exec_prefix_saved
72e591
   global orig_ld_library_path
72e591
   global orig_ld_run_path
72e591
   global orig_shlib_path
72e591
   global orig_ld_library_path_32
72e591
   global orig_ld_library_path_64
72e591
   global orig_dyld_library_path
72e591
-  global orig_gcc_exec_prefix
72e591
   global env
72e591
 
72e591
-  if { $orig_gcc_exec_prefix_saved } {
72e591
-    setenv GCC_EXEC_PREFIX "$orig_gcc_exec_prefix"
72e591
-  } elseif [info exists env(GCC_EXEC_PREFIX)] {
72e591
-    unsetenv GCC_EXEC_PREFIX
72e591
-  }
72e591
+  restore_gcc_exec_prefix_env_var
72e591
 
72e591
   if { $orig_environment_saved == 0 } {
72e591
     return
72e591
--- gcc/testsuite/lib/c-compat.exp.jj	2014-01-03 11:40:40.000000000 +0100
72e591
+++ gcc/testsuite/lib/c-compat.exp	2014-05-29 19:33:15.870952346 +0200
72e591
@@ -28,6 +28,7 @@ global compat_skip_list
72e591
 # compilers for compatibility tests.
72e591
 
72e591
 load_lib target-supports.exp
72e591
+load_lib target-libpath.exp
72e591
 
72e591
 #
72e591
 # compat-use-alt-compiler -- make the alternate compiler the default
72e591
@@ -47,6 +48,7 @@ proc compat-use-alt-compiler { } {
72e591
 	if { $compat_alt_color == 0 } then {
72e591
 	    regsub -- "-fdiagnostics-color=never" $TEST_ALWAYS_FLAGS "" TEST_ALWAYS_FLAGS
72e591
 	}
72e591
+	restore_gcc_exec_prefix_env_var
72e591
     }
72e591
 }
72e591
 
72e591
@@ -64,6 +66,7 @@ proc compat-use-tst-compiler { } {
72e591
     if { $compat_same_alt == 0 } then {
72e591
 	set GCC_UNDER_TEST $compat_save_gcc_under_test
72e591
 	set TEST_ALWAYS_FLAGS $compat_save_TEST_ALWAYS_FLAGS
72e591
+	set_gcc_exec_prefix_env_var
72e591
     }
72e591
 }
72e591
 
72e591
--- gcc/testsuite/g++.dg/compat/compat.exp.jj	2014-01-03 11:40:43.000000000 +0100
72e591
+++ gcc/testsuite/g++.dg/compat/compat.exp	2014-05-29 19:28:57.227272946 +0200
72e591
@@ -55,6 +55,7 @@ proc compat-use-alt-compiler { } {
72e591
 	set ALWAYS_CXXFLAGS ""
72e591
 	set ld_library_path $alt_ld_library_path
72e591
 	set_ld_library_path_env_vars
72e591
+	restore_gcc_exec_prefix_env_var
72e591
     }
72e591
 }
72e591
 
72e591
--- gcc/testsuite/g++.dg/compat/struct-layout-1.exp.jj	2014-01-03 11:40:43.000000000 +0100
72e591
+++ gcc/testsuite/g++.dg/compat/struct-layout-1.exp	2014-05-29 19:29:58.050962141 +0200
72e591
@@ -60,6 +60,7 @@ proc compat-use-alt-compiler { } {
72e591
 	set ALWAYS_CXXFLAGS ""
72e591
 	set ld_library_path $alt_ld_library_path
72e591
 	set_ld_library_path_env_vars
72e591
+	restore_gcc_exec_prefix_env_var
72e591
     }
72e591
 }
72e591