diff options
author | Georg-Johann Lay <avr@gjlay.de> | 2017-07-12 15:25:07 +0000 |
---|---|---|
committer | Georg-Johann Lay <gjl@gcc.gnu.org> | 2017-07-12 15:25:07 +0000 |
commit | 1bde114aaceb7f423aaafbc62df6e5ba51a15b27 (patch) | |
tree | 9acd4958bf26df7fc73ebacd0d586a342372a534 /gcc | |
parent | 118009c1e5e8d1bce7739f542347ddd994b664a8 (diff) | |
download | gcc-1bde114aaceb7f423aaafbc62df6e5ba51a15b27.zip gcc-1bde114aaceb7f423aaafbc62df6e5ba51a15b27.tar.gz gcc-1bde114aaceb7f423aaafbc62df6e5ba51a15b27.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/config/avr/avr.c | 30 |
2 files changed, 31 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c580394..bdf6e45 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +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 diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index a8978ec..49ebb63 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -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. */ |