1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-14 03:10:47 +00:00
freebsd-ports/devel/avr-gcc/files/patch-misspelled-signames
Joerg Wunsch 55cd38c9e0 Add support for the AT90CAN32/64 controllers.
By the same time, also drag in the patch for catching
misspelled interrupt vector names from the 4.x branch of
GCC.
2005-11-04 20:51:33 +00:00

47 lines
1.7 KiB
Plaintext

2004-05-12 Theodore A. Roth <troth@openavr.org>
* 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;