[PATCH] Drop MALLOC attribute for void functions.
Martin Liška
mliska@suse.cz
Mon Feb 17 15:18:00 GMT 2020
On 2/17/20 3:48 PM, Jakub Jelinek wrote:
> On Mon, Feb 17, 2020 at 03:44:53PM +0100, Martin Liška wrote:
>> + error ("MALLOC attribute set on a void function");
>
> Why the capitals? Either malloc or %<malloc%> IMSHO.
Sure, I'll fix it.
> What is special about void functions, missing lhs? That can be missing
> for other functions (where you just don't use the return value, or e.g.
> noreturn even if you do)? And otherwise, shouldn't the test be rather
> whether the return type is a pointer type? E.g. float or int return
> type for malloc attribute isn't very meaningful.
Hopefully one can't set malloc attribute to a symbol that does not
return a pointer type:
head malloc.c
float bar(const char*);
static float __attribute__((malloc,noinline)) foo(const char *p)
{
return bar (p);
}
$ gcc malloc.c -c -O2
malloc.c:3:1: warning: âmallocâ attribute ignored [-Wattributes]
3 | {
Martin
>
> Jakub
>
More information about the Gcc-patches
mailing list