Bugzilla – Attachment 65 Details for
Bug 114
Add support for the GCC 'naked' attribute
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Bug creation and email sending has been disabled, file new bugs at
gcc.gnu.org/bugzilla
[patch]
Patch to add @attribute("naked")
naked.patch (text/plain), 3.09 KB, created by
Johannes Pfau
on 2014-04-06 13:20:59 CEST
(
hide
)
Description:
Patch to add @attribute("naked")
Filename:
MIME Type:
Creator:
Johannes Pfau
Created:
2014-04-06 13:20:59 CEST
Size:
3.09 KB
patch
obsolete
>diff --git a/gcc/d/d-codegen.cc b/gcc/d/d-codegen.cc >index 08f1b31..9c8a0c0 100644 >--- a/gcc/d/d-codegen.cc >+++ b/gcc/d/d-codegen.cc >@@ -797,6 +797,8 @@ d_attribute_p (const char* name) > size_t n = 0; > for (const attribute_spec *p = d_attribute_table; p->name; p++) > n++; >+ for (const char **p = d_target_attributes; *p; p++) >+ n++; > > if(n == 0) > return false; >@@ -806,6 +808,8 @@ d_attribute_p (const char* name) > > for (const attribute_spec *p = d_attribute_table; p->name; p++) > table->insert(p->name, strlen(p->name)); >+ for (const char **p = d_target_attributes; *p; p++) >+ table->insert(*p, strlen(*p)); > } > > return table->lookup(name, strlen(name)) != NULL; >diff --git a/gcc/d/d-lang.cc b/gcc/d/d-lang.cc >index ea8549f..daff994 100644 >--- a/gcc/d/d-lang.cc >+++ b/gcc/d/d-lang.cc >@@ -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"; >@@ -56,9 +57,17 @@ 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 } > }; > >+const char* d_target_attributes[] = >+{ >+ "naked", >+ NULL >+}; >+ > /* Lang Hooks */ > #undef LANG_HOOKS_NAME > #undef LANG_HOOKS_INIT >@@ -1771,4 +1780,32 @@ 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; >diff --git a/gcc/d/d-lang.h b/gcc/d/d-lang.h >index 9f552f2..bca8b7a 100644 >--- a/gcc/d/d-lang.h >+++ b/gcc/d/d-lang.h >@@ -204,6 +204,7 @@ extern void set_block (tree); > extern const attribute_spec d_builtins_attribute_table[]; > extern const attribute_spec d_attribute_table[]; > extern const attribute_spec d_format_attribute_table[]; >+extern const char* d_target_attributes[]; > tree d_builtin_function (tree); > void d_init_builtins (void); > void d_register_builtin_type (tree, const char *);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 114
:
64
| 65 |
66