This is the mail archive of the
mailing list for the GCC project.
C++ name mangling not tracking extern "C"-ness of function types?
- From: Stephan Bergmann <sbergman at redhat dot com>
- To: gcc at gcc dot gnu dot org
- Date: Thu, 26 Jun 2014 10:21:18 +0200
- Subject: C++ name mangling not tracking extern "C"-ness of function types?
- Authentication-results: sourceware.org; auth=none
/* Non-terminal <function-type>. NODE is a FUNCTION_TYPE or
METHOD_TYPE. If INCLUDE_RETURN_TYPE is non-zero, the return type
is mangled before the parameter types.
<function-type> ::= F [Y] <bare-function-type> E */
write_function_type (type, include_return_type)
MANGLE_TRACE_TREE ("function-type", type);
/* We don't track whether or not a type is `extern "C"'. Note that
you can have an `extern "C"' function that does not have
`extern "C"' type, and vice versa:
extern "C" typedef void function_t();
function_t f; // f has C++ linkage, but its type is
// `extern "C"'
typedef void function_t();
extern "C" function_t f; // Vice versa.
See [dcl.link]. */
write_bare_function_type (type, include_return_type);
Is there any rationale for not tracking extern "C"-ness here (beyond:
"its just simpler that way")? I do understand that technically it
doesn't make much of a difference whether a function's type is extern
"C" or not, but it took me by surprise to find this deliberate deviation
from the Itanium ABI.