[Bug target/57631] [patch] spurious warning for avr interrupts with asm labels

gjl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jun 21 13:27:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57631

--- Comment #5 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
(In reply to pebbles from comment #4)
> (In reply to Georg-Johann Lay from comment #3)
>> Would you explain what you are trying to achieve?
> 
> For one thing, I'm coding in C++, so the handlers may be mangled to the
> wrong symbols unless I tell the compiler what to name them.  The warning is
> misleading at least in this case.

The ISR macro is defined by AVR-LibC. It adds extern "C" to ISR if compiled for
C++.  Thus, the handlers are not mangled and names like __vector_<num> are used
even if compiled for C++.

Moreover, you should not use __vector_<num> firectly, use the support macros
from avr/io.h and avr/interrupt.h.  They work for C++.  If not, please file a
bug report against AVR-LibC.

> In C++ it's conventional to place symbols inside namespaces or classes over
> prefixing them with underscores.  I'm writing a library and would like users
> to be able to define the handlers with names and scopes that match the style
> conventions of the project.

Don't use __vector_<num> directly; use defines from AVR-LibC like INT0_vect
etc.  Cf. the AVR-LibC documentation.

>> You can name the function __vectorFOO or __vector_my_ISR_function or
>> whatever without raising a warning.
> 
> But that requires reading the source of GCC, which I have begun doing but is
> usually not a prerequisite for coding.  The warning should tell me that
> straight out.

You should read the documentation of AVR-LibC, of course.  You can add
documentation parts to the GCC documentation if you find it helpful.  However,
users typically read the AVR-LibC manual because ISR and the vector names are
supplyied by AVR-LibC's av/io.h and avr/interrupt.h.



More information about the Gcc-bugs mailing list