bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnulib-manywarnings: Enable -Wzero-as-null-pointer-constant


From: Alejandro Colomar
Subject: Re: gnulib-manywarnings: Enable -Wzero-as-null-pointer-constant
Date: Thu, 14 Nov 2024 17:49:56 +0100

Hi Bruno,

On Thu, Nov 14, 2024 at 04:14:26PM GMT, Bruno Haible wrote:
> I promised:
> >   - see how this new warning behaves on the Gnulib source code

Thanks!

> The two good news are:
>   - The warning is really helpful. With it, I could find all relevant uses of
>     '0' quickly. Patch attached and committed.
>   - There were no false positives.

Lovely!  :-)

> However, there are warnings that are not in the responsibility of a package
> maintainer:
> 
>   * Anywhere a pthread_mutex_t is initialized, the warning appears. This is
>     because on glibc, the macro __PTHREAD_MUTEX_INITIALIZER(__kind)
>     expands to
>       0, 0, 0, 0, __kind, 0, 0, { 0, 0 }
>     It should better expand to
>       0, 0, 0, 0, __kind, 0, 0, { NULL, NULL }

It would be interesting to send a patch to glibc for removing all uses
of 0 as a null pointer constant within glibc, including that one.

I can try this, unless someone beats me to it.

>   * gperf generated code has these warnings:
>     unicase/special-casing-table.gperf:171:10: warning: zero as null pointer 
> constant [-Wzero-as-null-pointer-constant]
>     unictype/categ_byname.gperf:115:10: warning: zero as null pointer 
> constant [-Wzero-as-null-pointer-constant]
>     unictype/incb_byname.gperf:60:10: warning: zero as null pointer constant 
> [-Wzero-as-null-pointer-constant]
>     unictype/joininggroup_byname.gperf:131:10: warning: zero as null pointer 
> constant [-Wzero-as-null-pointer-constant]
>     unictype/pr_byname.gperf:114:10: warning: zero as null pointer constant 
> [-Wzero-as-null-pointer-constant]
>     unictype/scripts_byname.gperf:160:10: warning: zero as null pointer 
> constant [-Wzero-as-null-pointer-constant]
>     uninorm/composition-table.gperf:995:10: warning: zero as null pointer 
> constant [-Wzero-as-null-pointer-constant]

Same for gperf.  Would you mind patching that one?

> These can only be fixed with a new glibc release and a new gperf release.
> 
> So, as things stand now, we can recommend the warning option to package
> maintainers. But I am not in favour of letting Gnulib enable it by default,
> since it will invariably lead to warnings (in the two cases mentioned above)
> that the maintainer cannot silence. Only once there have been glibc + gperf
> releases and we have waited 2 years until most maintainers have a system with
> these newer releases, will it make sense to enable it by default.

Makes sense.

> 
> Bruno

Have a lovely day!
Alex

-- 
<https://www.alejandro-colomar.es/>

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]