Skip to content
This repository has been archived by the owner on Jun 20, 2019. It is now read-only.

Commit

Permalink
Handle noclone attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
jpf91 committed Apr 15, 2014
1 parent 50f4465 commit dc22461
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gcc/d/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
2014-04-15 Johannes Pfau <johannespfau@gmail.com>

* d-lang.cc(d_handle_noclone_attribute): New function, required for
naked attribute.

This comment has been minimized.

Copy link
@ibuclaw

ibuclaw Apr 15, 2014

Member

s/naked/noclone/

This comment has been minimized.

Copy link
@jpf91

jpf91 Apr 15, 2014

Author Contributor

No that's correct, the naked attribute requires handling the noclone attribute. I'll better rephrase that though.


2014-04-13 Iain Buclaw <ibuclaw@gdcproject.org>

* d-codegen.cc(get_frameinfo): Don't copy the node for frame record.
* d-irstate.cc(IRState::endCatches): Rebuild the STATEMENT_LIST of
catches in a TRY_CATCH_EXPR if it gets optimised away by
IRState::popStatement.
* d-codegen.cc(d_attribute_p): Provide access to target attributes.

2014-03-31 Iain Buclaw <ibuclaw@gdcproject.org>

Expand Down
31 changes: 31 additions & 0 deletions gcc/d/d-lang.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ static tree d_handle_noinline_attribute (tree *, tree, tree, int, bool *);
static tree d_handle_forceinline_attribute (tree *, tree, tree, int, bool *);
static tree d_handle_flatten_attribute (tree *, tree, tree, int, bool *);
static tree d_handle_target_attribute (tree *, tree, tree, int, bool *);
static tree d_handle_noclone_attribute (tree *, tree, tree, int, bool *);


static char lang_name[6] = "GNU D";
Expand All @@ -56,6 +57,8 @@ static const attribute_spec d_attribute_table[] =
d_handle_flatten_attribute, false },
{ "target", 1, -1, true, false, false,
d_handle_target_attribute, false },
{ "noclone", 0, 0, true, false, false,
d_handle_noclone_attribute, false },
{ NULL, 0, 0, false, false, false, NULL, false }
};

Expand Down Expand Up @@ -1771,6 +1774,34 @@ d_handle_target_attribute (tree *node, tree name, tree args, int flags,
return NULL_TREE;
}

/* Handle a "noclone" attribute. */

static tree
d_handle_noclone_attribute (tree *node, tree name,
tree ARG_UNUSED (args),
int ARG_UNUSED (flags),
bool *no_add_attrs)
{
Type *t = build_dtype (TREE_TYPE (*node));

if (t->ty == Tfunction)
{
tree attributes = DECL_ATTRIBUTES (*node);

// Push attribute noclone.
if (! lookup_attribute ("noclone", attributes))
DECL_ATTRIBUTES (*node) = tree_cons (get_identifier ("noclone"),
NULL_TREE, attributes);
}
else
{
warning (OPT_Wattributes, "%qE attribute ignored", name);
*no_add_attrs = true;
}

return NULL_TREE;
}

struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;

#include "gt-d-d-lang.h"

0 comments on commit dc22461

Please sign in to comment.