From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf35.google.com (mail-qv1-xf35.google.com [IPv6:2607:f8b0:4864:20::f35]) by sourceware.org (Postfix) with ESMTPS id B01D63858D28 for ; Mon, 28 Nov 2022 11:21:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B01D63858D28 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=acm.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qv1-xf35.google.com with SMTP id n12so7093411qvr.11 for ; Mon, 28 Nov 2022 03:21:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=lFa2pKkOpYmYFSpASR2p/fUdTag89pJNJsblbX8vh/k=; b=Ry8e1eqMhzGtG4qCoEs9rzRDLmpfKmwtpl4zg1UpPAXi7y5mPGPzWWRrVQxCCnWPG1 zTRJaM9Pw8Iz04u8OcNsQCQo3MjNx7cOCkhwanVoQIxV26hjup4xkwolPKCLsC2SjOjU uB03kI6v+Q1Vf6DEAANJBlRb1+d8R0D7WzJ4W04mMJVXufHVLmK1p5QsoByLE86KRk5I vC0NG8PXJpojRRBldgoWV4hBx44g5n9I6PJTlitVzgD8dRpsqbTTpbev74cpHuEcGEDV 2sZuymBCU8L4Zr85EA5/pdinB7sF27lpdN4GjaDHd8tclhflcb7kPzBeiCkBPMBjsVdq 8t+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=lFa2pKkOpYmYFSpASR2p/fUdTag89pJNJsblbX8vh/k=; b=0yjvNW5vKThjLNaHc69O55NakZl5SKlim1HNZ7a5KDSkd9rILXGO3sggzaoi07PaRN MIz8ZZwJECVuLqZpc2gDfEPP33d9RYCNn/7MIxl4Rb6rhUE2x82sMoGZN1gGO0JI20NR YXjjj2QmnvIZ0fzktjMGI2RCWom7P5LacPrhtjhxZrCMS5JqDO6AlwMQuQfBrlgBji5/ 3yIscmUflItLbweGe7Vv4csXOYO2wqke3dr1rH9iFTD4L36A5+FtopRo0YYBWpFIrGNp 1ycLCR5w9LC3xOo1fyH5taOC2BCUyy0ishebYpZmQ5dgJ1ypwOe0ir/wQ3b5/WoFX6IH tpag== X-Gm-Message-State: ANoB5plh8upZ8e0QA0U0oknJ2KlxpSLLXgrcjJuOYiLs5AEvGzdmDWOO Yek1UHpiU6r5LDoA13rkDWA= X-Google-Smtp-Source: AA0mqf6PI61JhIyqlYgiDFC2EAgHKY4KvcgXnMSnka09kGgxxX6X2tQuf3L6B+qls1FU9jW8LJcZPQ== X-Received: by 2002:ad4:53c9:0:b0:4c6:8b88:3065 with SMTP id k9-20020ad453c9000000b004c68b883065mr29192713qvv.126.1669634464903; Mon, 28 Nov 2022 03:21:04 -0800 (PST) Received: from ?IPV6:2601:19c:527f:bfd0:cb20:e74:ead7:4cfe? ([2601:19c:527f:bfd0:cb20:e74:ead7:4cfe]) by smtp.googlemail.com with ESMTPSA id ey14-20020a05622a4c0e00b003a55fe9f352sm6716844qtb.64.2022.11.28.03.21.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Nov 2022 03:21:04 -0800 (PST) Sender: Nathan Sidwell Message-ID: Date: Mon, 28 Nov 2022 06:21:04 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; 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: Torbjorn SVENSSON , gcc-patches@gcc.gnu.org Cc: yvan.roux@foss.st.com References: <20221117132021.1143935-1-torbjorn.svensson@foss.st.com> <0a727ec2-e385-f23b-f6a6-b415d1688b51@foss.st.com> From: Nathan Sidwell In-Reply-To: <0a727ec2-e385-f23b-f6a6-b415d1688b51@foss.st.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3037.5 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,KAM_SHORT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,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 11/25/22 14:03, Torbjorn SVENSSON wrote: > Hi, > > Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606528.html ok, thanks! > > 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)); -- Nathan Sidwell