Skip to content

Commit ba507a8

Browse files
authored
Merge pull request #3957 from dhalbert/gcc10-debug-builds
new CIRCUITPY_DEBUG flag passes DEBUG into C preprocessor
2 parents 10093d3 + 255ffa9 commit ba507a8

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

py/circuitpy_defns.mk

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ BASE_CFLAGS = \
5858
# -H
5959

6060

61+
# Set a global CIRCUITPY_DEBUG flag.
62+
# Don't just call it "DEBUG": too many libraries use plain DEBUG.
63+
ifneq ($(DEBUG),)
64+
CFLAGS += -DCIRCUITPY_DEBUG=$(DEBUG)
65+
else
66+
CFLAGS += -DCIRCUITPY_DEBUG=0
67+
endif
68+
6169
###
6270
# Handle frozen modules.
6371

supervisor/shared/translate.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,12 @@ char* decompress(const compressed_string_t* compressed, char* decompressed) {
122122
return decompressed;
123123
}
124124

125-
inline __attribute__((always_inline)) const compressed_string_t* translate(const char* original) {
125+
inline
126+
// gcc10 -flto has issues with this being always_inline for debug builds.
127+
#if CIRCUITPY_DEBUG < 1
128+
__attribute__((always_inline))
129+
#endif
130+
const compressed_string_t* translate(const char* original) {
126131
#ifndef NO_QSTR
127132
#define QDEF(id, str)
128133
#define TRANSLATION(id, firstbyte, ...) if (strcmp(original, id) == 0) { static const compressed_string_t v = { .data = firstbyte, .tail = { __VA_ARGS__ } }; return &v; } else

0 commit comments

Comments
 (0)