apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Fritsch ...@sfritsch.de>
Subject Adding gcc attributes to function declarations
Date Sun, 15 May 2011 09:40:18 GMT
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

Mime
View raw message