This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

demangle C++ extern "C" functions


Hello,

this patch is obviously related to PR c++/2316 ("g++ fails to overload on language linkage") but seems fairly independent. Currently, the demangler recognizes 'Y' for extern "C" functions and ignores it. The patch makes it print extern "C" after the function type:
_Z1aIFYviEEvPT_
void a<void (int) extern "C">(void (*)(int) extern "C")


Writing it before the return type seems more natural, but it is ambiguous. I guess it could also be printed in the middle (next to the star that indicates a function pointer), but placing it like the cv-qualifiers of member functions seemed good (plus, that's where Oracle puts it in its implementation of c++filt).

Since g++ doesn't generate such mangling, the effect should be hard to notice ;-)

(Even if the patch was ok, I am not a committer)

2011-09-03 Marc Glisse <marc.glisse@inria.fr>

        * include/demangle.h (demangle_component_type)
        [DEMANGLE_COMPONENT_EXTERN_C]: Handle extern "C".
        * libiberty/cp-demangle.c (d_dump): Likewise.
        (d_make_comp): Likewise.
        (d_function_type): Likewise.
        (d_print_comp): Likewise.
        (d_print_mod_list): Likewise.
        (d_print_mod): Likewise.
        (d_print_function_type): Likewise.
        * libiberty/testsuite/demangle-expected: Test it.

--
Marc Glisse

Attachment: demangle-patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]