Re: [pcre-dev] [PATCH] add malloc and alloc_size attributes to allocation functions

2012-06-04 Thread Craig Silverstein
I'll volunteer to take on this review, since I have some experience with __attribute__(malloc) due to my work on gperftools. First, while I disagree that the cost to the header file is basically 0 -- I think it definitely has a negative impact on readability, at least to some extent -- I support

Re: [pcre-dev] [PATCH] add malloc and alloc_size attributes to allocation functions

2012-06-04 Thread Nuno Lopes
Hi, The code itself looks good, with a few comments: } +#if defined(__GNUC__) __GNUC__ = 3 } +# define PCRE_ATTR_MALLOC __attribute__((__malloc__)) I prefer to check for __attribute__ support in autoconf, and condition on #ifdef HAVE___ATTRIBUTE__ rather than checking for a particular

[pcre-dev] Fw: Re: [PATCH] add malloc and alloc_size attributes to allocation functions

2012-06-04 Thread Zoltán Herczeg
Hi, The thing is that PCRE is often built along with other projects. The more autoconf magic we add, the worst, since those options are unlikely to be picked up by these projects bundling PCRE. (and I I totally agree with this. However, adding everything to pcre.h makes it far less

Re: [pcre-dev] Fw: Re: [PATCH] add malloc and alloc_size attributes to allocation functions

2012-06-04 Thread Zoltán Herczeg
Hi, The __has_attribute macro is special in clang. It's defined by the compiler. Oh, that is probably a misunderstanding. I mean instead of defining this macro when missing, we should define something with PCRE_ prefix, which is empty if __has_attribute is not supported. No, nothing