diff options
author | Danny Smith <dannysmith@users.sourceforge.net> | 2006-08-20 08:46:13 +0000 |
---|---|---|
committer | Danny Smith <dannysmith@gcc.gnu.org> | 2006-08-20 08:46:13 +0000 |
commit | 09416794b764ccb7a7b52fa3ef04a97692a8fcb2 (patch) | |
tree | 26a4e207b3099822df6d3fef23730184c651c6b8 /gcc/tree.c | |
parent | 3e978d3094f29abe03d271d63cdc16930c5e51de (diff) | |
download | gcc-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.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -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)) |