Skip to content

deprecated typedef avr-libc v1.8.0 [imported] #795

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cmaglie opened this issue Nov 15, 2012 · 0 comments
Closed

deprecated typedef avr-libc v1.8.0 [imported] #795

cmaglie opened this issue Nov 15, 2012 · 0 comments

Comments

@cmaglie
Copy link
Member

cmaglie commented Nov 15, 2012

This is Issue 795 moved from a Google Code project.
Added by 2012-01-17T16:26:38.000Z by [email protected].
Please review that bug for more context and additional comments, but update this bug.
Closed (Fixed).

Original labels: Type-Defect, Priority-Medium, Component-Core, Milestone-1.0.1

Original description

There is a deprecated typedef in avr-gcc v1.8.0 that is apparently causing problems with Arduino IDE V1.0. Here is the error it generates:

/home/thomas/arduino/arduino-1.0/hardware/arduino/cores/arduino/Print.cpp: In member function 'size_t Print::print(const __FlashStringHelper*)':
/home/thomas/arduino/arduino-1.0/hardware/arduino/cores/arduino/Print.cpp:44:9: error: 'prog_char' does not name a type
/home/thomas/arduino/arduino-1.0/hardware/arduino/cores/arduino/Print.cpp:47:23: error: 'p' was not declared in this scope

I believe it is due to this deprecated typedef in pgmspace.h in avr-libc v1.8.0. Here is the entry from pgmspace.h:

/**
\ingroup avr_pgmspace
\typedef prog_char
\note DEPRECATED

This typedef is now deprecated because the usage of the progmem
attribute on a type is not supported in GCC. However, the use of the
progmem attribute on a variable declaration is supported, and this is
now the recommended usage.

The typedef is only visible if the macro PROG_TYPES_COMPAT
has been defined before including <avr/pgmspace.h> (either by a
#define directive, or by a -D compiler option.)

Type of a "char" object located in flash ROM.
*/
typedef char PROGMEM prog_char;

The data type prog_char is no longer valid without the macro. It appears the solution would be to replace the data type "prog_char" with "char PROGMEM" in
Print:print(const _FlashStringHelper*)

@cmaglie cmaglie closed this as completed Nov 15, 2012
matthijskooijman added a commit to matthijskooijman/Arduino that referenced this issue Nov 28, 2013
On later versions of avr-libc, prog_char is deprecated. In 0acebee
the one occurence of prog_char was replaced by "char PROGMEM", which is
not entirely correct (PROGMEM is supposed to be an attribute on a
variable, not on a type, even though this is how things work in older
libc versions). However, in 1130fed a few new occurences of
prog_char are introduced, which break compilation on newer libc versions
again.

This commit changes all these pointer types to use the PGM_P macro from
<avr/pgmspace.h>. This macro is just "const char *" in newer libc
versions and "const prog_char *" in older versions, so it should always
work.

References arduino#795
cmaglie pushed a commit that referenced this issue Jan 5, 2014
On later versions of avr-libc, prog_char is deprecated. In 0acebee
the one occurence of prog_char was replaced by "char PROGMEM", which is
not entirely correct (PROGMEM is supposed to be an attribute on a
variable, not on a type, even though this is how things work in older
libc versions). However, in 1130fed a few new occurences of
prog_char are introduced, which break compilation on newer libc versions
again.

This commit changes all these pointer types to use the PGM_P macro from
<avr/pgmspace.h>. This macro is just "const char *" in newer libc
versions and "const prog_char *" in older versions, so it should always
work.

References #795
ollie1400 pushed a commit to ollie1400/Arduino that referenced this issue May 2, 2022
On later versions of avr-libc, prog_char is deprecated. In 0acebee
the one occurence of prog_char was replaced by "char PROGMEM", which is
not entirely correct (PROGMEM is supposed to be an attribute on a
variable, not on a type, even though this is how things work in older
libc versions). However, in 1130fed a few new occurences of
prog_char are introduced, which break compilation on newer libc versions
again.

This commit changes all these pointer types to use the PGM_P macro from
<avr/pgmspace.h>. This macro is just "const char *" in newer libc
versions and "const prog_char *" in older versions, so it should always
work.

References arduino#795
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant