[testsuite] Clean up effective_target cache.
authorChristophe Lyon <christophe.lyon@linaro.org>
Wed, 2 Sep 2015 14:01:51 +0000 (14:01 +0000)
committerChristophe Lyon <clyon@gcc.gnu.org>
Wed, 2 Sep 2015 14:01:51 +0000 (16:01 +0200)
2015-09-02  Christophe Lyon  <christophe.lyon@linaro.org>

* lib/target-supports.exp (clear_effective_target_cache): New.
(check_cached_effective_target): Update et_prop_list.
* lib/asan-dg.exp (asan_finish): Call clear_effective_target_cache.
* g++.dg/compat/compat.exp: Likewise.
* g++.dg/compat/struct-layout-1.exp: Likewise.
* lib/asan-dg.exp: Likewise.
* lib/atomic-dg.exp: Likewise.
* lib/cilk-plus-dg.exp: Likewise.
* lib/clearcap.exp: Likewise.
* lib/mpx-dg.exp: Likewise.
* lib/tsan-dg.exp: Likewise.
* lib/ubsan-dg.exp: Likewise.

From-SVN: r227401

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/compat/compat.exp
gcc/testsuite/g++.dg/compat/struct-layout-1.exp
gcc/testsuite/lib/asan-dg.exp
gcc/testsuite/lib/atomic-dg.exp
gcc/testsuite/lib/cilk-plus-dg.exp
gcc/testsuite/lib/clearcap.exp
gcc/testsuite/lib/mpx-dg.exp
gcc/testsuite/lib/target-supports.exp
gcc/testsuite/lib/tsan-dg.exp
gcc/testsuite/lib/ubsan-dg.exp

index 1e4de51f671b90563ae16ce607ea3b3437dfc58f..8c7175f402963292cd4efd59d97a8039b6e3eda6 100644 (file)
@@ -1,3 +1,18 @@
+2015-09-02  Christophe Lyon  <christophe.lyon@linaro.org>
+
+       * lib/target-supports.exp (clear_effective_target_cache): New.
+       (check_cached_effective_target): Update et_prop_list.
+       * lib/asan-dg.exp (asan_finish): Call clear_effective_target_cache.
+       * g++.dg/compat/compat.exp: Likewise.
+       * g++.dg/compat/struct-layout-1.exp: Likewise.
+       * lib/asan-dg.exp: Likewise.
+       * lib/atomic-dg.exp: Likewise.
+       * lib/cilk-plus-dg.exp: Likewise.
+       * lib/clearcap.exp: Likewise.
+       * lib/mpx-dg.exp: Likewise.
+       * lib/tsan-dg.exp: Likewise.
+       * lib/ubsan-dg.exp: Likewise.
+
 2015-09-01  Kenneth Zadeck <zadeck@naturalbridge.com>
         * gcc.c-torture/execute/ieee/20000320-1.c Fixed misplaced test case.
 
index 12722890c7615935d4478e57c67cbd39e42445a6..4c4b25f7e64a2dcb4bf1b325ad4e51e36699a721 100644 (file)
@@ -78,6 +78,7 @@ proc compat-use-tst-compiler { } {
        set ALWAYS_CXXFLAGS $save_always_cxxflags
        set ld_library_path $save_ld_library_path
        set_ld_library_path_env_vars
+       clear_effective_target_cache
     }
 }
 
index 7777d98a3cee762358e728054e4d096adce92997..097a731a6719656a9e9cd39680e60d61e8bff709 100644 (file)
@@ -61,6 +61,7 @@ proc compat-use-alt-compiler { } {
        set ld_library_path $alt_ld_library_path
        set_ld_library_path_env_vars
        restore_gcc_exec_prefix_env_var
+       clear_effective_target_cache
     }
 }
 
index 141a4791f87c13186086130e044f7848592c9ddc..3ce264e21a33d6abdd1b684c8a3916e1ca04f700 100644 (file)
@@ -138,6 +138,7 @@ proc asan_finish { args } {
     }
     set ld_library_path $asan_saved_library_path
     set_ld_library_path_env_vars
+    clear_effective_target_cache
 }
 
 # Symbolize lines like
index d9df227d803f7513cc5148c6766ab1e2d3d5d58d..fe24127ac84ca39d37cffbe0cbc5ed71ba450cf3 100644 (file)
@@ -101,4 +101,5 @@ proc atomic_finish { args } {
     } else {
        unset TEST_ALWAYS_FLAGS
     }
+    clear_effective_target_cache
 }
index 38e5400c1342f15ae6198e5f789865afc12abaf2..7f38f37f59f4c3b1449866c24c47a33655daa982 100644 (file)
@@ -101,4 +101,5 @@ proc cilkplus_finish { args } {
     } else {
        unset TEST_ALWAYS_FLAGS
     }
+    clear_effective_target_cache
 }
index d41aa1ed9dc56451ca8519949cb392b541fd7701..3e2a88c8ba25c2c91bc083389066a93d1cbd72d6 100644 (file)
@@ -55,4 +55,5 @@ proc clearcap-finish { args } {
     } else {
        unset TEST_ALWAYS_FLAGS
     }
+    clear_effective_target_cache
 }
index c8f64cddd271c45def490d6134a38ae882913eee..b2bd40c2802f406441587ce0e9d6fe7112d37459 100644 (file)
@@ -142,4 +142,5 @@ proc mpx_finish { args } {
     }
     set ld_library_path $mpx_saved_library_path
     set_ld_library_path_env_vars
+    clear_effective_target_cache
 }
index 363f7fe3877303ba59ee77a37c32ae6214efc876..3f54729f5a73a2d0001b03c9645b992268038282 100644 (file)
@@ -117,6 +117,7 @@ proc current_target_name { } {
 
 proc check_cached_effective_target { prop args } {
     global et_cache
+    global et_prop_list
 
     set target [current_target_name]
     if {![info exists et_cache($prop,target)]
@@ -124,12 +125,37 @@ proc check_cached_effective_target { prop args } {
        verbose "check_cached_effective_target $prop: checking $target" 2
        set et_cache($prop,target) $target
        set et_cache($prop,value) [uplevel eval $args]
+       lappend et_prop_list $prop
+       verbose "check_cached_effective_target cached list is now: $et_prop_list" 2
     }
     set value $et_cache($prop,value)
     verbose "check_cached_effective_target $prop: returning $value for $target" 2
     return $value
 }
 
+# Clear effective-target cache. This is useful after testing
+# effective-target features and overriding TEST_ALWAYS_FLAGS and/or
+# ALWAYS_CXXFLAGS.
+# If one changes ALWAYS_CXXFLAGS or TEST_ALWAYS_FLAGS then they should
+# do a clear_effective_target_cache at the end as the target cache can
+# make decisions based upon the flags, and those decisions need to be
+# redone when the flags change. An example of this is the
+# asan_init/asan_finish pair.
+
+proc clear_effective_target_cache { } {
+    global et_cache
+    global et_prop_list
+
+    if {[info exists et_prop_list]} {
+       verbose "clear_effective_target_cache: $et_prop_list" 2
+       foreach prop $et_prop_list {
+           unset et_cache($prop,value)
+           unset et_cache($prop,target)
+       }
+       unset et_prop_list
+    }
+}
+
 # Like check_compile, but delete the output file and return true if the
 # compiler printed no messages.
 proc check_no_compiler_messages_nocache {args} {
index eb528f8513e392b3a21eca180f422287a24167a2..ff51fdf34f914fed8959e703164603dfd4749f22 100644 (file)
@@ -149,4 +149,5 @@ proc tsan_finish { args } {
     }
     set ld_library_path $tsan_saved_library_path
     set_ld_library_path_env_vars
+    clear_effective_target_cache
 }
index 81934bb2961c861e67713a93478e6cc229147141..65799db0d93fe883e8752afcc12c80dd333bf275 100644 (file)
@@ -121,4 +121,5 @@ proc ubsan_finish { args } {
     }
     set ld_library_path $ubsan_saved_library_path
     set_ld_library_path_env_vars
+    clear_effective_target_cache
 }