diff options
author | Jozef Lawrynowicz <jozefl@gcc.gnu.org> | 2018-12-29 19:00:48 +0000 |
---|---|---|
committer | Jozef Lawrynowicz <jozefl@gcc.gnu.org> | 2018-12-29 19:00:48 +0000 |
commit | 600845521e68b5e0da136636ecf174eee8e5ee17 (patch) | |
tree | 4ef6cf8d348615502582a0545e6f652557e462c0 /gcc/config | |
parent | 74ee24e23e96dde8a338a140c3cadd0bb7715e61 (diff) | |
download | gcc-600845521e68b5e0da136636ecf174eee8e5ee17.zip gcc-600845521e68b5e0da136636ecf174eee8e5ee17.tar.gz gcc-600845521e68b5e0da136636ecf174eee8e5ee17.tar.bz2 |
msp430.c (msp430_attr): Warn when the critical and interrupt function attributes are used together.
2018-12-29 Jozef Lawrynowicz <jozef.l@mittosystems.com>
gcc/ChangeLog:
* config/msp430/msp430.c (msp430_attr): Warn when the critical and
interrupt function attributes are used together.
* gcc/doc/extend.texi: Update documentation on the critical attribute.
gcc/testsuite/ChangeLog:
* gcc.target/msp430/critical-interrupt.c: New test.
From-SVN: r267467
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/msp430/msp430.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c index 3a41cc0..21b5819 100644 --- a/gcc/config/msp430/msp430.c +++ b/gcc/config/msp430/msp430.c @@ -1946,6 +1946,13 @@ msp430_attr (tree * node, TREE_USED (* node) = 1; DECL_PRESERVE_P (* node) = 1; } + if (is_critical_func (* node)) + { + warning (OPT_Wattributes, + "critical attribute has no effect on interrupt functions"); + DECL_ATTRIBUTES (*node) = remove_attribute (ATTR_CRIT, + DECL_ATTRIBUTES (* node)); + } } else if (TREE_NAME_EQ (name, ATTR_REENT)) { @@ -1960,6 +1967,8 @@ msp430_attr (tree * node, message = "naked functions cannot be critical"; else if (is_reentrant_func (* node)) message = "reentrant functions cannot be critical"; + else if (is_interrupt_func ( *node)) + message = "critical attribute has no effect on interrupt functions"; } else if (TREE_NAME_EQ (name, ATTR_NAKED)) { |