Georg-Johann Lay <a...@gjlay.de> wrote:

> This means that at least PSTR in avr-libc from include/avr/pgmspace.h
> must be changed.
> 
> The current avr-libc implementation of PSTR, however, reads
> 
> #define PSTR(s) (__extension__({static char __c[] PROGMEM = (s);
> &__c[0];}))
> 
> Which should read instead
> 
> #define PSTR(s) (__extension__({static char __c[] PROGMEM = (s);
> (const char*) &__c[0];}))
> 
> #define PSTR(s) (__extension__({static char __c[] PROGMEM = (s);
> &__c[0];}))

Hmm, the latter appears to be a typo?  I assume you meant

#define PSTR(s) (__extension__({static const char __c[] \
PROGMEM = (s); &__c[0];}))

That would be my proposal (though I didn't try it yet).

> This means that the patch will most probably trigger bunch of
> warnings/errors on much code in user land.

Hmm, a progmem pointer that is not qualified to point to a const
object does not make sense anyway.  The PSTR() macro is documented
to return a pointer to a const object:

#define PSTR (s)((const PROGMEM char *)(s))

so assigning it to a different pointer has always been a usage error.

I'd say we've survived more annoying (and more benign) warnings like
"pointer target differ in signedness" one in the past ...
-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)

_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to