Re: incorrect use of 'pure' attribute

Sam James <[email protected]>
Newsgroups gmane.comp.lib.gnulib.bugs
Organization Gentoo
Message-ID <[email protected]>
Bruno Haible via Gnulib discussion list <[email protected]> writes:

> Hi Sam,

Hi Bruno,

>
> Sam James wrote:
>> A function being idempotent / having 'call_once'
>> semantics unfortunately doesn't make it suitable for the const
>> attribute. This recently came up in both Mesa [0] and glib [1]
>> and was confirmed by the GCC developers [2].
>> 
>> [0] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42361
>> [1] https://gitlab.gnome.org/GNOME/glib/-/work_items/3984
>> [2] https://gcc.gnu.org/PR125916
>
> Rather than have to manually review whole packages for this kind of
> mistake, I think it would be good to have compiler warnings about these
> incorrect uses of the 'const' and 'pure' attributes. Therefore I've
> registered two issues for gcc and clang, respectively:
>
> const:
>   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126757
>   https://github.com/llvm/llvm-project/issues/215105
>
> pure:
>   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126758
>   https://github.com/llvm/llvm-project/issues/215106

Thanks for filing those! I'll watch them.

>
> Bruno

sam
signature.asc (application/pgp-signature, 418 B)
-----BEGIN PGP SIGNATURE-----

iQEBBAEWCgCpFiEEJaa7iN2bdkxrVUHCc4QJ9SDfkZAFAmp4t3kbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25z
Lm9wZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQyNUE2QkI4OEREOUI3NjRDNkI1NTQx
QzI3Mzg0MDlGNTIwREY5MTkwDxxzYW1AZ2VudG9vLm9yZwAKCRBzhAn1IN+RkGAu
AQDP/xh+tByzi1yZPZ9W8ndXG9DOpiqk797fTnFhxUEGeAD/ZTJqOQ/OacaWCeDX
bcMEP3t4HST4ywoULaLc7cLjJg4=
=mMVj
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.