Dean Rasheed <dean.a.rash...@gmail.com> writes:

> On Sat, 26 Oct 2024 at 01:51, Andy Fan <zhihuifan1...@163.com> wrote:
>>
>> > 10). In this error:
>> >
>> > +        elog(ERROR, "unsupported type %d for rand_array function.",
>> > +             datatype);
>> >
>> > "datatype" is of type Oid, which is unsigned, and so it should use
>> > "%u" not "%d". Also, as above, it should not end with a period, so it
>> > should be:
>> >
>> > +        elog(ERROR, "unsupported type %u for rand_array function",
>> > +             datatype);
>>
>> All the following commands succeed without any warnings.
>>
>> clang -O0 -g main.c -o main -Wall -Wformat
>> gcc -g main.c -o main -Wall -Wformat
>>
>
> This can be detected in gcc with -Wformat plus -Wformat-signedness
> flags.

Yes, this one works. I didn't realize we have "-Wformat-signedness"
subsection after we already have "-Wformat". I have added this one into
my toolset.

For recording purpose, clang doesn't support this option until now. 

>
> I see that this has been discussed before (e.g., [1]), but it doesn't
> look like those patches were committed, and there are still many such
> warnings, if you try compiling postgres with those flags.

OK, Thanks for the information. Currently I add the "c/c++-gcc" checker
for my c file, it just trigger when I am writting a file. so the
warnings in other places probably doesn't bother me. 
>
> [1]
> https://www.postgresql.org/message-id/flat/CA%2BhUKGJ7EQm9extQAgrFZNNUKqRT8Vv5t1tKqA-5nEcYn0%2BwNA%40mail.gmail.com
>
> I don't know if anyone has any plans to pick up that work again.
I can take that very soon.

> but in any case, it seems wise to not add more.
Very true.

Thank you for all your helps on this series. 

-- 
Best Regards
Andy Fan



Reply via email to