aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/epiphany
diff options
context:
space:
mode:
authorJoern Rennecke <joern.rennecke@embecosm.com>2014-05-07 13:21:59 +0000
committerJoern Rennecke <amylaar@gcc.gnu.org>2014-05-07 14:21:59 +0100
commite7b7077e4c32c3e08be50204d87e0a8fc97bd7d2 (patch)
treeb50942c94d70242b6946f591159d1178c4a67ea2 /gcc/config/epiphany
parentc4597c1dd9561a6128fe68247ed0074a27562a4a (diff)
downloadgcc-e7b7077e4c32c3e08be50204d87e0a8fc97bd7d2.zip
gcc-e7b7077e4c32c3e08be50204d87e0a8fc97bd7d2.tar.gz
gcc-e7b7077e4c32c3e08be50204d87e0a8fc97bd7d2.tar.bz2
epiphany.c (epiphany_handle_interrupt_attribute): Emit an error when the function has arguments.
gcc: * config/epiphany/epiphany.c (epiphany_handle_interrupt_attribute): Emit an error when the function has arguments. gcc/testsuite: * gcc.target/epiphany/isr-arg.c: New file. From-SVN: r210157
Diffstat (limited to 'gcc/config/epiphany')
-rw-r--r--gcc/config/epiphany/epiphany.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/gcc/config/epiphany/epiphany.c b/gcc/config/epiphany/epiphany.c
index f3955b9..ebe6f05 100644
--- a/gcc/config/epiphany/epiphany.c
+++ b/gcc/config/epiphany/epiphany.c
@@ -450,15 +450,28 @@ static const struct attribute_spec epiphany_attribute_table[] =
/* Handle an "interrupt" attribute; arguments as in
struct attribute_spec.handler. */
static tree
-epiphany_handle_interrupt_attribute (tree *node ATTRIBUTE_UNUSED,
- tree name, tree args,
+epiphany_handle_interrupt_attribute (tree *node, tree name, tree args,
int flags ATTRIBUTE_UNUSED,
bool *no_add_attrs)
{
tree value;
if (!args)
- return NULL_TREE;
+ {
+ gcc_assert (DECL_P (*node));
+ tree t = TREE_TYPE (*node);
+ if (TREE_CODE (t) != FUNCTION_TYPE)
+ warning (OPT_Wattributes, "%qE attribute only applies to functions",
+ name);
+ /* Argument handling and the stack layout for interrupt handlers
+ don't mix. It makes no sense in the first place, so emit an
+ error for this. */
+ else if (TYPE_ARG_TYPES (t)
+ && TREE_VALUE (TYPE_ARG_TYPES (t)) != void_type_node)
+ error_at (DECL_SOURCE_LOCATION (*node),
+ "interrupt handlers cannot have arguments");
+ return NULL_TREE;
+ }
value = TREE_VALUE (args);