This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] hash-table for extern-c fns.
- From: Jason Merrill <jason at redhat dot com>
- To: Nathan Sidwell <nathan at acm dot org>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 9 Oct 2017 11:57:37 -0400
- Subject: Re: [C++ PATCH] hash-table for extern-c fns.
- Authentication-results: sourceware.org; auth=none
- References: <8423b154-14ac-0263-aa18-01752c6894ef@acm.org>
On Fri, Oct 6, 2017 at 10:18 AM, Nathan Sidwell <nathan@acm.org> wrote:
> This patch converts the extern "C" function map to use a hash table, in the
> same way as I've just changed namespace bindings.
>
> There's a small wart, in that the c_linkage_bindings user (in c-common)
> expects either a single decl or a TREE_LIST. I.e. not an OVERLOAD. But the
> hasher expects either a DECL or an OVERLOAD. Rather than extend the hasher
> (and marginally pessimize it for this special case), I modify the extern-c
> table handling to insert an initial OVERLOAD node, when there are multiple
> functions. That can CHAIN directly to a TREE_LIST. Sure, we have a wasted
> OVERLOAD node in this case, but it's going to be rare -- programs don't
> usually declare extern "C" functions of the same name in different
> namespaces.
>
> Changing the c-common function is harder, as OVERLOAD is a C++ FE local
> node.
Hmm, why do we only check extern "C" conflicts for functions?
Jason