From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: "Torbjörn SVENSSON" <torbjorn.svensson@foss.st.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>,
"libstdc++" <libstdc++@gcc.gnu.org>, JonY <10walls@gmail.com>,
botcazou@adacore.com
Subject: Re: [PATCH] libstdc++: /dev/null is not accessible on Windows
Date: Mon, 5 Feb 2024 19:38:20 +0000 [thread overview]
Message-ID: <CAH6eHdTPToDS95C1m9aenUM=pgaiv3aK1XxYRcy2kAe7he1OEQ@mail.gmail.com> (raw)
In-Reply-To: <20240205190602.3571108-1-torbjorn.svensson@foss.st.com>
[-- Attachment #1: Type: text/plain, Size: 3518 bytes --]
On Mon, 5 Feb 2024, 19:07 Torbjörn SVENSSON, <torbjorn.svensson@foss.st.com>
wrote:
> Ok for trunk and releases/gcc-13?
>
OK, thanks
> ---
>
> 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.
>
> gcc/testsuite:
>
> * testsuite/lib/libstdc++.exp: Use "nul" for Windows,
> "/dev/null" for other environments.
>
> Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
> ---
> 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 24d1b43f11b..58804ecab26 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"
> }
> }
> --
> 2.25.1
>
>
next prev parent reply other threads:[~2024-02-05 19:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-05 19:06 Torbjörn SVENSSON
2024-02-05 19:38 ` Jonathan Wakely [this message]
2024-02-06 8:38 ` Jonathan Yong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAH6eHdTPToDS95C1m9aenUM=pgaiv3aK1XxYRcy2kAe7he1OEQ@mail.gmail.com' \
--to=jwakely.gcc@gmail.com \
--cc=10walls@gmail.com \
--cc=botcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@gcc.gnu.org \
--cc=torbjorn.svensson@foss.st.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).