-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
pgm_read_*: cast address to const void* #4619
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
53a576b
pgm_read_*: cast address to const void*
d-a-v a055e4a
casting pgm_read_+* only with __PROG_TYPES_COMPAT__, also add <avr/pg…
d-a-v e3ff5ea
Merge branch 'master' into 4572
devyte 9c9e74c
restrict usage of prog_* deprecated typedefs to when __PROG_TYPES_COM…
d-a-v 259b63c
Merge branch 'master' into 4572
d-a-v File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "../pgmspace.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(deleted an earlier comment after seeing the reference to
__PROG_TYPES_COMPAT__
in the original issue).Looking at https://www.nongnu.org/avr-libc/user-manual/group__avr__pgmspace.html,
__PROG_TYPES_COMPAT__
is used for different purpose (to enable some typedefs) than used here. Therefore suggest using a different name.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the esp8266 pgmspace.h always creates all the deprecated AVR pgmspace types that this define enables in the AVR version, this name seems ok for this usage to me. i.e. from a user perspective setting this define ensures you get the deprecated progmem types as well as the old behavior that was present when those types existed.
i.e. it provides full AVR compatibility including the old types.
I guess technically to be fully compatible with the AVR version the deprecated AVR pgmspace types should also be removed in the esp8266 version if the define is not set but currently the deprecated types always exist in the esp8266 version - which is a difference but is likely to be pretty harmless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bperrybap I guess you made it through, merge is coming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been following along. Everything seems reasonable for very close compatibility.
It may inadvertently trip up some existing esp8266 users that were depending on the deprecated progmem types, but overall it seems great.
The only last potential remaining item for complete AVR pgmspace.h emulation is the location of the header file itself since with avr-gcc pgmspace.h is in a subdirectory named "avr" since some Arduino code include
On my test/development system I have 80 Arduino libraries installed.
about 20 of those 80 include <avr/pgmspace.h>
Here is grep search for them on my system:
(several may have other esp8266 issues, but still there is significant percentage of libraries using this location)
This one may be a bit more tricky since I've seen that a few library authors have already gone in and modified their code with ifdefs for the different location on esp8266.
With newer Arduino IDEs, pgmspace.h does not have to be included at all but, it still has to be included to support older Arduino IDEs.
What esp8266 could do is add a new header file avr/pgmspace.h that simply includes the real <pgmspace.h> header file so it works either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, you already have included in the merged PR :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. I see that now. Sorry I missed that. I only saw the diffs in the header file itself.
Very complete - very nice.