On Wed, 28 Apr 2021, gengqi-linux via Gcc-patches wrote: > I have been fixing a bug. It involved the Negative property of options, > and I have some confusion about it.
Could you please explain the bug at the *user-visible* level? That is, the particular options passed to the compiler, how those options behave, and how you think they should behave instead. Once we know the *user-visible* issue under discussion, we can consider what the compiler's internal datastructures should look like to achieve the desired behavior (if indeed it is desired). Once we've worked out what the internal datastructures should look like, we can consider how the opt*.awk machinery should generate those datastructures from the .opt files. > Above is the code that handles the ‘Nagetive’ property. I don't see why > the 'idx' should be set -1 when 'RejectNegative'. Presumably because the handling of -1 somewhere in the compiler is considered appropriate for RejectNegative options. If you don't think it is, again, can you give an example at the user-visible level of a RejectNegative option for which that value of -1 results in inappropriate user-visible behavior? Then we can consider several possibilities for where the bug is: * Maybe the handling of -1 is incorrect (but the setting of -1 is correct). * Maybe the handling of -1 is correct (but the setting of -1 is incorrect). * Maybe the option shouldn't be RejectNegative at all, but the existing handling is appropriate for some other RejectNegative options. * Maybe in fact the option is being handled correctly, and changing the handling of -1 would result in it being handled incorrectly. * Maybe in fact the option is being handled correctly, but some of the relevant option-handling code is still conceptually confused and could be simplified without changing anything user-visible. -- Joseph S. Myers jos...@codesourcery.com