add extensions.h to be able to use func attribs

Currently enables these for every gnu-like compilers, i.e.: gcc, clang and
icc.
use function attributes on allocation functions

This should allow gcc/clang/icc to generate better code and clarifies
function intent.