Re: [pcre-dev] Fw: Re: [PATCH] add malloc and alloc_size att…

Góra strony
Delete this message
Autor: Zoltán Herczeg
Data:  
Dla: Nuno Lopes
CC: pcre-dev
Temat: Re: [pcre-dev] Fw: Re: [PATCH] add malloc and alloc_size attributes to allocation functions
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 appeared in clang, which is a good thing! :)
> But it will prevent overflows being introduced in the future.


Great!

> I didn't try the JIT compiler. But I'll pass it through clang and I'll
> let you know if it finds any bug.
> Anyway, the benefits add up. The malloc attribute will be used in JIT
> mode as well.


Thanks, let me know if you have any results.

Philip, I think we should organize header file content better by separating it into blocks, and adding a comment about the content of the block. Something like this:

/* =============================================== */
/*   This block contains compiler specific options                                    */
/* =============================================== */
/* This block is not core part of the PCRE, but it helps to improve code generation on some compilers. */


/* =============================================== */
/*   This block contains preprocessor defines                                         */
/* =============================================== */


/* =============================================== */
/*   This block contains types                                                                 */
/* =============================================== */


Although we should not introduce too many of them, than can be also confusing.

Regards,
Zoltan