[cfe-commits] r64336 - in /cfe/trunk: include/clang/AST/Attr.h

Sebastian Redl sebastian.redl at getdesigned.at
Thu Feb 12 00:25:11 PST 2009


On Wed, 11 Feb 2009 23:02:50 -0000, Douglas Gregor <dgregor at apple.com>
wrote:
> Author: dgregor
> Date: Wed Feb 11 17:02:49 2009
> New Revision: 64336
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=64336&view=rev
> Log:
> Initial implementation of function overloading in C.
> 
> This commit adds a new attribute, "overloadable", that enables C++
> function overloading in C. The attribute can only be added to function
> declarations, e.g.,
> 
>   int *f(int) __attribute__((overloadable));
> 
> If the "overloadable" attribute exists on a function with a given
> name, *all* functions with that name (and in that scope) must have the
> "overloadable" attribute.
> 
>   2) All overloadable functions with the same name will have the same
>   linkage name, which means we'll get a collision in the linker (if
>   not sooner). We'll need to mangle the names of these functions.
> 

This is a problem for the intended use case in tgmath.h. There will be a
non-overloaded version of the function in math.h (since we don't provide
that file), which will conflict with the overloaded versions in tgmath.h.
Also, even if we mark the version in math.h as overloaded, how do we then
link to the non-mangled version in libm?

Sebastian



More information about the cfe-commits mailing list