summaryrefslogtreecommitdiff
path: root/gcc/attribs.c
diff options
context:
space:
mode:
authortglek <tglek@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-14 01:38:33 +0000
committertglek <tglek@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-14 01:38:33 +0000
commite3fced1ac7503512a9ccdcb5da732f2513b7a2cd (patch)
tree79caa93c375ec4191d07fcb56826aa922c1e1518 /gcc/attribs.c
parent9ee55131e58408014be9ee79da60968c264cc760 (diff)
downloadgcc-e3fced1ac7503512a9ccdcb5da732f2513b7a2cd.tar.gz
2009-05-13 Taras Glek <tglek@mozilla.com>
gcc/ * attribs.c moved out attribute registration into register_attribute * doc/plugins.texi Documented register_attribute and PLUGIN_ATTRIBUTES * gcc-plugin.h Added forward decl for register_attribute * plugin.c Added PLUGIN_ATTRIBUTES boilerplate * plugin.h Added PLUGIN_ATTRIBUTES gcc/testsuite/ * g++.dg/plugin/attribute_plugin-test-1.C Testcase input for custom attributes and decl smashing * g++.dg/plugin/attribute_plugin.c Testcase plugin to test user attributes * g++.dg/plugin/dumb_plugin.c Fixed typo * g++.dg/plugin/plugin.exp Added attribute_plugin test git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147516 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/attribs.c')
-rw-r--r--gcc/attribs.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/gcc/attribs.c b/gcc/attribs.c
index df4ca73124d..a7f549e1dc8 100644
--- a/gcc/attribs.c
+++ b/gcc/attribs.c
@@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "langhooks.h"
#include "hashtab.h"
+#include "plugin.h"
static void init_attributes (void);
@@ -182,18 +183,27 @@ init_attributes (void)
for (i = 0; i < ARRAY_SIZE (attribute_tables); i++)
for (k = 0; attribute_tables[i][k].name != NULL; k++)
{
+ register_attribute (&attribute_tables[i][k]);
+ }
+ invoke_plugin_callbacks (PLUGIN_ATTRIBUTES, NULL);
+ attributes_initialized = true;
+}
+
+/* Insert a single ATTR into the attribute table. */
+
+void
+register_attribute (const struct attribute_spec *attr)
+{
struct substring str;
const void **slot;
- str.str = attribute_tables[i][k].name;
- str.length = strlen (attribute_tables[i][k].name);
+ str.str = attr->name;
+ str.length = strlen (str.str);
slot = (const void **)htab_find_slot_with_hash (attribute_hash, &str,
substring_hash (str.str, str.length),
INSERT);
gcc_assert (!*slot);
- *slot = &attribute_tables[i][k];
- }
- attributes_initialized = true;
+ *slot = attr;
}
/* Return the spec for the attribute named NAME. */