From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1814) id 28C403858D33; Tue, 6 Feb 2024 08:23:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 28C403858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707207839; bh=ivgldwDh+gGT0lKgIwg0azA7g/SH2j0/zgx7lomI6pk=; h=From:To:Subject:Date:From; b=dxEhIr/vSayEiKTIlXdLX5Hu9ZJFRr5JlCxbaJko8QVFXWbYvNBEFQ+JRDZThehp8 nIW9TbVNHKBkAjCtzXb9E3hznHFRJgahiSCo+XBoe4LWuJ2Cu24Fr9GHnYD8+BifFi 3kpA9As4TX4y87krfy9cQg71GpVIM1KC/guU27kU= MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" From: Jonathan Yong To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r14-8818] libstdc++: /dev/null is not accessible on Windows X-Act-Checkin: gcc X-Git-Author: =?utf-8?q?Torbj=C3=B6rn_SVENSSON?= X-Git-Refname: refs/heads/master X-Git-Oldrev: c5d34912ad576be1ef19be92f7eabde54b9089eb X-Git-Newrev: 1e4664b97daf85d3134baa47a5af3db23658df34 Message-Id: <20240206082359.28C403858D33@sourceware.org> Date: Tue, 6 Feb 2024 08:23:58 +0000 (GMT) List-Id: https://gcc.gnu.org/g:1e4664b97daf85d3134baa47a5af3db23658df34 commit r14-8818-g1e4664b97daf85d3134baa47a5af3db23658df34 Author: Torbjörn SVENSSON Date: Mon Feb 5 20:06:03 2024 +0100 libstdc++: /dev/null is not accessible on Windows When running the DejaGNU testsuite on a toolchain built for native Windows, the path /dev/null can't be used to open a stream to void. On native Windows, the resource is instead named "nul". In 17_intro/tag_type_explicit_ctor.cc, the following statement would fail to match when the DejaGNU testsuite is running in cygwin with a native toolchain. // dg-error 53 "explicit" "" { target hosted } The "target hosted"-check is using cpp to verify if _GLIBCXX_HOSTED is defined and discards the output by simply redirecting it to /dev/null. In v3_target_compile, it's overridden to "nul" for MinGW targets, but the same rule applies when host is cygwin, so replace the condition with a check for Windows. The error in the log would look like this for the "target hosted" check: cc1plus.exe: fatal error: opening output file /dev/null: No such file or directory The tag_type_explicit_ctor.cc test fails with this on Windows: .../tag_type_explicit_ctor.cc:53: error: converting to 'std::defer_lock_t' from initializer list would use explicit constructor 'constexpr std::defer_lock_t::defer_lock_t()' .../tag_type_explicit_ctor.cc:54: error: converting to 'std::try_to_lock_t' from initializer list would use explicit constructor 'constexpr std::try_to_lock_t::try_to_lock_t()' .../tag_type_explicit_ctor.cc:55: error: converting to 'std::try_to_lock_t' from initializer list would use explicit constructor 'constexpr std::try_to_lock_t::try_to_lock_t()' .../tag_type_explicit_ctor.cc:67: error: converting to 'std::defer_lock_t' from initializer list would use explicit constructor 'constexpr std::defer_lock_t::defer_lock_t()' .../tag_type_explicit_ctor.cc:68: error: converting to 'std::try_to_lock_t' from initializer list would use explicit constructor 'constexpr std::try_to_lock_t::try_to_lock_t()' .../tag_type_explicit_ctor.cc:69: error: converting to 'std::adopt_lock_t' from initializer list would use explicit constructor 'constexpr std::adopt_lock_t::adopt_lock_t()' Patch has been verified on Windows and Linux. libstdc++-v3: * testsuite/lib/libstdc++.exp: Use "nul" for Windows, "/dev/null" for other environments. Signed-off-by: Torbjörn SVENSSON Diff: --- libstdc++-v3/testsuite/lib/libstdc++.exp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp index 24d1b43f11be..58804ecab267 100644 --- a/libstdc++-v3/testsuite/lib/libstdc++.exp +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp @@ -615,11 +615,14 @@ proc v3_target_compile { source dest type options } { } } - # Small adjustment for MinGW hosts. - if { $dest == "/dev/null" && [ishost "*-*-mingw*"] } { + # Small adjustment for Windows hosts. + if { $dest == "/dev/null" + && [info exists ::env(OS)] && [string match "Windows*" $::env(OS)] } { if { $type == "executable" } { set dest "x.exe" } else { + # Windows uses special file named "nul" as a substitute for + # /dev/null set dest "nul" } }