This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, C++] Warn on redefinition of builtin functions (PR c++/71973)
- From: Bernd Edlinger <bernd dot edlinger at hotmail dot de>
- To: Kyrill Tkachov <kyrylo dot tkachov at foss dot arm dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Cc: Jason Merrill <jason at redhat dot com>, Jeff Law <law at redhat dot com>
- Date: Thu, 6 Oct 2016 20:37:17 +0000
- Subject: Re: [PATCH, C++] Warn on redefinition of builtin functions (PR c++/71973)
- Authentication-results: sourceware.org; auth=none
- Authentication-results: foss.arm.com; dkim=none (message not signed) header.d=none;foss.arm.com; dmarc=none action=none header.from=hotmail.de;
- References: <HE1PR0701MB2169DB217F73D8111DA9F690E4C70@HE1PR0701MB2169.eurprd07.prod.outlook.com> <57F65C57.8030806@foss.arm.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On 10/06/16 16:14, Kyrill Tkachov wrote:
>
> @@ -1553,7 +1588,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool
>
> /* Whether or not the builtin can throw exceptions has no
> bearing on this declarator. */
> - TREE_NOTHROW (olddecl) = 0;
> + TREE_NOTHROW (olddecl) = TREE_NOTHROW (newdecl);
>
> The comment would need to be updated I think.
Probably, yes.
Actually the code did *not* do what the comment said, and
effectively set the nothrow attribute to zero, thus
the eh handlers were emitted when not needed.
And IMHO the new code does now literally do what the comment
said.
At this point there follow 1000+ lines of code, in the same
function that merge olddecl into newdecl and back again.
The code is dependent on the types_match variable,
and in the end newdecl is free'd an olddecl returned.
At some places the code is impossible to understand:
Look for the memcpy :-/
I *think* the intention is to merge the attribute from the
builtin when the header file is not explicitly giving,
some or all attributes, when the parameters match.
But when the parameters do not match, the header file
changes the builtin's signature, and overrides the
builtin attributes more or less with defaults or
whatever is in the header file.
Bernd.