You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Stefan Fritsch <sf...@sfritsch.de> on 2011/05/15 11:40:18 UTC

Adding gcc attributes to function declarations

Hi,

I think it would be a good idea to add some more gcc attribute annotations 
to our header to mark parameters that must not be NULL, etc. We already 
have some of these for format string.

In order to not break other compilers, I thought to just include

#if !defined(__GNUC__)
#define __attribute__(x)
#endif

at the top. Or would it be better to have something like

#if defined(__GNUC__)
#define APR_NONNULL(x) __attribute__((nonnull(x)))
#else
#define APR_NONNULL(x)
#endif

for every attribute? Would these macros be a new API that needs to wait 
for 1.5.x?

Cheers,
Stefan

Re: Adding gcc attributes to function declarations

Posted by Stefan Fritsch <sf...@sfritsch.de>.
On Sun, 15 May 2011, Stefan Fritsch wrote:
> I think it would be a good idea to add some more gcc attribute annotations to 
> our header to mark parameters that must not be NULL, etc. We already have 
> some of these for format string.
>
> In order to not break other compilers, I thought to just include
>
> #if !defined(__GNUC__)
> #define __attribute__(x)
> #endif

Ignore this mail. This code is already contained in apr.h.in