From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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=20SVENSSON?= To: , CC: <10walls@gmail.com>, , =?UTF-8?q?Torbj=C3=B6rn=20SVENSSON?= 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 List-Id: 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 --- 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