Joerg Wunsch schrieb: > 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];}))
Yes, typo. > 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 ... Ok. But let me add that without changing PSTR as indicated and with PR44643 fixed as proposed, building avr-libc 1.6.8 resp. 1.7.1 will abort because avr-gcc errors on PSTR usage. Thus, it's preferred to update all versions of avr-libc that are supposed to build with gcc 4.7 before adding fix PR44643 to gcc. Johann _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list