aboutsummaryrefslogtreecommitdiff
path: root/gcc/treelang
diff options
context:
space:
mode:
authorJames A. Morrison <phython@gcc.gnu.org>2005-11-07 06:54:52 +0000
committerJames A. Morrison <phython@gcc.gnu.org>2005-11-07 06:54:52 +0000
commit7d4a2fb0d447052ad39ac104dd6915116c091c22 (patch)
tree87a99f56a55ad99e365d332992dc0743c4f5c904 /gcc/treelang
parent96c993a8902b5579e463de5aa60855ee304bfce6 (diff)
downloadgcc-7d4a2fb0d447052ad39ac104dd6915116c091c22.zip
gcc-7d4a2fb0d447052ad39ac104dd6915116c091c22.tar.gz
gcc-7d4a2fb0d447052ad39ac104dd6915116c091c22.tar.bz2
re PR ada/21952 (Annoying "attribute directive ignored" warnings)
2005-11-07 James A. Morrison <phython@gcc.gnu.org> PR treelang/21952 * treetree.c (LANG_HOOKS_ATTRIBUTE_TABLE): Set to treelang_attribute_table. (handle_attribute): New function. (treelang_attribute_table): New attribute table. From-SVN: r106582
Diffstat (limited to 'gcc/treelang')
-rw-r--r--gcc/treelang/ChangeLog8
-rw-r--r--gcc/treelang/treetree.c35
2 files changed, 41 insertions, 2 deletions
diff --git a/gcc/treelang/ChangeLog b/gcc/treelang/ChangeLog
index 4505683..d38a8a2 100644
--- a/gcc/treelang/ChangeLog
+++ b/gcc/treelang/ChangeLog
@@ -1,3 +1,11 @@
+2005-11-07 James A. Morrison <phython@gcc.gnu.org>
+
+ PR treelang/21952
+ * treetree.c (LANG_HOOKS_ATTRIBUTE_TABLE): Set to
+ treelang_attribute_table.
+ (handle_attribute): New function.
+ (treelang_attribute_table): New attribute table.
+
2005-09-23 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
* parse.y : Changed pointer declaration from "type* var" to "type *var"
diff --git a/gcc/treelang/treetree.c b/gcc/treelang/treetree.c
index d7b4d8e..b783ded 100644
--- a/gcc/treelang/treetree.c
+++ b/gcc/treelang/treetree.c
@@ -139,8 +139,10 @@ static tree* getstmtlist (void);
/* Langhooks. */
static tree builtin_function (const char *name, tree type, int function_code,
- enum built_in_class class, const char *library_name,
- tree attrs);
+ enum built_in_class class,
+ const char *library_name,
+ tree attrs);
+extern const struct attribute_spec treelang_attribute_table[];
static tree getdecls (void);
static int global_bindings_p (void);
static void insert_block (tree);
@@ -166,6 +168,8 @@ static void treelang_expand_function (tree fndecl);
#define LANG_HOOKS_TYPE_FOR_SIZE tree_lang_type_for_size
#undef LANG_HOOKS_PARSE_FILE
#define LANG_HOOKS_PARSE_FILE treelang_parse_file
+#undef LANG_HOOKS_ATTRIBUTE_TABLE
+#define LANG_HOOKS_ATTRIBUTE_TABLE treelang_attribute_table
#undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION
#define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION treelang_expand_function
@@ -1194,6 +1198,33 @@ treelang_init_decl_processing (void)
pedantic_lvalues = pedantic;
}
+static tree
+handle_attribute (tree *node, tree name, tree ARG_UNUSED (args),
+ int ARG_UNUSED (flags), bool *no_add_attrs)
+{
+ if (TREE_CODE (*node) == FUNCTION_DECL)
+ {
+ if (strcmp (IDENTIFIER_POINTER (name), "const") == 0)
+ TREE_READONLY (*node) = 1;
+ if (strcmp (IDENTIFIER_POINTER (name), "nothrow") == 0)
+ TREE_NOTHROW (*node) = 1;
+ }
+ else
+ {
+ warning (OPT_Wattributes, "%qD attribute ignored", name);
+ *no_add_attrs = true;
+ }
+
+ return NULL_TREE;
+}
+
+const struct attribute_spec treelang_attribute_table[] =
+{
+ { "const", 0, 0, true, false, false, handle_attribute },
+ { "nothrow", 0, 0, true, false, false, handle_attribute },
+ { NULL, 0, 0, false, false, false, NULL },
+};
+
/* Return a definition for a builtin function named NAME and whose data type
is TYPE. TYPE should be a function type with argument types.
FUNCTION_CODE tells later passes how to compile calls to this function.