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

Página superior
Eliminar este mensaje
Autor: Zoltán Herczeg
Fecha:  
A: pcre-dev
Asunto: [pcre-dev] Fw: Re: [PATCH] add malloc and alloc_size attributes to allocation functions
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 readable. In sljit, I introduced separate header files for compiler magic. And __has_attribute breaks the rule that everything must be prefixed by pcre or PCRE.

> This attribute has nothing to do with glibc. It is used by gcc/clang
> to provide useful warnings for, e.g., array out-of-bounds indexing.


Still seems a research thingy for me. Just out of curiosity did you actually captured anything with it in PCRE?

>Apart of the warnings, it can be used for optimizations, and run-time
>code instrumentation.


Actually both in pcre and in sljit, malloc is rarely used by design, so I am still unsure about its benefit.

I am not against this feature, but I really would like to see a real use case which benefit from adding more symbols to a header file. Btw did you try JIT? I suspect it would offer far more speedup than any malloc optimization.

Regards,
Zoltan