aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorDanny Smith <dannysmith@users.sourceforge.net>2006-08-20 08:46:13 +0000
committerDanny Smith <dannysmith@gcc.gnu.org>2006-08-20 08:46:13 +0000
commit09416794b764ccb7a7b52fa3ef04a97692a8fcb2 (patch)
tree26a4e207b3099822df6d3fef23730184c651c6b8 /gcc/tree.c
parent3e978d3094f29abe03d271d63cdc16930c5e51de (diff)
downloadgcc-09416794b764ccb7a7b52fa3ef04a97692a8fcb2.zip
gcc-09416794b764ccb7a7b52fa3ef04a97692a8fcb2.tar.gz
gcc-09416794b764ccb7a7b52fa3ef04a97692a8fcb2.tar.bz2
PR target/28648 c:
* tree.c (handle_dll_attribute): Return early if not a var or function decl. testsuite * gcc.dg/attr-invalid.c: Add tests for invalid dllimport. From-SVN: r116270
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 2c95a26..a58c327 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -3706,9 +3706,18 @@ handle_dll_attribute (tree * pnode, tree name, tree args, int flags,
return NULL_TREE;
}
+ if (TREE_CODE (node) != FUNCTION_DECL
+ && TREE_CODE (node) != VAR_DECL)
+ {
+ *no_add_attrs = true;
+ warning (OPT_Wattributes, "%qs attribute ignored",
+ IDENTIFIER_POINTER (name));
+ return NULL_TREE;
+ }
+
/* Report error on dllimport ambiguities seen now before they cause
any damage. */
- if (is_attribute_p ("dllimport", name))
+ else if (is_attribute_p ("dllimport", name))
{
/* Honor any target-specific overrides. */
if (!targetm.valid_dllimport_attribute_p (node))