17.2.6 Copy Function Attribute

The copy(func) attribute is used to apply a set of attributes to a function. This set is derived from the attributes applied to the argument func. This is particularly useful in libraries that define aliases, ensuring that the aliases have the same attributes as the original symbols. It's important to note that the copy attribute only duplicates syntactic and semantic attributes. It does not copy attributes that influence a symbol's linkage or visibility, such as alias or weak. Additionally, the deprecated attribute is not copied. For example:
#define StrongAlias(TargetFunc, AliasDecl)  \
  extern __typeof__ (TargetFunc) AliasDecl  \
    __attribute__ ((alias (#TargetFunc), copy (TargetFunc)));

extern __attribute__ (malloc, pure)) void* allocate (size_t);
StrongAlias (allocate, alloc);