2004-05-12 Theodore A. Roth * gcc/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. Index: gcc/config/avr/avr.c =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/config/avr/avr.c,v retrieving revision 1.118 diff -u -p -p -r1.118 avr.c --- gcc/config/avr/avr.c 13 Mar 2004 06:43:30 -0000 1.118 +++ gcc/config/avr/avr.c 12 May 2004 19:40:28 -0000 @@ -4566,6 +4559,32 @@ avr_handle_fndecl_attribute (tree *node, warning ("`%s' attribute only applies to functions", 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;