This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch,avr] Fix PR59396: Ignore leading '*' in warning generation for ISR names
- From: Georg-Johann Lay <avr at gjlay dot de>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Denis Chertykov <chertykov at gmail dot com>
- Date: Thu, 13 Mar 2014 14:24:06 +0100
- Subject: [patch,avr] Fix PR59396: Ignore leading '*' in warning generation for ISR names
- Authentication-results: sourceware.org; auth=none
This is again a request for approval to fix PR59396.
Problem is that the assembler name might or might not be prefixed by '*'
depending on when TARGET_SET_CURRENT_FUNCTION is called.
The change is just to fix wrong warning because the current implementation of
TARGET_SET_CURRENT_FUNCTION /always/ skips the first char when the assembler
name is set.
A leading '*' is used for handling of leading underscores and I don't intend to
interfere or change that handling in any way. Thus I think changes outside the
avr back are not indicated at all.
The original approval has been denied because the overall '*' handling was not
changed. I still think this is not appropriate in the present case. I am not
aware of any cases where leading underscores does not work as expected. Besides
that avr does not use leading underscores at all.
Moreover, some built-ins (ab)use the assembler name so set the function's name
directly. Again, I don't indent to change that target-independent code in any way.
Thus, ok to apply?
Johann
PR target/59396
* config/avr/avr.c (avr_set_current_function): Skip the first
char of the (assembler) name provided it's a '*'.
Index: config/avr/avr.c
===================================================================
--- config/avr/avr.c (revision 208532)
+++ config/avr/avr.c (working copy)
@@ -600,10 +600,15 @@ avr_set_current_function (tree decl)
const char *name;
name = DECL_ASSEMBLER_NAME_SET_P (decl)
- /* Remove the leading '*' added in set_user_assembler_name. */
- ? 1 + IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl))
+ ? IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl))
: IDENTIFIER_POINTER (DECL_NAME (decl));
+ /* Skip a leading '*' that might still prefix the assembler name,
+ e.g. in non-LTO runs. */
+
+ if (*name == '*')
+ name++;
+
/* Silently ignore 'signal' if 'interrupt' is present. AVR-LibC startet
using this when it switched from SIGNAL and INTERRUPT to ISR. */