macros instead of typedefs in <avr/pgmspace.h>

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It has been discovered recently by the gcc developers, that application of the __progmem__ attribute to typedefs is broken, and the gcc developers refused to fix it, for whatever reason (http://gcc.gnu.org/bugzilla/show... , closed as WON'T FIX).

As a consequence, the header in avr-libc is seen as broken, too, as it contains quite a couple of such typedefs. The proposed fix is to tag the typedefs in it as "deprecated", which has been already implemented in current development version of this file http://svn.savannah.nongnu.org/v... (note that the actual typedefs are in the "not-DOXYGEN" branch and don't match those embedded in the "documentation").

I expressed my concerns in https://savannah.nongnu.org/bugs... and in the avrfreaks post it links to, and suggested using macros instead. This proposal was rejected until "proven as safe" (whatever that means) http://lists.nongnu.org/archive/... .

I would like to ask those, who do use these macros, to try both variants in real-world applications, and comment on them.

My proposed pgmspace.h with the macros is in the appendix (I did not care to doxygenize it).

Note, that if you used to declare pointers to the typedef'd types in your sources then those will warn about "attribute progmem being ignored", but should be harmless otherwise. If you use the PGM_VOID and PGM_P macros, those have been "sanitized" alredy so they won't throw a warning (and should still be OK IMHO). Maybe a set of macros for such pointers as a plan for future should be considered to be added to pgmspace.h, too.

Thanks,

Jan Waclawek

Attachment(s):