summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <scott@adafruit.com>2021-01-11 15:36:12 -0800
committerGitHub <noreply@github.com>2021-01-11 15:36:12 -0800
commitba507a8193447608a685f4e9aabaac3fa3d72e44 (patch)
tree033865e833649a77ec26bbd50eed37b396bac57d
parent10093d37c578d3302ce8e271badfad43fe0a56ec (diff)
parent255ffa979cd62063bcbabbc64e3c4fb8d1c0f216 (diff)
Merge pull request #3957 from dhalbert/gcc10-debug-builds
new CIRCUITPY_DEBUG flag passes DEBUG into C preprocessor
-rw-r--r--py/circuitpy_defns.mk8
-rw-r--r--supervisor/shared/translate.c7
2 files changed, 14 insertions, 1 deletions
diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk
index ca8d548f3..21bd5b965 100644
--- a/py/circuitpy_defns.mk
+++ b/py/circuitpy_defns.mk
@@ -58,6 +58,14 @@ BASE_CFLAGS = \
# -H
+# Set a global CIRCUITPY_DEBUG flag.
+# Don't just call it "DEBUG": too many libraries use plain DEBUG.
+ifneq ($(DEBUG),)
+CFLAGS += -DCIRCUITPY_DEBUG=$(DEBUG)
+else
+CFLAGS += -DCIRCUITPY_DEBUG=0
+endif
+
###
# Handle frozen modules.
diff --git a/supervisor/shared/translate.c b/supervisor/shared/translate.c
index 44544c98d..8bd3c5acd 100644
--- a/supervisor/shared/translate.c
+++ b/supervisor/shared/translate.c
@@ -122,7 +122,12 @@ char* decompress(const compressed_string_t* compressed, char* decompressed) {
return decompressed;
}
-inline __attribute__((always_inline)) const compressed_string_t* translate(const char* original) {
+inline
+// gcc10 -flto has issues with this being always_inline for debug builds.
+#if CIRCUITPY_DEBUG < 1
+ __attribute__((always_inline))
+#endif
+const compressed_string_t* translate(const char* original) {
#ifndef NO_QSTR
#define QDEF(id, str)
#define TRANSLATION(id, firstbyte, ...) if (strcmp(original, id) == 0) { static const compressed_string_t v = { .data = firstbyte, .tail = { __VA_ARGS__ } }; return &v; } else