diff options
| author | marekm <marekm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-11-28 23:15:59 +0000 |
|---|---|---|
| committer | marekm <marekm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-11-28 23:15:59 +0000 |
| commit | 7a238e401151eade52f6ce27fd1509eff43d6cfd (patch) | |
| tree | feb1f0e90b043949cc205fc5048072449cc143c6 | |
| parent | 3ad5a5441e1cb714efe886e7218c0d8a5331209f (diff) | |
| download | ppe42-gcc-7a238e401151eade52f6ce27fd1509eff43d6cfd.tar.gz ppe42-gcc-7a238e401151eade52f6ce27fd1509eff43d6cfd.zip | |
* config/avr/avr.c (avr_handle_fndecl_attribute): Generate a
warning if the function name does not begin with "__vector" and the
function has either the 'signal' or 'interrupt' attribute.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@91433 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 6 | ||||
| -rw-r--r-- | gcc/config/avr/avr.c | 26 |
2 files changed, 32 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4d4cad0d06c..591a97cad42 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2004-11-28 Theodore A. Roth <troth@openavr.org> + * config/avr/avr.c (avr_handle_fndecl_attribute): Generate a + warning if the function name does not begin with "__vector" and the + function has either the 'signal' or 'interrupt' attribute. + +2004-11-28 Theodore A. Roth <troth@openavr.org> + * config/avr/avr.c (avr_mcu_types): Add entries for atmega48, atmega88, atmega168, attiny13, attiny2313, at90can128, atmega165, atmega325, atmega3250, atmega645 and atmega6450. diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index a00e3b1ab2b..6ea3303cf7b 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -4545,6 +4545,32 @@ avr_handle_fndecl_attribute (tree *node, tree name, IDENTIFIER_POINTER (name)); *no_add_attrs = true; } + else + { + const char *func_name = IDENTIFIER_POINTER (DECL_NAME (*node)); + const char *attr = IDENTIFIER_POINTER (name); + + /* If the function has the 'signal' or 'interrupt' attribute, test to + make sure that the name of the function is "__vector_NN" so as to + catch when the user misspells the interrupt vector name. */ + + if (strncmp (attr, "interrupt", strlen ("interrupt")) == 0) + { + if (strncmp (func_name, "__vector", strlen ("__vector")) != 0) + { + warning ("`%s' appears to be a misspelled interrupt handler", + func_name); + } + } + else if (strncmp (attr, "signal", strlen ("signal")) == 0) + { + if (strncmp (func_name, "__vector", strlen ("__vector")) != 0) + { + warning ("`%s' appears to be a misspelled signal handler", + func_name); + } + } + } return NULL_TREE; } |

