Bruno Haible via Gnulib discussion list <[email protected]> writes:

> Hi Arsen,
>
> In <https://lists.gnu.org/archive/html/bug-gettext/2026-08/msg00000.html> you
> write:
>> Pure functions cannot have any observable effects other than their
>> return value.  Thus, it is not valid for a pure function to have an
>> out-parameter.
>> ...
>> Please, when you get the chance, audit the usages of _GL_ATTRIBUTE_PURE
>> to check whether marked-pure functions have out-params.
>
> Thank you for the suggestion. Just did an audit of Gnulib:
>   - There are indeed 6 functions marked 'pure' but which have out parameters.
>     They need to be marked 'reproducible', not 'pure'.
>   - There are also a couple of functions marked 'pure' where it is not
>     immediately clear from the prototype whether these have out parameters.

I did a quick audit as well after your changes. They look good, thank
you!

I found one issue left: __eloop_threshold isn't const and a comment
acknowledges this. 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

thanks,
sam

> [...]

Attachment: signature.asc
Description: PGP signature

Reply via email to