Commit 1bde114a by Georg-Johann Lay Committed by Georg-Johann Lay

re PR target/79883 (avr i18n: untranslated "interrupt" or "signal")

	PR target/79883
	* config/avr/avr.c (avr_set_current_function): In diagnostic
	messages: Quote keywords and (parts of) identifiers.
	[WITH_AVRLIBC]: Warn for functions named "ISR", "SIGNAL" or
	"INTERUPT".

From-SVN: r250156
parent 118009c1
2017-07-12 Georg-Johann Lay <avr@gjlay.de>
PR target/79883
* config/avr/avr.c (avr_set_current_function): In diagnostic
messages: Quote keywords and (parts of) identifiers.
[WITH_AVRLIBC]: Warn for functions named "ISR", "SIGNAL" or
"INTERUPT".
2017-07-12 Carl Love <cel@us.ibm.com>
* config/rs6000/rs6000-c.c: Add support for built-in functions
......
......@@ -1076,12 +1076,6 @@ avr_set_current_function (tree decl)
name = default_strip_name_encoding (name);
/* Silently ignore 'signal' if 'interrupt' is present. AVR-LibC startet
using this when it switched from SIGNAL and INTERRUPT to ISR. */
if (cfun->machine->is_interrupt)
cfun->machine->is_signal = 0;
/* Interrupt handlers must be void __vector (void) functions. */
if (args && TREE_CODE (TREE_VALUE (args)) != VOID_TYPE)
......@@ -1090,14 +1084,36 @@ avr_set_current_function (tree decl)
if (TREE_CODE (ret) != VOID_TYPE)
error_at (loc, "%qs function cannot return a value", isr);
#if defined WITH_AVRLIBC
/* Silently ignore 'signal' if 'interrupt' is present. AVR-LibC startet
using this when it switched from SIGNAL and INTERRUPT to ISR. */
if (cfun->machine->is_interrupt)
cfun->machine->is_signal = 0;
/* If the function has the 'signal' or 'interrupt' attribute, ensure
that the name of the function is "__vector_NN" so as to catch
when the user misspells the vector name. */
if (!STR_PREFIX_P (name, "__vector"))
warning_at (loc, OPT_Wmisspelled_isr, "%qs appears to be a misspelled "
"%s handler, missing __vector prefix", name, isr);
"%qs handler, missing %<__vector%> prefix", name, isr);
#endif // AVR-LibC naming conventions
}
#if defined WITH_AVRLIBC
// Common problem is using "ISR" without first including avr/interrupt.h.
const char *name = IDENTIFIER_POINTER (DECL_NAME (decl));
name = default_strip_name_encoding (name);
if (0 == strcmp ("ISR", name)
|| 0 == strcmp ("INTERRUPT", name)
|| 0 == strcmp ("SIGNAL", name))
{
warning_at (loc, OPT_Wmisspelled_isr, "%qs is a reserved indentifier"
" in AVR-LibC. Consider %<#include <avr/interrupt.h>%>"
" before using the %qs macro", name, name);
}
#endif // AVR-LibC naming conventions
/* Don't print the above diagnostics more than once. */
......
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