public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aoliva/heads/testme)] Add dg-require-wchars to libstdc++ testsuite
@ 2021-01-01 5:22 Alexandre Oliva
0 siblings, 0 replies; 4+ messages in thread
From: Alexandre Oliva @ 2021-01-01 5:22 UTC (permalink / raw)
To: gcc-cvs, libstdc++-cvs
https://gcc.gnu.org/g:78ea1de07c316c71d0a5ad9fb2a9d1e7f31bea65
commit 78ea1de07c316c71d0a5ad9fb2a9d1e7f31bea65
Author: Corentin Gay <gay@adacore.com>
Date: Thu Dec 31 21:37:28 2020 -0300
Add dg-require-wchars to libstdc++ testsuite
Some tests uses structures from the libstdc++ that are present only if
the target has a wchar.h header. However, those tests do not check
that the target supports those constructs before executing the tests.
The function dg-require-wchars checks that "_GLIBCXX_USE_WCHAR_T" is
defined by the configure of the libstdc++. If it is not the case, the
test is not executed.
for libstdc++-v3/ChangeLog
* testsuite/lib/dg-options.exp: Add dg-require-wchars
function.
* testsuite/lib/libstdc++.exp: Add check_v3_target_wchars
function.
* testsuite/22_locale/codecvt/codecvt_utf16/79980.cc: Add
requirement.
* testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc:
Likewise.
* testsuite/22_locale/codecvt/codecvt_utf8/79980.cc: Likewise.
* testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc:
Likewise.
* testsuite/22_locale/conversions/buffer/1.cc: Likewise.
* testsuite/22_locale/conversions/buffer/2.cc: Likewise.
* testsuite/22_locale/conversions/buffer/3.cc: Likewise.
* testsuite/22_locale/conversions/buffer/requirements/typedefs.cc:
Likewise.
* testsuite/22_locale/conversions/string/1.cc: Likewise.
* testsuite/22_locale/conversions/string/2.cc: Likewise.
* testsuite/22_locale/conversions/string/3.cc: Likewise.
* testsuite/22_locale/conversions/string/66441.cc: Likewise.
* testsuite/22_locale/conversions/string/requirements/typedefs.cc:
Likewise.
* testsuite/22_locale/conversions/string/requirements/typedefs-2.cc:
Likewise.
Diff:
---
.../22_locale/codecvt/codecvt_utf16/79980.cc | 1 +
.../22_locale/codecvt/codecvt_utf16/misaligned.cc | 1 +
.../22_locale/codecvt/codecvt_utf8/79980.cc | 1 +
.../22_locale/codecvt/codecvt_utf8_utf16/79511.cc | 1 +
.../testsuite/22_locale/conversions/buffer/1.cc | 1 +
.../testsuite/22_locale/conversions/buffer/2.cc | 1 +
.../testsuite/22_locale/conversions/buffer/3.cc | 1 +
.../conversions/buffer/requirements/typedefs.cc | 1 +
.../testsuite/22_locale/conversions/string/1.cc | 1 +
.../testsuite/22_locale/conversions/string/2.cc | 1 +
.../testsuite/22_locale/conversions/string/3.cc | 1 +
.../22_locale/conversions/string/66441.cc | 1 +
.../conversions/string/requirements/typedefs-2.cc | 1 +
.../conversions/string/requirements/typedefs.cc | 1 +
libstdc++-v3/testsuite/lib/dg-options.exp | 9 +++++
libstdc++-v3/testsuite/lib/libstdc++.exp | 47 ++++++++++++++++++++++
16 files changed, 70 insertions(+)
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc
index 8a092913a4c..039bdd03229 100644
--- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
#include <locale>
#include <codecvt>
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc
index 04cfc8d744b..3496e0e819e 100644
--- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
#include <locale>
#include <codecvt>
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc
index 68ae5af234a..fd69dd5c04d 100644
--- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
#include <codecvt>
#include <locale>
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc
index 1f63e7218e7..590a3b73bfc 100644
--- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
#include <locale>
#include <codecvt>
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc
index 2855f7432d4..91bf2bf2216 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc
@@ -1,4 +1,5 @@
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/2.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/2.cc
index 2cf320fc13c..a03a16a02ed 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/2.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/2.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
#include <locale>
#include <sstream>
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc
index de43e0a95b2..84d5358f499 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
#include <locale>
#include <streambuf>
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/requirements/typedefs.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/requirements/typedefs.cc
index e88799dbec7..8efe203e873 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/requirements/typedefs.cc
@@ -1,4 +1,5 @@
// { dg-do compile { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc
index 41d6594fe13..d491e6c5270 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc
@@ -1,4 +1,5 @@
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc
index bc26e328a60..b4867053f3c 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc
@@ -1,4 +1,5 @@
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/3.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/3.cc
index b7793cdca49..023897c9307 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/string/3.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/string/3.cc
@@ -1,4 +1,5 @@
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/66441.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/66441.cc
index 07136aec117..b78c31fbb9b 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/string/66441.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/string/66441.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
// libstdc++/66441
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs-2.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs-2.cc
index 91b47c449a1..4cd254a40da 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs-2.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs-2.cc
@@ -1,4 +1,5 @@
// { dg-do compile { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs.cc
index 023caa69a6e..30e49b2ff89 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs.cc
@@ -1,4 +1,5 @@
// { dg-do compile { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/lib/dg-options.exp b/libstdc++-v3/testsuite/lib/dg-options.exp
index 0102acf65a2..17306a0eb02 100644
--- a/libstdc++-v3/testsuite/lib/dg-options.exp
+++ b/libstdc++-v3/testsuite/lib/dg-options.exp
@@ -16,6 +16,15 @@
# along with this program; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
+proc dg-require-wchars { args } {
+ if { ![ check_v3_target_wchars ] } {
+ upvar dg-do-what dg-do-what
+ set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+ return
+ }
+ return
+}
+
proc dg-require-c-std { args } {
if { ![ check_v3_target_c_std ] } {
upvar dg-do-what dg-do-what
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp
index 6e5634ef1d2..7981b65e0b7 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -702,6 +702,53 @@ proc v3-build_support { } {
}
}
+proc check_v3_target_wchars { } {
+ global et_wchars
+ global et_wchars_target_name
+ global tool
+
+ if { ![info exists et_wchars_target_name] } {
+ set et_wchars_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_wchars_target_name } {
+ verbose "check_v3_target_wchars: `$et_wchars_target_name'" 2
+ set et_wchars_target_name $current_target
+ if [info exists et_wchars] {
+ verbose "check_v3_target_wchars: removing cached result" 2
+ unset et_wchars
+ }
+ }
+
+ if [info exists et_wchars] {
+ verbose "check_v3_target_wchars: using cached result" 2
+ } else {
+ set et_wchars 0
+
+ # Set up and preprocess a C++ test program that depends
+ # on wchars support being configured in the libstdc++.
+ set src wchars[pid].cc
+
+ set f [open $src "w"]
+ puts $f "#ifndef _GLIBCXX_USE_WCHAR_T"
+ puts $f "# error No wchar header."
+ puts $f "#endif"
+ close $f
+
+ set lines [v3_target_compile $src /dev/null preprocess ""]
+ file delete $src
+
+ if [string match "" $lines] {
+ # No error message, preprocessing succeeded.
+ set et_wchars 1
+ }
+ }
+ verbose "check_v3_target_wchars: $et_wchars" 2
+ return $et_wchars
+}
+
# Implement an target check for property PROP by invoking
# the Tcl command ARGS and seeing if it returns true.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] Add dg-require-wchars to libstdc++ testsuite
@ 2021-01-01 1:29 Alexandre Oliva
0 siblings, 0 replies; 4+ messages in thread
From: Alexandre Oliva @ 2021-01-01 1:29 UTC (permalink / raw)
To: gcc-cvs, libstdc++-cvs
https://gcc.gnu.org/g:293aafb2ad476312d2c446d3264e7c4146b16203
commit 293aafb2ad476312d2c446d3264e7c4146b16203
Author: Corentin Gay <gay@adacore.com>
Date: Thu Dec 31 21:37:28 2020 -0300
Add dg-require-wchars to libstdc++ testsuite
Some tests uses structures from the libstdc++ that are present only if
the target has a wchar.h header. However, those tests do not check
that the target supports those constructs before executing the tests.
The function dg-require-wchars checks that "_GLIBCXX_USE_WCHAR_T" is
defined by the configure of the libstdc++. If it is not the case, the
test is not executed.
for libstdc++-v3/ChangeLog
* testsuite/lib/dg-options.exp: Add dg-require-wchars
function.
* testsuite/lib/libstdc++.exp: Add check_v3_target_wchars
function.
* testsuite/22_locale/codecvt/codecvt_utf16/79980.cc: Add
requirement.
* testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc:
Likewise.
* testsuite/22_locale/codecvt/codecvt_utf8/79980.cc: Likewise.
* testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc:
Likewise.
* testsuite/22_locale/conversions/buffer/1.cc: Likewise.
* testsuite/22_locale/conversions/buffer/2.cc: Likewise.
* testsuite/22_locale/conversions/buffer/3.cc: Likewise.
* testsuite/22_locale/conversions/buffer/requirements/typedefs.cc:
Likewise.
* testsuite/22_locale/conversions/string/1.cc: Likewise.
* testsuite/22_locale/conversions/string/2.cc: Likewise.
* testsuite/22_locale/conversions/string/3.cc: Likewise.
* testsuite/22_locale/conversions/string/66441.cc: Likewise.
* testsuite/22_locale/conversions/string/requirements/typedefs.cc:
Likewise.
* testsuite/22_locale/conversions/string/requirements/typedefs-2.cc:
Likewise.
Diff:
---
.../22_locale/codecvt/codecvt_utf16/79980.cc | 1 +
.../22_locale/codecvt/codecvt_utf16/misaligned.cc | 1 +
.../22_locale/codecvt/codecvt_utf8/79980.cc | 1 +
.../22_locale/codecvt/codecvt_utf8_utf16/79511.cc | 1 +
.../testsuite/22_locale/conversions/buffer/1.cc | 1 +
.../testsuite/22_locale/conversions/buffer/2.cc | 1 +
.../testsuite/22_locale/conversions/buffer/3.cc | 1 +
.../conversions/buffer/requirements/typedefs.cc | 1 +
.../testsuite/22_locale/conversions/string/1.cc | 1 +
.../testsuite/22_locale/conversions/string/2.cc | 1 +
.../testsuite/22_locale/conversions/string/3.cc | 1 +
.../22_locale/conversions/string/66441.cc | 1 +
.../conversions/string/requirements/typedefs-2.cc | 1 +
.../conversions/string/requirements/typedefs.cc | 1 +
libstdc++-v3/testsuite/lib/dg-options.exp | 9 +++++
libstdc++-v3/testsuite/lib/libstdc++.exp | 47 ++++++++++++++++++++++
16 files changed, 70 insertions(+)
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc
index 8a092913a4c..039bdd03229 100644
--- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
#include <locale>
#include <codecvt>
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc
index 04cfc8d744b..3496e0e819e 100644
--- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
#include <locale>
#include <codecvt>
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc
index 68ae5af234a..fd69dd5c04d 100644
--- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
#include <codecvt>
#include <locale>
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc
index 1f63e7218e7..590a3b73bfc 100644
--- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
#include <locale>
#include <codecvt>
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc
index 2855f7432d4..91bf2bf2216 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc
@@ -1,4 +1,5 @@
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/2.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/2.cc
index 2cf320fc13c..a03a16a02ed 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/2.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/2.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
#include <locale>
#include <sstream>
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc
index de43e0a95b2..84d5358f499 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
#include <locale>
#include <streambuf>
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/requirements/typedefs.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/requirements/typedefs.cc
index e88799dbec7..8efe203e873 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/requirements/typedefs.cc
@@ -1,4 +1,5 @@
// { dg-do compile { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc
index 41d6594fe13..d491e6c5270 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc
@@ -1,4 +1,5 @@
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc
index bc26e328a60..b4867053f3c 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc
@@ -1,4 +1,5 @@
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/3.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/3.cc
index b7793cdca49..023897c9307 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/string/3.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/string/3.cc
@@ -1,4 +1,5 @@
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/66441.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/66441.cc
index 07136aec117..b78c31fbb9b 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/string/66441.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/string/66441.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
// libstdc++/66441
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs-2.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs-2.cc
index 91b47c449a1..4cd254a40da 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs-2.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs-2.cc
@@ -1,4 +1,5 @@
// { dg-do compile { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs.cc
index 023caa69a6e..30e49b2ff89 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs.cc
@@ -1,4 +1,5 @@
// { dg-do compile { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/lib/dg-options.exp b/libstdc++-v3/testsuite/lib/dg-options.exp
index 0102acf65a2..17306a0eb02 100644
--- a/libstdc++-v3/testsuite/lib/dg-options.exp
+++ b/libstdc++-v3/testsuite/lib/dg-options.exp
@@ -16,6 +16,15 @@
# along with this program; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
+proc dg-require-wchars { args } {
+ if { ![ check_v3_target_wchars ] } {
+ upvar dg-do-what dg-do-what
+ set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+ return
+ }
+ return
+}
+
proc dg-require-c-std { args } {
if { ![ check_v3_target_c_std ] } {
upvar dg-do-what dg-do-what
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp
index 6e5634ef1d2..7981b65e0b7 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -702,6 +702,53 @@ proc v3-build_support { } {
}
}
+proc check_v3_target_wchars { } {
+ global et_wchars
+ global et_wchars_target_name
+ global tool
+
+ if { ![info exists et_wchars_target_name] } {
+ set et_wchars_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_wchars_target_name } {
+ verbose "check_v3_target_wchars: `$et_wchars_target_name'" 2
+ set et_wchars_target_name $current_target
+ if [info exists et_wchars] {
+ verbose "check_v3_target_wchars: removing cached result" 2
+ unset et_wchars
+ }
+ }
+
+ if [info exists et_wchars] {
+ verbose "check_v3_target_wchars: using cached result" 2
+ } else {
+ set et_wchars 0
+
+ # Set up and preprocess a C++ test program that depends
+ # on wchars support being configured in the libstdc++.
+ set src wchars[pid].cc
+
+ set f [open $src "w"]
+ puts $f "#ifndef _GLIBCXX_USE_WCHAR_T"
+ puts $f "# error No wchar header."
+ puts $f "#endif"
+ close $f
+
+ set lines [v3_target_compile $src /dev/null preprocess ""]
+ file delete $src
+
+ if [string match "" $lines] {
+ # No error message, preprocessing succeeded.
+ set et_wchars 1
+ }
+ }
+ verbose "check_v3_target_wchars: $et_wchars" 2
+ return $et_wchars
+}
+
# Implement an target check for property PROP by invoking
# the Tcl command ARGS and seeing if it returns true.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] Add dg-require-wchars to libstdc++ testsuite
@ 2020-12-25 1:45 Alexandre Oliva
0 siblings, 0 replies; 4+ messages in thread
From: Alexandre Oliva @ 2020-12-25 1:45 UTC (permalink / raw)
To: gcc-cvs, libstdc++-cvs
https://gcc.gnu.org/g:58cf5285801d7943d56c90f2e9116641f9f0784a
commit 58cf5285801d7943d56c90f2e9116641f9f0784a
Author: Corentin Gay <gay@adacore.com>
Date: Thu Dec 24 22:43:03 2020 -0300
Add dg-require-wchars to libstdc++ testsuite
Some tests uses structures from the libstdc++ that are present only if
the target has a wchar.h header. However, those tests do not check
that the target supports those constructs before executing the tests.
The function dg-require-wchars checks that "_GLIBCXX_USE_WCHAR_T" is
defined by the configure of the libstdc++. If it is not the case, the
test is not executed.
for libstdc++-v3/ChangeLog
* testsuite/lib/dg-options.exp: Add dg-require-wchars
function.
* testsuite/lib/libstdc++.exp: Add check_v3_target_wchars
function.
* testsuite/22_locale/codecvt/codecvt_utf16/79980.cc: Add
requirement.
* testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc:
Likewise.
* testsuite/22_locale/codecvt/codecvt_utf8/79980.cc: Likewise.
* testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc:
Likewise.
* testsuite/22_locale/conversions/buffer/1.cc: Likewise.
* testsuite/22_locale/conversions/buffer/2.cc: Likewise.
* testsuite/22_locale/conversions/buffer/3.cc: Likewise.
* testsuite/22_locale/conversions/buffer/requirements/typedefs.cc:
Likewise.
* testsuite/22_locale/conversions/string/1.cc: Likewise.
* testsuite/22_locale/conversions/string/2.cc: Likewise.
* testsuite/22_locale/conversions/string/3.cc: Likewise.
* testsuite/22_locale/conversions/string/66441.cc: Likewise.
* testsuite/22_locale/conversions/string/requirements/typedefs.cc:
Likewise.
* testsuite/22_locale/conversions/string/requirements/typedefs-2.cc:
Likewise.
Diff:
---
.../22_locale/codecvt/codecvt_utf16/79980.cc | 1 +
.../22_locale/codecvt/codecvt_utf16/misaligned.cc | 1 +
.../22_locale/codecvt/codecvt_utf8/79980.cc | 1 +
.../22_locale/codecvt/codecvt_utf8_utf16/79511.cc | 1 +
.../testsuite/22_locale/conversions/buffer/1.cc | 1 +
.../testsuite/22_locale/conversions/buffer/2.cc | 1 +
.../testsuite/22_locale/conversions/buffer/3.cc | 1 +
.../conversions/buffer/requirements/typedefs.cc | 1 +
.../testsuite/22_locale/conversions/string/1.cc | 1 +
.../testsuite/22_locale/conversions/string/2.cc | 1 +
.../testsuite/22_locale/conversions/string/3.cc | 1 +
.../22_locale/conversions/string/66441.cc | 1 +
.../conversions/string/requirements/typedefs-2.cc | 1 +
.../conversions/string/requirements/typedefs.cc | 1 +
libstdc++-v3/testsuite/lib/dg-options.exp | 9 +++++
libstdc++-v3/testsuite/lib/libstdc++.exp | 47 ++++++++++++++++++++++
16 files changed, 70 insertions(+)
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc
index 8a092913a4c..039bdd03229 100644
--- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
#include <locale>
#include <codecvt>
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc
index 04cfc8d744b..3496e0e819e 100644
--- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
#include <locale>
#include <codecvt>
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc
index 68ae5af234a..fd69dd5c04d 100644
--- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
#include <codecvt>
#include <locale>
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc
index 1f63e7218e7..590a3b73bfc 100644
--- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
#include <locale>
#include <codecvt>
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc
index 2855f7432d4..91bf2bf2216 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc
@@ -1,4 +1,5 @@
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/2.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/2.cc
index 2cf320fc13c..a03a16a02ed 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/2.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/2.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
#include <locale>
#include <sstream>
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc
index de43e0a95b2..84d5358f499 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
#include <locale>
#include <streambuf>
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/requirements/typedefs.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/requirements/typedefs.cc
index e88799dbec7..8efe203e873 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/requirements/typedefs.cc
@@ -1,4 +1,5 @@
// { dg-do compile { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc
index 41d6594fe13..d491e6c5270 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc
@@ -1,4 +1,5 @@
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc
index bc26e328a60..b4867053f3c 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc
@@ -1,4 +1,5 @@
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/3.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/3.cc
index b7793cdca49..023897c9307 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/string/3.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/string/3.cc
@@ -1,4 +1,5 @@
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/66441.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/66441.cc
index 07136aec117..b78c31fbb9b 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/string/66441.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/string/66441.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
// libstdc++/66441
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs-2.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs-2.cc
index 91b47c449a1..4cd254a40da 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs-2.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs-2.cc
@@ -1,4 +1,5 @@
// { dg-do compile { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs.cc
index 023caa69a6e..30e49b2ff89 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs.cc
@@ -1,4 +1,5 @@
// { dg-do compile { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/lib/dg-options.exp b/libstdc++-v3/testsuite/lib/dg-options.exp
index 0102acf65a2..17306a0eb02 100644
--- a/libstdc++-v3/testsuite/lib/dg-options.exp
+++ b/libstdc++-v3/testsuite/lib/dg-options.exp
@@ -16,6 +16,15 @@
# along with this program; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
+proc dg-require-wchars { args } {
+ if { ![ check_v3_target_wchars ] } {
+ upvar dg-do-what dg-do-what
+ set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+ return
+ }
+ return
+}
+
proc dg-require-c-std { args } {
if { ![ check_v3_target_c_std ] } {
upvar dg-do-what dg-do-what
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp
index 6e5634ef1d2..7981b65e0b7 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -702,6 +702,53 @@ proc v3-build_support { } {
}
}
+proc check_v3_target_wchars { } {
+ global et_wchars
+ global et_wchars_target_name
+ global tool
+
+ if { ![info exists et_wchars_target_name] } {
+ set et_wchars_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_wchars_target_name } {
+ verbose "check_v3_target_wchars: `$et_wchars_target_name'" 2
+ set et_wchars_target_name $current_target
+ if [info exists et_wchars] {
+ verbose "check_v3_target_wchars: removing cached result" 2
+ unset et_wchars
+ }
+ }
+
+ if [info exists et_wchars] {
+ verbose "check_v3_target_wchars: using cached result" 2
+ } else {
+ set et_wchars 0
+
+ # Set up and preprocess a C++ test program that depends
+ # on wchars support being configured in the libstdc++.
+ set src wchars[pid].cc
+
+ set f [open $src "w"]
+ puts $f "#ifndef _GLIBCXX_USE_WCHAR_T"
+ puts $f "# error No wchar header."
+ puts $f "#endif"
+ close $f
+
+ set lines [v3_target_compile $src /dev/null preprocess ""]
+ file delete $src
+
+ if [string match "" $lines] {
+ # No error message, preprocessing succeeded.
+ set et_wchars 1
+ }
+ }
+ verbose "check_v3_target_wchars: $et_wchars" 2
+ return $et_wchars
+}
+
# Implement an target check for property PROP by invoking
# the Tcl command ARGS and seeing if it returns true.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] Add dg-require-wchars to libstdc++ testsuite
@ 2020-12-18 14:46 Alexandre Oliva
0 siblings, 0 replies; 4+ messages in thread
From: Alexandre Oliva @ 2020-12-18 14:46 UTC (permalink / raw)
To: gcc-cvs, libstdc++-cvs
https://gcc.gnu.org/g:3cf14e818ebcce936aafd149c57252496dc0737e
commit 3cf14e818ebcce936aafd149c57252496dc0737e
Author: Corentin Gay <gay@adacore.com>
Date: Fri Dec 18 11:39:24 2020 -0300
Add dg-require-wchars to libstdc++ testsuite
Some tests uses structures from the libstdc++ that are present only if
the target has a wchar.h header. However, those tests do not check
that the target supports those constructs before executing the tests.
The function dg-require-wchars checks that "_GLIBCXX_USE_WCHAR_T" is
defined by the configure of the libstdc++. If it is not the case, the
test is not executed.
for libstdc++-v3/ChangeLog
* testsuite/lib/dg-options.exp: Add dg-require-wchars
function.
* testsuite/lib/libstdc++.exp: Add check_v3_target_wchars
function.
* testsuite/22_locale/codecvt/codecvt_utf16/79980.cc: Add
requirement.
* testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc:
Likewise.
* testsuite/22_locale/codecvt/codecvt_utf8/79980.cc: Likewise.
* testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc:
Likewise.
* testsuite/22_locale/conversions/buffer/1.cc: Likewise.
* testsuite/22_locale/conversions/buffer/2.cc: Likewise.
* testsuite/22_locale/conversions/buffer/3.cc: Likewise.
* testsuite/22_locale/conversions/buffer/requirements/typedefs.cc:
Likewise.
* testsuite/22_locale/conversions/string/1.cc: Likewise.
* testsuite/22_locale/conversions/string/2.cc: Likewise.
* testsuite/22_locale/conversions/string/3.cc: Likewise.
* testsuite/22_locale/conversions/string/66441.cc: Likewise.
* testsuite/22_locale/conversions/string/requirements/typedefs.cc:
Likewise.
* testsuite/22_locale/conversions/string/requirements/typedefs-2.cc:
Likewise.
Diff:
---
.../22_locale/codecvt/codecvt_utf16/79980.cc | 1 +
.../22_locale/codecvt/codecvt_utf16/misaligned.cc | 1 +
.../22_locale/codecvt/codecvt_utf8/79980.cc | 1 +
.../22_locale/codecvt/codecvt_utf8_utf16/79511.cc | 1 +
.../testsuite/22_locale/conversions/buffer/1.cc | 1 +
.../testsuite/22_locale/conversions/buffer/2.cc | 1 +
.../testsuite/22_locale/conversions/buffer/3.cc | 1 +
.../conversions/buffer/requirements/typedefs.cc | 1 +
.../testsuite/22_locale/conversions/string/1.cc | 1 +
.../testsuite/22_locale/conversions/string/2.cc | 1 +
.../testsuite/22_locale/conversions/string/3.cc | 1 +
.../22_locale/conversions/string/66441.cc | 1 +
.../conversions/string/requirements/typedefs-2.cc | 1 +
.../conversions/string/requirements/typedefs.cc | 1 +
libstdc++-v3/testsuite/lib/dg-options.exp | 9 +++++
libstdc++-v3/testsuite/lib/libstdc++.exp | 47 ++++++++++++++++++++++
16 files changed, 70 insertions(+)
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc
index 8a092913a4c..039bdd03229 100644
--- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
#include <locale>
#include <codecvt>
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc
index 04cfc8d744b..3496e0e819e 100644
--- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
#include <locale>
#include <codecvt>
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc
index 68ae5af234a..fd69dd5c04d 100644
--- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
#include <codecvt>
#include <locale>
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc
index 1f63e7218e7..590a3b73bfc 100644
--- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
#include <locale>
#include <codecvt>
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc
index 2855f7432d4..91bf2bf2216 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc
@@ -1,4 +1,5 @@
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/2.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/2.cc
index 2cf320fc13c..a03a16a02ed 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/2.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/2.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
#include <locale>
#include <sstream>
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc
index de43e0a95b2..84d5358f499 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
#include <locale>
#include <streambuf>
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/requirements/typedefs.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/requirements/typedefs.cc
index e88799dbec7..8efe203e873 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/requirements/typedefs.cc
@@ -1,4 +1,5 @@
// { dg-do compile { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc
index 41d6594fe13..d491e6c5270 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc
@@ -1,4 +1,5 @@
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc
index bc26e328a60..b4867053f3c 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc
@@ -1,4 +1,5 @@
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/3.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/3.cc
index b7793cdca49..023897c9307 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/string/3.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/string/3.cc
@@ -1,4 +1,5 @@
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/66441.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/66441.cc
index 07136aec117..b78c31fbb9b 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/string/66441.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/string/66441.cc
@@ -16,6 +16,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do run { target c++11 } }
+// { dg-require-wchars "" }
// libstdc++/66441
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs-2.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs-2.cc
index 91b47c449a1..4cd254a40da 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs-2.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs-2.cc
@@ -1,4 +1,5 @@
// { dg-do compile { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs.cc
index 023caa69a6e..30e49b2ff89 100644
--- a/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs.cc
@@ -1,4 +1,5 @@
// { dg-do compile { target c++11 } }
+// { dg-require-wchars "" }
// Copyright (C) 2015-2020 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/lib/dg-options.exp b/libstdc++-v3/testsuite/lib/dg-options.exp
index 0102acf65a2..17306a0eb02 100644
--- a/libstdc++-v3/testsuite/lib/dg-options.exp
+++ b/libstdc++-v3/testsuite/lib/dg-options.exp
@@ -16,6 +16,15 @@
# along with this program; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
+proc dg-require-wchars { args } {
+ if { ![ check_v3_target_wchars ] } {
+ upvar dg-do-what dg-do-what
+ set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+ return
+ }
+ return
+}
+
proc dg-require-c-std { args } {
if { ![ check_v3_target_c_std ] } {
upvar dg-do-what dg-do-what
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp
index b7d7b906de4..2c22bcc0f0c 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -702,6 +702,53 @@ proc v3-build_support { } {
}
}
+proc check_v3_target_wchars { } {
+ global et_wchars
+ global et_wchars_target_name
+ global tool
+
+ if { ![info exists et_wchars_target_name] } {
+ set et_wchars_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_wchars_target_name } {
+ verbose "check_v3_target_wchars: `$et_wchars_target_name'" 2
+ set et_wchars_target_name $current_target
+ if [info exists et_wchars] {
+ verbose "check_v3_target_wchars: removing cached result" 2
+ unset et_wchars
+ }
+ }
+
+ if [info exists et_wchars] {
+ verbose "check_v3_target_wchars: using cached result" 2
+ } else {
+ set et_wchars 0
+
+ # Set up and preprocess a C++ test program that depends
+ # on wchars support being configured in the libstdc++.
+ set src wchars[pid].cc
+
+ set f [open $src "w"]
+ puts $f "#ifndef _GLIBCXX_USE_WCHAR_T"
+ puts $f "# error No wchar header."
+ puts $f "#endif"
+ close $f
+
+ set lines [v3_target_compile $src /dev/null preprocess ""]
+ file delete $src
+
+ if [string match "" $lines] {
+ # No error message, preprocessing succeeded.
+ set et_wchars 1
+ }
+ }
+ verbose "check_v3_target_wchars: $et_wchars" 2
+ return $et_wchars
+}
+
# Implement an target check for property PROP by invoking
# the Tcl command ARGS and seeing if it returns true.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-01-01 5:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-01 5:22 [gcc(refs/users/aoliva/heads/testme)] Add dg-require-wchars to libstdc++ testsuite Alexandre Oliva
-- strict thread matches above, loose matches on Subject: below --
2021-01-01 1:29 Alexandre Oliva
2020-12-25 1:45 Alexandre Oliva
2020-12-18 14:46 Alexandre Oliva
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).