From: Joseph Myers <joseph@codesourcery.com>
To: Jim Wilson <jimw@sifive.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>,
gengqi-linux <gengqi@linux.alibaba.com>
Subject: Re: About implementation of the Negative property of options.
Date: Fri, 30 Apr 2021 17:51:10 +0000 [thread overview]
Message-ID: <alpine.DEB.2.22.394.2104301736130.235539@digraph.polyomino.org.uk> (raw)
In-Reply-To: <CAFyWVaY+R_b3ccAfGC2NOiLZzYA1zQZFYQM2QSCSdNK2Y6e-GQ@mail.gmail.com>
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
prev parent reply other threads:[~2021-04-30 17:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-28 12:36 gengqi-linux
2021-04-28 20:11 ` Joseph Myers
2021-04-30 1:55 ` Jim Wilson
2021-04-30 8:03 ` 回复:About " gengqi-linux
2021-04-30 21:23 ` About " Jim Wilson
2021-04-30 17:51 ` Joseph Myers [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.22.394.2104301736130.235539@digraph.polyomino.org.uk \
--to=joseph@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=gengqi@linux.alibaba.com \
--cc=jimw@sifive.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).