public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Make tests failing with version namespace UNSUPPORTED
@ 2017-09-27 20:40 François Dumont
  2017-10-23 20:09 ` François Dumont
  0 siblings, 1 reply; 3+ messages in thread
From: François Dumont @ 2017-09-27 20:40 UTC (permalink / raw)
  To: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1727 bytes --]

Hi

     I would like to propose to add a new dg-require-normal-namespace 
attribute to make several tests failing when version namespace is active 
UNSUPPORTED. It is like dg-require-normal-mode but also consider when 
version namespace is being used.

     I still need to complete execution of all tests with version 
namespace but I think that all tests will be ok then.

     I have also updated the code used for dg-require-normal-mode to 
include c++config.h in case users are changing this file to activate any 
mode.

     * testsuite/lib/libstdc++.exp ([check_v3_target_normal_namespace]): 
New.
     * testsuite/lib/dg-options.exp ([dg-require-normal-namespace]): New,
     use latter.
     * testsuite/23_containers/headers/bitset/synopsis.cc: Replace
     dg-require-normal-mode with latter.
     * testsuite/23_containers/headers/deque/synopsis.cc: Likewise.
     * testsuite/23_containers/headers/forward_list/synopsis.cc: Likewise.
     * testsuite/23_containers/headers/list/synopsis.cc: Likewise.
     * testsuite/23_containers/headers/map/synopsis.cc: Likewise.
     * testsuite/23_containers/headers/set/synopsis.cc: Likewise.
     * testsuite/23_containers/headers/vector/synopsis.cc: Likewise.
     * testsuite/23_containers/map/modifiers/erase/abi_tag.cc: Likewise.
     * testsuite/23_containers/multimap/modifiers/erase/abi_tag.cc: 
Likewise.
     * testsuite/23_containers/multiset/modifiers/erase/abi_tag.cc: 
Likewise.
     * testsuite/23_containers/set/modifiers/erase/abi_tag.cc: Likewise.

     Ok to commit ?

François



[-- Attachment #2: dg-require-normal-namespace.patch --]
[-- Type: text/x-patch, Size: 8930 bytes --]

diff --git a/libstdc++-v3/testsuite/23_containers/headers/bitset/synopsis.cc b/libstdc++-v3/testsuite/23_containers/headers/bitset/synopsis.cc
index 6ef085a..8b3967c 100644
--- a/libstdc++-v3/testsuite/23_containers/headers/bitset/synopsis.cc
+++ b/libstdc++-v3/testsuite/23_containers/headers/bitset/synopsis.cc
@@ -1,5 +1,5 @@
 // { dg-do compile }
-// { dg-require-normal-mode "" }
+// { dg-require-normal-namespace "" }
 
 // Copyright (C) 2007-2017 Free Software Foundation, Inc.
 //
diff --git a/libstdc++-v3/testsuite/23_containers/headers/deque/synopsis.cc b/libstdc++-v3/testsuite/23_containers/headers/deque/synopsis.cc
index aa2b787..0de29c2 100644
--- a/libstdc++-v3/testsuite/23_containers/headers/deque/synopsis.cc
+++ b/libstdc++-v3/testsuite/23_containers/headers/deque/synopsis.cc
@@ -1,5 +1,5 @@
 // { dg-do compile }
-// { dg-require-normal-mode "" }
+// { dg-require-normal-namespace "" }
 
 // Copyright (C) 2007-2017 Free Software Foundation, Inc.
 //
diff --git a/libstdc++-v3/testsuite/23_containers/headers/forward_list/synopsis.cc b/libstdc++-v3/testsuite/23_containers/headers/forward_list/synopsis.cc
index b1792ce..21e79c4 100644
--- a/libstdc++-v3/testsuite/23_containers/headers/forward_list/synopsis.cc
+++ b/libstdc++-v3/testsuite/23_containers/headers/forward_list/synopsis.cc
@@ -1,5 +1,5 @@
 // { dg-do compile { target c++11 } }
-// { dg-require-normal-mode "" }
+// { dg-require-normal-namespace "" }
 
 // Copyright (C) 2008-2017 Free Software Foundation, Inc.
 //
diff --git a/libstdc++-v3/testsuite/23_containers/headers/list/synopsis.cc b/libstdc++-v3/testsuite/23_containers/headers/list/synopsis.cc
index ab22b9f..e8c61aa 100644
--- a/libstdc++-v3/testsuite/23_containers/headers/list/synopsis.cc
+++ b/libstdc++-v3/testsuite/23_containers/headers/list/synopsis.cc
@@ -1,5 +1,5 @@
 // { dg-do compile }
-// { dg-require-normal-mode "" }
+// { dg-require-normal-namespace "" }
 
 // Copyright (C) 2007-2017 Free Software Foundation, Inc.
 //
diff --git a/libstdc++-v3/testsuite/23_containers/headers/map/synopsis.cc b/libstdc++-v3/testsuite/23_containers/headers/map/synopsis.cc
index f4a0826..d74fca1 100644
--- a/libstdc++-v3/testsuite/23_containers/headers/map/synopsis.cc
+++ b/libstdc++-v3/testsuite/23_containers/headers/map/synopsis.cc
@@ -1,5 +1,5 @@
 // { dg-do compile }
-// { dg-require-normal-mode "" }
+// { dg-require-normal-namespace "" }
 
 // Copyright (C) 2007-2017 Free Software Foundation, Inc.
 //
diff --git a/libstdc++-v3/testsuite/23_containers/headers/set/synopsis.cc b/libstdc++-v3/testsuite/23_containers/headers/set/synopsis.cc
index e50a044..58e94bc 100644
--- a/libstdc++-v3/testsuite/23_containers/headers/set/synopsis.cc
+++ b/libstdc++-v3/testsuite/23_containers/headers/set/synopsis.cc
@@ -1,5 +1,5 @@
 // { dg-do compile }
-// { dg-require-normal-mode "" }
+// { dg-require-normal-namespace "" }
 
 // Copyright (C) 2007-2017 Free Software Foundation, Inc.
 //
diff --git a/libstdc++-v3/testsuite/23_containers/headers/vector/synopsis.cc b/libstdc++-v3/testsuite/23_containers/headers/vector/synopsis.cc
index c127b5d..47cbe16 100644
--- a/libstdc++-v3/testsuite/23_containers/headers/vector/synopsis.cc
+++ b/libstdc++-v3/testsuite/23_containers/headers/vector/synopsis.cc
@@ -1,5 +1,5 @@
 // { dg-do compile }
-// { dg-require-normal-mode "" }
+// { dg-require-normal-namespace "" }
 
 // Copyright (C) 2007-2017 Free Software Foundation, Inc.
 //
diff --git a/libstdc++-v3/testsuite/23_containers/map/modifiers/erase/abi_tag.cc b/libstdc++-v3/testsuite/23_containers/map/modifiers/erase/abi_tag.cc
index deec016..acf06b1 100644
--- a/libstdc++-v3/testsuite/23_containers/map/modifiers/erase/abi_tag.cc
+++ b/libstdc++-v3/testsuite/23_containers/map/modifiers/erase/abi_tag.cc
@@ -1,5 +1,5 @@
 // { dg-do compile { target c++11 } }
-// { dg-require-normal-mode "" }
+// { dg-require-normal-namespace "" }
 
 // Copyright (C) 2013-2017 Free Software Foundation, Inc.
 //
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/modifiers/erase/abi_tag.cc b/libstdc++-v3/testsuite/23_containers/multimap/modifiers/erase/abi_tag.cc
index a2152e2..f511a77 100644
--- a/libstdc++-v3/testsuite/23_containers/multimap/modifiers/erase/abi_tag.cc
+++ b/libstdc++-v3/testsuite/23_containers/multimap/modifiers/erase/abi_tag.cc
@@ -1,5 +1,5 @@
 // { dg-do compile { target c++11 } }
-// { dg-require-normal-mode "" }
+// { dg-require-normal-namespace "" }
 
 // Copyright (C) 2013-2017 Free Software Foundation, Inc.
 //
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/modifiers/erase/abi_tag.cc b/libstdc++-v3/testsuite/23_containers/multiset/modifiers/erase/abi_tag.cc
index a7b1584..ef2bd2c 100644
--- a/libstdc++-v3/testsuite/23_containers/multiset/modifiers/erase/abi_tag.cc
+++ b/libstdc++-v3/testsuite/23_containers/multiset/modifiers/erase/abi_tag.cc
@@ -1,5 +1,5 @@
 // { dg-do compile { target c++11 } }
-// { dg-require-normal-mode "" }
+// { dg-require-normal-namespace "" }
 
 // Copyright (C) 2013-2017 Free Software Foundation, Inc.
 //
diff --git a/libstdc++-v3/testsuite/23_containers/set/modifiers/erase/abi_tag.cc b/libstdc++-v3/testsuite/23_containers/set/modifiers/erase/abi_tag.cc
index f3ecc14..9fa3f1bc 100644
--- a/libstdc++-v3/testsuite/23_containers/set/modifiers/erase/abi_tag.cc
+++ b/libstdc++-v3/testsuite/23_containers/set/modifiers/erase/abi_tag.cc
@@ -1,5 +1,5 @@
 // { dg-do compile { target c++11 } }
-// { dg-require-normal-mode "" }
+// { dg-require-normal-namespace "" }
 
 // Copyright (C) 2013-2017 Free Software Foundation, Inc.
 //
diff --git a/libstdc++-v3/testsuite/lib/dg-options.exp b/libstdc++-v3/testsuite/lib/dg-options.exp
index a276001..4de6bcc 100644
--- a/libstdc++-v3/testsuite/lib/dg-options.exp
+++ b/libstdc++-v3/testsuite/lib/dg-options.exp
@@ -61,6 +61,15 @@ proc dg-require-normal-mode { args } {
     return
 }
 
+proc dg-require-normal-namespace { args } {
+    if { ![ check_v3_target_normal_namespace ] } {
+	upvar dg-do-what dg-do-what
+	set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+	return
+    }
+    return
+}
+
 proc dg-require-parallel-mode { args } {
     if { ![ check_v3_target_parallel_mode ] } {
 	upvar dg-do-what dg-do-what
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp
index d530403..659964a 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -1114,7 +1114,7 @@ proc check_v3_target_versionnamespace_mode { } {
 
 proc check_v3_target_normal_mode { } {
     global et_normal_mode
-    global tool	
+    global tool
 
     if { ![info exists et_normal_mode_target_name] } {
 	set et_normal_mode_target_name ""
@@ -1141,7 +1141,10 @@ proc check_v3_target_normal_mode { } {
 	set src normal_mode[pid].cc
 
 	set f [open $src "w"]
-	puts $f "#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PROFILE) || defined(_GLIBCXX_PARALLEL)"
+	puts $f "#include <bits/c++config.h>"
+	puts $f "#if defined(_GLIBCXX_DEBUG) || \\"
+	puts $f "    defined(_GLIBCXX_PROFILE) || \\"
+	puts $f "    defined(_GLIBCXX_PARALLEL)"
 	puts $f "#  error No normal mode"
 	puts $f "#endif"
 	close $f
@@ -1158,6 +1161,56 @@ proc check_v3_target_normal_mode { } {
     return $et_normal_mode
 }
 
+proc check_v3_target_normal_namespace { } {
+    global et_normal_namespace
+    global tool
+
+    if { ![info exists et_normal_namespace_target_name] } {
+	set et_normal_namespace_target_name ""
+    }
+
+    # If the target has changed since we set the cached value, clear it.
+    set current_target [current_target_name]
+    if { $current_target != $et_normal_namespace_target_name } {
+	verbose "check_v3_target_normal_namespace: `$et_normal_namespace_target_name'" 2
+	set et_normal_namespace_target_name $current_target
+	if [info exists et_normal_namespace] {
+	    verbose "check_v3_target_normal_namespace: removing cached result" 2
+	    unset et_normal_namespace
+	}
+    }
+
+    if [info exists et_normal_namespace] {
+	verbose "check_v3_target_normal_namespace: using cached result" 2
+    } else {
+	set et_normal_namespace 0
+
+	# Set up and compile a C++ test program that depends
+	# on normal std namespace.
+	set src normal_namespace[pid].cc
+
+	set f [open $src "w"]
+	puts $f "#include <bits/c++config.h>"
+	puts $f "#if defined(_GLIBCXX_DEBUG) || \\"
+	puts $f "    defined(_GLIBCXX_PROFILE) || \\"
+	puts $f "    defined(_GLIBCXX_PARALLEL) || \\"
+	puts $f "    _GLIBCXX_INLINE_VERSION"
+	puts $f "#  error No normal namespace"
+	puts $f "#endif"
+	close $f
+
+	set lines [v3_target_compile $src /dev/null preprocess ""]
+	file delete $src
+
+	if [string match "" $lines] {
+	    # No error message, compilation succeeded.
+	    set et_normal_namespace 1
+	}
+    }
+    verbose "check_v3_target_normal_namespace: $et_normal_namespace" 2
+    return $et_normal_namespace
+}
+
 proc check_v3_target_parallel_mode { } {
     global cxxflags
     global v3-libgomp

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-10-23 22:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-27 20:40 Make tests failing with version namespace UNSUPPORTED François Dumont
2017-10-23 20:09 ` François Dumont
2017-10-23 22:19   ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).