Merge pull request #3957 from dhalbert/gcc10-debug-builds

new CIRCUITPY_DEBUG flag passes DEBUG into C preprocessor
This commit is contained in:
Scott Shawcroft 2021-01-11 15:36:12 -08:00 committed by GitHub
commit ba507a8193
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -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.

View File

@ -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