Message ID | 20240205190602.3571108-1-torbjorn.svensson@foss.st.com |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1082995dyb; Mon, 5 Feb 2024 11:07:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IGx4U9p1Q9856KnwGLBrC/C8NjAD9R/2I+FM/zEMzv3qboiFL8xSWVTwh5xi8senb2dDKeS X-Received: by 2002:a9d:784a:0:b0:6e1:4dc2:9912 with SMTP id c10-20020a9d784a000000b006e14dc29912mr584911otm.19.1707160043441; Mon, 05 Feb 2024 11:07:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707160043; cv=pass; d=google.com; s=arc-20160816; b=hdhB3Dw+MkZz8jDhAGkoWVkzPtAJatBqcZ8UqqUBNPnp1i1LpErUMw9dYKW89bmZRq K9WWWJLf9u78O19w4YZhSQhToiaV/KIGv3NcGeQvAS9AYObW+7QqZE72pOvrnLfx2tS2 vuXwnPir2tffuUw5qgyLcNLl5RDgFR7LRAWuRjQPd4vvlKlitqFmttbaRSSTj2qCvmaD X+4d5enseHfMpchYjSNemKma7iKqdTCPTqZeBDZu+0h4yUcscIlBO45jHA8dre978q7O TFPhh67IFcwG+16/GUMYGzQeOETfepcZg6C+859zrABz6F5uSIXghztwYjWlpk/Pmg77 YPmQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=PnUVmtQ/cIwuilsNJPGdBa71anUMciTsmA0VpB9Ar+Q=; fh=A3zpTyyS2cFdjWV9kxPC7xUeS9lQhXzkocTKP6vMWtk=; b=vLJlMxmwCQKXW8qHGljrPRuTOLaU54/ABWa1Y0ajTYfDYgvT8Y/x5uHNv4wFOa+KM5 +SEGrLzIQNDI+7gxtGjZlcCqroSK1fPEutdgAduXXvZHCOtvL3CXstbsV4fUze35+Aaa uFTE/v2GscRKggQOhu/9zl2lMLuJv/XEBHh0bZMdZE6qcBTfPZHzx2XX/qAiT4kZaEsC asvdazzuPOWsxBQkKr6HktEloZEI30yPQiIDzZlJ3rdCvm0rxEgPUIAS8ZMj7M+Mjrbq j7HPEM5jClKrLkz48KoggXf8jTsQ1w9F846h0pDXrFF/eoJJZmQ4hLGSpVwxmeBOs6sC DeJA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b="azE/SDCb"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com X-Forwarded-Encrypted: i=1; AJvYcCXyD8lfWwhckiqArJeRKMWL1+w6pc9CNY6kaCKaHfERVUWCxltd4Ovz7O5OPVse8voETLueBFPs/lwwH6knpPU0MQ3B8A== Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id l19-20020a05622a175300b0042be02b2be5si538445qtk.136.2024.02.05.11.07.23 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 11:07:23 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b="azE/SDCb"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2787A385802A for <ouuuleilei@gmail.com>; Mon, 5 Feb 2024 19:07:23 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by sourceware.org (Postfix) with ESMTPS id 946DC3857BB8; Mon, 5 Feb 2024 19:06:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 946DC3857BB8 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=foss.st.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 946DC3857BB8 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=185.132.182.106 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707160000; cv=none; b=ADruR4U8xejasJjtoTiVTzbJ3dqZxRWeWzReOLyD/HdApyqu2twybVoSmLmpsT6D7VHAvPceCbDDXeA7xc5pr6uQnoiH5AGFgsEKcOTyalLAvEeV6ejGIYXnj1C868Ga+CgP0lL+SF07mqPLl7ZhWm3b/PUaSiJZPTghYnkiPxU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707160000; c=relaxed/simple; bh=wuMFPnFi6CXC112AzHTJEsCWh6RgtqytXOjcqbpLjEM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=IQWDbuAjEeBByi41Y5KhrA0nRGphS3e/P3A4Ah2VqAk00WE/c6NOl7knOo0yVjuMiz0LMYVWOqpWT2jtBLoLTj+ifOnHIsVsPSSgAQHkMLTKTjYitJJCv0zcyi+JR0+vyAww457+KcJuFhzeMHk+W9MR+p1PqCaLMQRv63nYHd4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 415DowI2009785; Mon, 5 Feb 2024 20:06:36 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=selector1; bh=PnUVmtQ/cIwuilsNJPGd Ba71anUMciTsmA0VpB9Ar+Q=; b=azE/SDCbXGXBXriDHT1JFlhowQNpIhs0jYD9 SQS1A77IEHKvR7zCsga2Od+FNE+ldGNcLxzqyHm8HTK3Srnb9PzAty7I/Vjd58ku 4pLdK89Jp6exypYTFsXmoL0pTC1zNnD3zckhzH8auP+AdPy9qk1vlX8r1Oul58Lv 9CtJeIvMhcUmSVSrSlJsDnx7irFaX3Ujy5f8TUcKVGgYqXL7GQW8W9thwRrjJS35 zVUyhoUAVR/RFQl2qmVokks2CnmEiWyKX7r2cCzhJmdhtRk4RG1qqWip7oru/+tU 9YYiy1NVP4eX+825cYFzSDRyow3y4V8zR126s7ONA0HrO5i3bw== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3w1ewp06wr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 05 Feb 2024 20:06:36 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 7E7C710005B; Mon, 5 Feb 2024 20:06:35 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 70F8420C8FA; Mon, 5 Feb 2024 20:06:35 +0100 (CET) Received: from jkgcxl0004.jkg.st.com (10.74.22.255) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 5 Feb 2024 20:06:35 +0100 From: =?utf-8?q?Torbj=C3=B6rn_SVENSSON?= <torbjorn.svensson@foss.st.com> To: <gcc-patches@gcc.gnu.org>, <libstdc++@gcc.gnu.org> CC: <10walls@gmail.com>, <botcazou@adacore.com>, =?utf-8?q?Torbj=C3=B6rn_SVE?= =?utf-8?q?NSSON?= <torbjorn.svensson@foss.st.com> Subject: [PATCH] libstdc++: /dev/null is not accessible on Windows Date: Mon, 5 Feb 2024 20:06:03 +0100 Message-ID: <20240205190602.3571108-1-torbjorn.svensson@foss.st.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.74.22.255] X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-05_13,2024-01-31_01,2023-05-22_02 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790087049693067493 X-GMAIL-MSGID: 1790087049693067493 |
Series |
libstdc++: /dev/null is not accessible on Windows
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Torbjorn SVENSSON
Feb. 5, 2024, 7:06 p.m. UTC
Ok for trunk and releases/gcc-13?
---
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(-)
Comments
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 > >
On 2/5/24 19:38, Jonathan Wakely wrote: > 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 > Done, pushed to master and releases/gcc-13.
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" } }