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: HeaderSeverity: 3 - Normal
Priority: 9 - ImmediateItem Group: None
Status: In ProgressPercent Complete: 50%
Assigned to: NoneOpen/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 File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


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

    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 16 Nov 2012 06:56:09 PM UTCarcanumPriority5 - Normal=>9 - Immediate
    Mon 26 Sep 2011 03:46:45 PM UTCarcanumStatusNone=>In Progress
      Percent Complete0%=>50%
    Tue 05 Jul 2011 09:48:34 AM UTCwestfwCarbon-Copy-=>Added westfw

    Back to the top

    Powered by Savane 3.1-cleanup1