On 2/2/24 05:13, Enrico Weigelt, metux IT consult wrote:
On 01.02.24 18:15, Alan Coopersmith wrote:
On 2/1/24 05:59, tlaro...@kergis.com wrote:
1) Test for __GNUC__ as well as __clang__ since gcc has no attributes
for __attribute((malloc)) as well;

Current versions of gcc do:

https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-malloc-function-attribute

*that* is really cool. Wasn't aware how good the analyzer became.

Yep - https://developers.redhat.com/author/martin-sebor has a series of
articles about the enhancements in recent gcc versions, including this one.

Should we start using this in the xserver code ?
(possibly by adding new _X_FOO macros)

I had added it to libXau as an experiment to see how well it worked and
was tolerated (which led to important findings like the need to disable
for clang and older gcc versions).

For that, I just defined it in the libXau headers itself to avoid having
to tightly coordinate with new versions of xorgproto, and because I'd
thought we'd only need to use __has_attribute and not keep track of
different compilers/versions like the macros in Xfuncproto.h do.
(As we all see now, I was wrong.)

I've not had time yet to consider adding it to anything more, but would
be happy to see others go forward with it.

--
        -Alan Coopersmith-                 alan.coopersm...@oracle.com
         Oracle Solaris Engineering - https://blogs.oracle.com/solaris

Reply via email to