Skip to content
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

Fixed __ATTR_PROGMEM__ by utilizing the variant available in clang #887

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions include/avr/pgmspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,18 @@
#endif

#ifndef __ATTR_PROGMEM__
#if defined __has_attribute
#if __has_attribute(__progmem__)
KOLANICH marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That won't work either when !__has_attribute, because then PROGMEM will not be defined. Why not just leave the GCC stuff untouched and do you clang stuff? Like:

#ifndef __ATTR_PROGMEM__
#ifdef __clang_version__
/* do clang stuff */
#else
#define __ATTR_PROGMEM__ __attribute__((__progmem__))
#endif
#endif

#define __ATTR_PROGMEM__ __attribute__((__progmem__))
#endif
#endif
#endif

#ifndef __ATTR_PROGMEM__
#ifdef __clang_version__
#define __ATTR_PROGMEM__ __flash // not really an attr
#endif
#endif

#ifndef __ATTR_PURE__
#define __ATTR_PURE__ __attribute__((__pure__))
Expand Down