avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Unfounded warnings from the AVR backend (gcc-4.x)


From: Bernd Trog
Subject: [avr-gcc-list] Unfounded warnings from the AVR backend (gcc-4.x)
Date: Tue, 13 Dec 2005 10:45:11 -0800 (PST)

Hello,

when compiling this code:

   procedure My_int;
   pragma Machine_Attribute (My_int, "signal");
   pragma Export (C, My_int, "__vector_1");
   procedure My_int is begin null; end;

with avr-gcc-4.x I get this warning:

demo_ada.adb:9: warning: `demo_ada__my_int' appears to be a misspelled
signal handler

I do not get this warning with gcc-3.4.x.

IMO, this is caused by the misspelled-signames patch
from Theodore A. Roth:

[...]
{
 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 (0, "%qs appears to be a misspelled interrupt handler",
               func_name);
[...]

Ted's patch is a bit too C specific, because it assumes that the source
code function name is equal the symbol name. 
(__vector_1 = __vector_1)

In Ada, the source code function name (demo_ada__my_int) for interrupts is
translated to__vector_xx with the "Pragma Export (..)" statement.
Its not possible to define "__vector_1" as a source code function name. 

Here is a patch that fixes the wrong warning in avr.c:
@@ -4679,7 +4696,7 @@
     }
   else
     {
-      const char *func_name = IDENTIFIER_POINTER (DECL_NAME (*node));
+      const char *func_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME
(*node));
       const char *attr = IDENTIFIER_POINTER (name);

       /* If the function has the 'signal' or 'interrupt' attribute, test to

For more detail see:
http://gcc.gnu.org/onlinedocs/gccint/Function-Basics.html#Function-Basics


Is this patch OK?
Any comments or questions?




__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]