From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 8052F385780F for ; Fri, 30 Apr 2021 17:51:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8052F385780F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=joseph_myers@mentor.com IronPort-SDR: pMQyYaAUojM7KEe7kXJp7BJZ5TbZnzNzswIbxyyKRCdkZWeamtcwrGWiMu+UP17RHDB11oV2AJ 0IW/StYY8m0ThfPvOJalczJd8kCGjhbTTGpoKqBXzdzMoXOJlCPv9DkyJib3Ik+TSDaXVbP3Pj d1r64Zg7JNyAz6L42/U95OJ0ZsqXuRKXBkjzKWweqrjpya+iol3s58VDVx12pPcaEE/OFpoHF+ kxRDhrtBSyO72ILjC0ewjJNdUy7UCwqllyuA/gCHgxNDdmwYzOaqesZ/4XYEJuEyFl4Rsl/J17 8PE= X-IronPort-AV: E=Sophos;i="5.82,263,1613462400"; d="scan'208";a="63101837" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 30 Apr 2021 09:51:15 -0800 IronPort-SDR: 9VIcvVbwsi6ctH7sXN2iSFsGSNoZyGEWhgsVjwe1oZMlR83/IJ2JP1QjQReJUo+X6FJ3toBfFc /Mil19w7GO7EeRMKINllMSRpnOgjhdAbDAV5ZwW3T654gUyV5RcBiPr3Y1LiaAVOS9P0A43Sp3 hCC+l9or+ePFBIlxj1f6w2E6ulejUyoPLJfBZfPpM8nsMtjG2gNSdsDct1ssKjQQj4nx6Lqy95 hdPpVrQQr03s+lI2998wx1JgJWbwVAN7MJZ09cXU8Fr8ZZbG77n1C5GpZaXUM+YWexSnSSg2aO E+I= Date: Fri, 30 Apr 2021 17:51:10 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: Jim Wilson CC: gcc-patches , gengqi-linux Subject: Re: About implementation of the Negative property of options. In-Reply-To: Message-ID: References: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-06.mgc.mentorg.com (139.181.222.6) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-3121.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Apr 2021 17:51:17 -0000 On Thu, 29 Apr 2021, Jim Wilson wrote: > Note that only in the -mfoo6= case are the duplicate options removed from > the command line. So pruning options requires that you have both > RejectNegative and Negative pointing at yourself, which is not what the > documentation says. Thanks for the example. There are definitely cases with RejectNegative that do not have the Negative semantics and so should not have any pruning done (for example, -Wa, is a JoinedOrMissing RejectNegative option). I don't know if any such options have Negative specified, but I tend to think they shouldn't. I think proper use of Negative should be to define equivalence classes of options, such that only the last such option (with its corresponding argument, if any) is in effect. That is, it would naturally be completely orthogonal to Joined, JoinedOrMissing and RejectNegative. As part of implmenting anything like the above, it's probably desirable to review existing uses of Negative to identify any which do not form a circular chain of options, or where the pruning isn't currently in effect because of any rules (documented or implemented) about interaction with Joined, JoinedOrMissing and RejectNegative. In some cases, it's probably necessary to change the .opt files (to give options the correct semantics, or to keep them having the correct semantics). If there are lots of cases where the semantics are correct at present but my proposal above means the .opt files need to change, we should look at some examples and consider revisiting my proposal. When changes (to either option handling code or .opt files) fix user-visible problems with how options are handled at present, adding testcases to the testsuite would be a good idea, at least for some representative examples. -- Joseph S. Myers joseph@codesourcery.com