Commit 97e45d9e by Theodore A. Roth Committed by Marek Michalkiewicz

avr.c (avr_handle_fndecl_attribute): Generate a warning if the function name…

avr.c (avr_handle_fndecl_attribute): Generate a warning if the function name does not begin with "__vector" and the...

	* 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.

From-SVN: r91433
parent 35920225
2004-11-28 Theodore A. Roth <troth@openavr.org> 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, * config/avr/avr.c (avr_mcu_types): Add entries for atmega48,
atmega88, atmega168, attiny13, attiny2313, at90can128, atmega165, atmega88, atmega168, attiny13, attiny2313, at90can128, atmega165,
atmega325, atmega3250, atmega645 and atmega6450. atmega325, atmega3250, atmega645 and atmega6450.
......
...@@ -4545,6 +4545,32 @@ avr_handle_fndecl_attribute (tree *node, tree name, ...@@ -4545,6 +4545,32 @@ avr_handle_fndecl_attribute (tree *node, tree name,
IDENTIFIER_POINTER (name)); IDENTIFIER_POINTER (name));
*no_add_attrs = true; *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; return NULL_TREE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment