Hi Sam, 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 Bruno
