[aspectc-user] keyword volatile and bid structures
Olaf Spinczyk
os at aspectc.org
Sun Oct 26 10:51:47 CET 2008
Hello Jörg,
this problem is related to the new (and still experimental) static type
introspection mechanism of AspectC++. I will look into that problem today.
- Olaf
J. Liebig schrieb:
> Hi everyone,
>
> I'm using AspectC++ for static introductions (via slice classes)
> to existing structures, that contain bitstructures. The weaving
> works fine, but when I try to compile, it fails with:
>
> avr-gcc -o main -mmcu=at90can128 -O2 main.cc
> Led.ah: In member function 'const void* LED0::__attr(unsigned int) const':
> Led.ah:26: error: invalid conversion from 'const volatile void*' to
> 'const void*'
> Led.ah:26: error: attempt to take address of bit-field structure member
> 'LED0::LEDPIN'
> Led.ah:26: error: attempt to take address of bit-field structure member
> 'LED0::LEDDDR'
> Led.ah:26: error: attempt to take address of bit-field structure member
> 'LED0::LEDPORT'
>
> I'm using:
> ac++ 1.0pre4 svn (Jul 9 2008) and
> gcc version 4.0.2
>
>
>
> The examle is as follows:
> // Led.h
> #include <inttypes.h>
>
> class LED0 {
> public:
> volatile uint8_t _pad[0x20];
>
> // PINA
> volatile uint8_t
> LEDPIN : 1,
> : 7;
>
> // DDRA
> volatile uint8_t
> LEDDDR : 1,
> : 7;
>
> // PORTA
> volatile uint8_t
> LEDPORT : 1,
> : 7;
> };
>
>
> // Led.ah
> #ifndef __LED_AH__
> #define __LED_AH__
>
> aspect Led {
> pointcut ledfunc() = "LED%";
>
> advice ledfunc() : slice class S {
> public:
> S() {
> LEDPORT = 0;
> LEDDDR = 1;
> }
>
> void on() {
> LEDPORT = 1;
> }
>
> void off() {
> LEDPORT = 0;
> }
> };
> };
>
> #endif // __LED_AH__
>
>
>
> // main.cc
> #include "Led.h"
>
> int main(int argc, char** argv) {
> LED0& l0 = *((LED0*) 0x00);
> l0.on();
>
> while(1)
> ;
> }
>
>
> kind regards
> Joerg Liebig
>
> _______________________________________________
> aspectc-user mailing list
> aspectc-user at aspectc.org
> http://www.aspectc.org/mailman/listinfo/aspectc-user
>
>
More information about the aspectc-user
mailing list