GCC 11.x added support for arguments to __attribute__ (malloc): * https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;f=gcc/doc/extend.texi;h=dce6c58db87ebf7f4477bd3126228e73e4eeee97#patch6 For example: $ cat test.c typedef struct my_s {} my; void myclose (my*); __attribute__ ((malloc, malloc (myclose))) my* myopen(void); $ gcc-11 -c test.c (works) $ clang-13 -c test.c test.c:3:25: error: 'malloc' attribute takes no arguments __attribute__ ((malloc, malloc (myclose))) my* myopen(void); ^