bugAVR C Runtime Library - Bugs: bug #33716, pgmspace typedefs not legal


bug #33716: pgmspace typedefs not legal

Submitted by:  Bill Westfield <westfw>
Submitted on:  Tue 05 Jul 2011 09:48:34 AM UTC  
Category:  Header Severity:  3 - Normal
Priority:  9 - Immediate Item Group:  None
Status:  In Progress Assigned to:  None
Percent Complete:  50% Open/Closed:  Open
Release:  1.7.* Fixed Release:  None

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Mon 26 Sep 2011 06:48:12 PM UTC, comment #3: 

Rather than deprecating the typedefs in pgmspace.h, I would suggest to replace them by respective macros.

The reason for this is, that those typedefs are provided as a convenience for users, who would like to have the simplest possible means for placing variables into the code memory (and maybe also as a basis for writing universal code which could be migrated between different AVR C compilers). I accept the fact that the progmem typedefs are broken and the developers refuse to fix them, and I accept it in the hope that the real named spaces will be available soon. Those typedefs/macros would then provide also a seamless migration path to the new way of placing/accessing such variables.

Otherwise, a large amount of existing code - including examples in the documentation - will start to throw those warnings quite unnecessarily.

I here repeat what I've already said in http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=871000#871000

Jan Waclawek

Jan Waclawek <wek>
Mon 26 Sep 2011 03:46:45 PM UTC, comment #2: 

Committed changes in pgmspace.h to deprecate the typedefs with _progmem_ attribute, and documentation to match.

Need to:
- Check if any other places need deprecation.
- See if other places in avr-libc use the deprecated typedefs and fix accordingly.

Eric Weddington <arcanum>
Project Administrator
Sat 09 Jul 2011 10:25:31 AM UTC, comment #1: 

As Bill already wrote, attribute progmem just works by accident in avr-gcc ( and not at all in avr-g++).

It appears that
   const prog_char c = 'a';
works for C and not for C++.  However, there is no support for progmem in types it in avr-gcc and there is no guarantee that it will work for any code imagineable.

I highly recommend to deprecate types like prog_char:

typedef char _attribute_((progmem,deprecated)) prog_char;


typedef char _attribute_((progmem,deprecated("message"))) prog_char;

Notice that despite "progmem", "deprecated" is documented for types.

As the next release of avr-libc will come with bulk of poison, anyway, this bit of deprecation won't hurt and will help users to write more robust code.


Georg-Johann Lay <gjlayde>
Tue 05 Jul 2011 09:48:34 AM UTC, original submission:  

Apparently, "__attribute__((progmem))" is not supported by avr-gcc in association with types, but only with actual variables.  This makes about half of avr/pgmspace.h (and associated documentation?) useless (or at least subject to becoming useless at any time.)

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

Bill Westfield <westfw>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by wek (Posted a comment)
  • -email is unavailable- added by arcanum (Posted a comment)
  • -email is unavailable- added by gjlayde (Posted a comment)
  • -email is unavailable- added by westfw (Submitted the item)
  • -email is unavailable- added by westfw



    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-11-16 arcanum Priority5 - Normal => 9 - Immediate
    2011-09-26 arcanum StatusNone => In Progress
        Percent Complete0% => 50%
    2011-07-05 westfw Carbon-Copy- => Added westfw

    Back to the top

    Powered by Savane 3.7