This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/63760] New: Support __func__ in PROGMEM


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63760

            Bug ID: 63760
           Summary: Support __func__ in PROGMEM
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mojo at world3 dot net

The C99 __func__ magic variable is defined as:

static const char __func__[] = "function-name";

On architectures such as AVR where there is a distinction between program
memory and RAM this definition is not ideal. It will place the string in RAM,
even though it is constant. Devices using these Harvard style architectures
typically have very little RAM, a few kilobytes at most.

I suggest adding a __funcP__ magic variable that is defined as:

static const char __funcP__[] PROGMEM = "function-name";

That way the string will end up in program memory, which is almost always much
larger than available RAM and is commonly used for the storage of constant
strings.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]