On 2026/10/27 02:21, Zhongteng Gui wrote:
> On 2026/10/27 02:14, Jakub Jelinek wrote:
>> On Tue, Oct 27, 2026 at 01:33:10AM +0800, Zhongteng Gui wrote:
>>>> Yes, adding controls for the diagnostics is the right approach, not
>>>> ripping them out.
>>>
>>> Thanks, then how about the following patch?
>>
>> No, that makes from a two state option (enabled, disabled) some weirdo
>> 3 state option without giving the user control over the third state
>> (one can ask to disable it, or enable it, but the default state can't be
>> restored once changed).
>>
>> Normally 3 or more state warning options are -Wwhatever={0,1,2}
>> and -Wwhatever being alias to some case and -Wno-whatever to the =0 case.
>> In this case, it would be better to follow -Wabi, although -Wabi uses the
>> C++ ABI version number, while in this case we'd need the GCC version.
>>
>> Dunno, either let it parse all of -Wpsabi=M and -Wpsabi=M.N or -Wpsabi=M.N.O
>> and make it mean warn about psABI changes since GCC M.0, M.N or M.N.O,
>> -Wpsabi=0.9 could mean oldest and -Wpsabi=0 aka -Wno-psabi don't warn.
>>
>> The option parsing could parse this to say M * 10000 + N * 100 + O integer,
>> for each of the
>> config/aarch64/aarch64.cc:                      "%qT changed in GCC 9.1", 
>> type);
>> config/aarch64/aarch64.cc:                  "%qT changed in GCC 9.1", type);
>> config/aarch64/aarch64.cc:                  "%qT changed in GCC 9.1", type);
>> config/aarch64/aarch64.cc:                  "%qT changed in GCC 13.1", type);
>> config/aarch64/aarch64.cc:                  "%qT changed in GCC 14.1", type);
>> config/aarch64/aarch64.cc:          "%qT changed in GCC 13.1", type);
>> config/aarch64/aarch64.cc:          "%qT changed in GCC 14.1", type);
>> config/aarch64/aarch64.cc:              "%qT changed in GCC 13.1", type);
>> config/aarch64/aarch64.cc:              "%qT changed in GCC 14.1", type);
>> config/aarch64/aarch64.cc:                      "changed %{in GCC 10.1%}",
>> config/aarch64/aarch64.cc:                      "C++14 %{in GCC 10.1%}",
>> config/aarch64/aarch64.cc:                      "type %qT changed %{in GCC 
>> 12.1%}",
>> config/arm/arm.cc:              "%qT changed in GCC 7.1", type);
>> config/arm/arm.cc:              "%qT changed in GCC 7.1", arg.type);
>> config/arm/arm.cc:                  "%qT changed in GCC 9.1", arg.type);
>> config/arm/arm.cc:          "changed in GCC 7.1", type);
>> config/arm/arm.cc:          "%qT changed in GCC 9.1", type);
>> config/arm/arm.cc:                  "type %qT changed in GCC 7.1", arg.type);
>> config/arm/arm.cc:                      "%qT changed in GCC 9.1", arg.type);
>> config/arm/arm.cc:                      "changed %{in GCC 10.1%}",
>> config/arm/arm.cc:                      "C++14 %{in GCC 10.1%}",
>> config/arm/arm.cc:                      "type %qT changed %{in GCC 12.1%}",
>> config/i386/i386.cc:                                  " changed in GCC 4.4");
>> config/i386/i386.cc:                      " has changed in GCC 4.4");
>> config/i386/i386.cc:                  " member has changed in GCC 4.4");
>> config/i386/i386.cc:              " alignment has changed in GCC 4.6",
>> config/i386/i386.cc:              " has changed in GCC %{12.1%}", url);
>> config/riscv/riscv.cc:                     "bit-fields changed in GCC 10");
>> config/riscv/riscv.cc:         "length array changed in GCC 16");
>> config/riscv/riscv.cc:                     "bit-fields changed in GCC 10");
>> config/riscv/riscv.cc:         "length array changed in GCC 16");
>> config/rs6000/rs6000-call.cc:                           "%{in GCC 10.1%}", 
>> type, url);
>> config/rs6000/rs6000-call.cc:                           "changed %{in GCC 
>> 10.1%}", type, url);
>> config/rs6000/rs6000-call.cc:                         "corrected in GCC 12");
>> config/s390/s390.cc:                    "is enabled changed to match C++14 
>> %{in GCC 10.1%}",
>> config/s390/s390.cc:                    "%{in GCC 10.1%}", orig_type, url);
>> config/s390/s390.cc:                  "zero-width bit fields members changed 
>> in GCC 12",
>> spots record when it changed and compare to the -Wpsabi= value.
>> -Wpsabi= then could default to say 7.1 (10 years older than 17.1
>> or whatever is agreed on).
>> Also, while changing these, it would be nice to convert all of them to use
>> %{in GCC M.N%} and supply URLs, at least for cases where some docs about it
>> can be found.
>>
>> Note there are some Wpsabi warnings which are there regardless of GCC
>> version, they don't talk about ABI changes because of some GCC change but
>> because of ISA options etc.  Those should still only care about whether
>> the option is not disabled.
>>
>>      Jakub
> 
> OK, I agree something like -Wpsabi=M.N.O would be much better than a 
> ON/OFF/Default.
> I'll try to investigate how to implement it.

I've done some rough investigation, and I'd like to first ask a few
questions before implementing:

Would you be open to introducing a generic VERSION property for .opt
options, used alongside UInteger, analogous to ByteSize?

It would accept M[.N[.O]], fill omitted components with zero, and
encode the result as M * 10000 + N * 100 + O, with appropriate range
checks. Only argument parsing would change; storage and assignment
would reuse the existing integer-option machinery, including the
parsing path for -Werror=.

For -Wpsabi, this would let us retain warn_psabi as the sole state
variable and use standard aliases to map -Wpsabi to -Wpsabi=0.9 and
-Wno-psabi to -Wpsabi=0, without any specific handling in the generic
assignment code.

Reply via email to