> of the builtin (the function is not declared without attribute > alloc_size, at least in Glibc, but GCC still expands it inline). > This is as simple as enclosing alloca in parentheses: > > void *p = (alloca)(n); > > Ugly? Perhaps. One might say that code that does tricky or
No. I doubt that will work, unless you use -ffreestanding on the command line. Although the macro is not used in this case, even a declaraion like extern void *alloca (size_t __size); goes thru the decl-anticipated path, that means it inherits all the attributes from the builtin, unless the parameter don't match, in that case you get a warning in C but no warning in C++ (I am going to change the latter). There is currently an attribute malloc but no explicit attribute alloca, that's one of the reasons why special_function_p still has to do a string compare of the function name aginst "alloca". I think Jakub is right that we need a better way to fix the warning for instance with a comment like the fall thru thing. Complicated code changes can also introduce new errors. Bernd.