avr-libc-dev
[Top][All Lists]
Advanced

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

Re: [avr-libc-dev] [RFC] catching misspeeled signal names


From: Theodore A. Roth
Subject: Re: [avr-libc-dev] [RFC] catching misspeeled signal names
Date: Tue, 20 Apr 2004 11:10:01 -0700 (PDT)

On Tue, 20 Apr 2004, Theodore A. Roth wrote:

> It's not that simple. I changed the patch to do this:
>
> +#if defined (__ASSEMBLER__)
> +#  define _SIG_VECTOR(sig_num, attr) _VECTOR(sig_num)
> +#else
> +#  ifdef __cplusplus
> +#    define _SIG_VECTOR(sig_num, attr)                \
> +extern "C" void _VECTOR(sig_num) (void);              \
> +void _VECTOR(sig_num) (void) __attribute__ ((attr));  \
> +void _VECTOR(sig_num) (void)
> +#  else
> +#    define _SIG_VECTOR(sig_num, attr)                \
> +void _VECTOR(sig_num) (void) __attribute__ ((attr));  \
> +void _VECTOR(sig_num) (void)
> +#  endif
> +#endif
> +
>
> And it still breaks assembler handlers. The problem is that I added args
> to the signal names in the io*.h and defining a handler like this:
>
>   .global SIG_INTERRUPT0
>   SIG_INTERRUPT0:
>       reti
>
> The preprocessor seems to ignore SIG_INTERRUPT0 because it doesn't have
> the arg list with parens. Dmitry noted this, but I had to play with it
> to understand what he was taking about.

I found the reason for this in the cpp info file:

     A function-like macro is only expanded if its name appears with a
  pair of parentheses after it.  If you write just the name, it is left
  alone.  This can be useful when you have a function and a macro of the
  same name, and you wish to use the function sometimes.


---
Ted Roth
PGP Key ID: 0x18F846E9
Jabber ID: address@hidden




reply via email to

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