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]

Re: [PATCH, C++] Warn on redefinition of builtin functions (PR c++/71973)


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.

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