[patches] Alternatives for static functions in extern C contexts

Richard Smith richard at metafoo.co.uk
Wed Feb 20 17:22:04 PST 2013


On Wed, Feb 20, 2013 at 3:19 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> Ping. Any preferences?


Both patches seem like an improvement on the status quo to me. I'm waiting
to hear opinions from CWG.


>  On 15 February 2013 10:08, Rafael EspĂ­ndola <rafael.espindola at gmail.com>
> wrote:
> > I have changed llvm so that it doesn't depend on the mangling of
> > static functions in extern C contexts. Now we should decide what to do
> > in clang.
> >
> > I have attached two options on how to handle
> >
> > extern "C" {
> >   static void foo();
> > }
> >
> > The assign_c_language_linkage patch assigns C language linkage to any
> > function or variable with linkage, instead of just the ones with
> > external linkage. It looks like this is what gcc does.
> >
> > The mangle_static_extern_c implements the current letter of the
> > standard, which requires some mangling of static functions. We can try
> > to improve it so that given
> >
> > extern "C" {
> >   static void foo() {
> >   }
> >   static void bar() {
> >   }
> >   static void bar(int x) {
> >   }
> > }
> >
> > it produces the symbols foo, _Z3barv and _Z3bari, but it doesn't look
> > trivial to find out in shouldMangleDeclName if a function is
> > overloaded or not.
> >
> > Cheers,
> > Rafael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130220/2f278fe7/attachment.html>


More information about the cfe-commits mailing list