Bug creation and email sending has been disabled, file new bugs at gcc.gnu.org/bugzilla
View | Details | Raw Unified | Return to bug 114
Collapse All | Expand All

(-)a/gcc/d/d-codegen.cc (+4 lines)
Lines 797-802 d_attribute_p (const char* name) Link Here
797
      size_t n = 0;
797
      size_t n = 0;
798
      for (const attribute_spec *p = d_attribute_table; p->name; p++)
798
      for (const attribute_spec *p = d_attribute_table; p->name; p++)
799
        n++;
799
        n++;
800
      for (const char **p = d_target_attributes; *p; p++)
801
        n++;
800
802
801
      if(n == 0)
803
      if(n == 0)
802
        return false;
804
        return false;
Lines 806-811 d_attribute_p (const char* name) Link Here
806
808
807
      for (const attribute_spec *p = d_attribute_table; p->name; p++)
809
      for (const attribute_spec *p = d_attribute_table; p->name; p++)
808
        table->insert(p->name, strlen(p->name));
810
        table->insert(p->name, strlen(p->name));
811
      for (const char **p = d_target_attributes; *p; p++)
812
        table->insert(*p, strlen(*p));
809
    }
813
    }
810
814
811
  return table->lookup(name, strlen(name)) != NULL;
815
  return table->lookup(name, strlen(name)) != NULL;
(-)a/gcc/d/d-lang.cc (+37 lines)
Lines 42-47 static tree d_handle_noinline_attribute (tree *, tree, tree, int, bool *); Link Here
42
static tree d_handle_forceinline_attribute (tree *, tree, tree, int, bool *);
42
static tree d_handle_forceinline_attribute (tree *, tree, tree, int, bool *);
43
static tree d_handle_flatten_attribute (tree *, tree, tree, int, bool *);
43
static tree d_handle_flatten_attribute (tree *, tree, tree, int, bool *);
44
static tree d_handle_target_attribute (tree *, tree, tree, int, bool *);
44
static tree d_handle_target_attribute (tree *, tree, tree, int, bool *);
45
static tree d_handle_noclone_attribute (tree *, tree, tree, int, bool *);
45
46
46
47
47
static char lang_name[6] = "GNU D";
48
static char lang_name[6] = "GNU D";
Lines 56-64 const attribute_spec d_attribute_table[] = Link Here
56
				d_handle_flatten_attribute, false },
57
				d_handle_flatten_attribute, false },
57
    { "target",                 1, -1, true, false, false,
58
    { "target",                 1, -1, true, false, false,
58
				d_handle_target_attribute, false },
59
				d_handle_target_attribute, false },
60
    { "noclone",                0, 0, true, false, false,
61
				d_handle_noclone_attribute, false }, 
59
    { NULL,                     0, 0, false, false, false, NULL, false }
62
    { NULL,                     0, 0, false, false, false, NULL, false }
60
};
63
};
61
64
65
const char* d_target_attributes[] =
66
{
67
    "naked",
68
    NULL
69
};
70
62
/* Lang Hooks */
71
/* Lang Hooks */
63
#undef LANG_HOOKS_NAME
72
#undef LANG_HOOKS_NAME
64
#undef LANG_HOOKS_INIT
73
#undef LANG_HOOKS_INIT
Lines 1771-1774 d_handle_target_attribute (tree *node, tree name, tree args, int flags, Link Here
1771
  return NULL_TREE;
1780
  return NULL_TREE;
1772
}
1781
}
1773
1782
1783
/* Handle a "noclone" attribute.  */
1784
1785
static tree
1786
d_handle_noclone_attribute (tree *node, tree name,
1787
				tree ARG_UNUSED (args),
1788
				int ARG_UNUSED (flags),
1789
				bool *no_add_attrs)
1790
{
1791
  Type *t = build_dtype (TREE_TYPE (*node));
1792
1793
  if (t->ty == Tfunction)
1794
    {
1795
      tree attributes = DECL_ATTRIBUTES (*node);
1796
1797
      // Push attribute noclone.
1798
      if (! lookup_attribute ("noclone", attributes))
1799
	DECL_ATTRIBUTES (*node) = tree_cons (get_identifier ("noclone"),
1800
					     NULL_TREE, attributes);
1801
    }
1802
  else
1803
    {
1804
      warning (OPT_Wattributes, "%qE attribute ignored", name);
1805
      *no_add_attrs = true;
1806
    }
1807
1808
  return NULL_TREE;
1809
}
1810
1774
struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
1811
struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
(-)a/gcc/d/d-lang.h (+1 lines)
Lines 204-209 extern void set_block (tree); Link Here
204
extern const attribute_spec d_builtins_attribute_table[];
204
extern const attribute_spec d_builtins_attribute_table[];
205
extern const attribute_spec d_attribute_table[];
205
extern const attribute_spec d_attribute_table[];
206
extern const attribute_spec d_format_attribute_table[];
206
extern const attribute_spec d_format_attribute_table[];
207
extern const char* d_target_attributes[];
207
tree d_builtin_function (tree);
208
tree d_builtin_function (tree);
208
void d_init_builtins (void);
209
void d_init_builtins (void);
209
void d_register_builtin_type (tree, const char *);
210
void d_register_builtin_type (tree, const char *);

Return to bug 114