From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by sourceware.org (Postfix) with ESMTPS id 6CC4F3858C62 for ; Mon, 28 Nov 2022 15:51:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6CC4F3858C62 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 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2ASCpgdp006048; Mon, 28 Nov 2022 16:51:06 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=selector1; bh=lF01EoRswC9vMwXWjXEct2v5JYEtMVpTMvk+W8FAmm4=; b=Cg+w7nZx3AACHScOH7XVIswPv/m1mpKCNczzwvC6FXLbg9LUK4j3AGc15vbVwvLZMGoP 1VZd72nJdmN7h8lz+cs+bg74xdSuXAp3tpqLgNpST1K52Ogo7x5+HGkJcj/68meIn1QK 4Ow7+YBakNApJClMH8enh7Z337nKoL8EpeF+pCAyx9CGsqy4v5XBQ66sWMgLkbwbjJbC Hb35xklTnrnzz4qSDQ1cZ90dZnbZbErkCUTSPYuMTKkujS1pdNxK+Q5msIaAS4CN4pRx yz1YeYdFm5jqraDerqWN3FH+xPehneHLIQKoWKiQLFDIXPgnCqe3Cv3XpzSNmhKLF4ad Ow== 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 3m3ajqc3q9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 28 Nov 2022 16:51:06 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id D960010002A; Mon, 28 Nov 2022 16:50:59 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id C21AE22A6C7; Mon, 28 Nov 2022 16:50:59 +0100 (CET) Received: from [10.210.55.83] (10.210.55.83) 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.6; Mon, 28 Nov 2022 16:50:58 +0100 Message-ID: <424fe5eb-6ea1-f341-374c-698cfc02606c@foss.st.com> Date: Mon, 28 Nov 2022 16:50:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: PING [PATCH v3] c++: Allow module name to be a single letter on Windows Content-Language: en-US To: Nathan Sidwell , CC: References: <20221117132021.1143935-1-torbjorn.svensson@foss.st.com> <0a727ec2-e385-f23b-f6a6-b415d1688b51@foss.st.com> From: Torbjorn SVENSSON In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.210.55.83] X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-28_13,2022-11-28_02,2022-06-22_01 X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,KAM_SHORT,NICE_REPLY_A,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS,TXREP 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: On 2022-11-28 12:21, Nathan Sidwell wrote: > On 11/25/22 14:03, Torbjorn SVENSSON wrote: >> Hi, >> >> Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606528.html > > ok, thanks! Pushed. > >> >> Kind regards, >> Torbjörn >> >> On 2022-11-17 14:20, Torbjörn SVENSSON wrote: >>> v1 -> v2: >>> Paths without "C:" part can still be absolute if they start with / or >>> \ on Windows. >>> >>> v2 -> v3: >>> Use alternative approach by having platform specific code in module.cc. >>> >>> Truth table for the new expression: >>> c:\foo     -> true >>> c:/foo     -> true >>> /foo       -> true >>> \foo       -> true >>> c:foo      -> false >>> foo        -> false >>> ./foo      -> true >>> .\foo      -> true >>> >>> >>> Ok for trunk? >>> >>> --- >>> >>> On Windows, the ':' character is special and when the module name is >>> a single character, like 'A', then the flatname would be (for >>> example) 'A:Foo'. On Windows, 'A:Foo' is treated as an absolute >>> path by the module loader and is likely not found. >>> >>> Without this patch, the test case pr98944_c.C fails with: >>> >>> In module imported at /src/gcc/testsuite/g++.dg/modules/pr98944_b.C:7:1, >>> of module A:Foo, imported at >>> /src/gcc/testsuite/g++.dg/modules/pr98944_c.C:7: >>> A:Internals: error: header module expected, module 'A:Internals' found >>> A:Internals: error: failed to read compiled module: Bad file data >>> A:Internals: note: compiled module file is 'gcm.cache/A-Internals.gcm' >>> In module imported at /src/gcc/testsuite/g++.dg/modules/pr98944_c.C:7:8: >>> A:Foo: error: failed to read compiled module: Bad import dependency >>> A:Foo: note: compiled module file is 'gcm.cache/A-Foo.gcm' >>> A:Foo: fatal error: returning to the gate for a mechanical issue >>> compilation terminated. >>> >>> gcc/cp/ChangeLog: >>> >>>     * module.cc: On Windows, 'A:Foo' is supposed to be a module >>>     and not a path. >>> >>> Tested on Windows with arm-none-eabi for Cortex-M3 in gcc-11 tree. >>> >>> Co-Authored-By: Yvan ROUX >>> Signed-off-by: Torbjörn SVENSSON >>> --- >>>   gcc/cp/module.cc | 10 +++++++++- >>>   1 file changed, 9 insertions(+), 1 deletion(-) >>> >>> diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc >>> index 0e9af318ba4..fa41a86213f 100644 >>> --- a/gcc/cp/module.cc >>> +++ b/gcc/cp/module.cc >>> @@ -13960,7 +13960,15 @@ get_module (tree name, module_state *parent, >>> bool partition) >>>   static module_state * >>>   get_module (const char *ptr) >>>   { >>> -  if (ptr[0] == '.' ? IS_DIR_SEPARATOR (ptr[1]) : IS_ABSOLUTE_PATH >>> (ptr)) >>> +  /* On DOS based file systems, there is an ambiguity with A:B which >>> can be >>> +     interpreted as a module Module:Partition or Drive:PATH. >>> Interpret strings >>> +     which clearly starts as pathnames as header-names and >>> everything else is >>> +     treated as a (possibly malformed) named moduled.  */ >>> +  if (IS_DIR_SEPARATOR (ptr[ptr[0] == '.']) // ./FOO or /FOO >>> +#if HAVE_DOS_BASED_FILE_SYSTEM >>> +      || (HAS_DRIVE_SPEC (ptr) && IS_DIR_SEPARATOR (ptr[2])) // A:/FOO >>> +#endif >>> +      || false) >>>       /* A header name.  */ >>>       return get_module (build_string (strlen (ptr), ptr)); >