From d71488c017b4ebb932cf2b4a43656e1eda670b23 Mon Sep 17 00:00:00 2001 From: Jozef Lawrynowicz Date: Wed, 6 Jun 2018 11:49:20 +0000 Subject: MSP430: Allow interrupt handlers to be static * gcc/config/msp430/msp430.c (msp430_attr): Allow interrupt handlers to be static and remove check on interrupt attribute name. gcc/testsuite/gcc.target/msp430/ * function-attributes-4.c: New test. * static-interrupts.c: New test. From-SVN: r261229 --- gcc/config/msp430/msp430.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'gcc/config/msp430') diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c index 8c8e676..9051761 100644 --- a/gcc/config/msp430/msp430.c +++ b/gcc/config/msp430/msp430.c @@ -1878,11 +1878,9 @@ msp430_attr (tree * node, { gcc_assert (DECL_P (* node)); + /* Only the interrupt attribute takes an argument. */ if (args != NULL) { - /* Only the interrupt attribute takes an argument. */ - gcc_assert (TREE_NAME_EQ (name, ATTR_INTR)); - tree value = TREE_VALUE (args); switch (TREE_CODE (value)) @@ -1927,13 +1925,12 @@ msp430_attr (tree * node, if (TREE_CODE (TREE_TYPE (* node)) == FUNCTION_TYPE && ! VOID_TYPE_P (TREE_TYPE (TREE_TYPE (* node)))) message = "interrupt handlers must be void"; - - if (! TREE_PUBLIC (* node)) - message = "interrupt handlers cannot be static"; - - /* Ensure interrupt handlers never get optimised out. */ - TREE_USED (* node) = 1; - DECL_PRESERVE_P (* node) = 1; + else + { + /* Ensure interrupt handlers never get optimised out. */ + TREE_USED (* node) = 1; + DECL_PRESERVE_P (* node) = 1; + } } else if (TREE_NAME_EQ (name, ATTR_REENT)) { -- cgit v1.1