Browse Source

tests: fix device-only macro

pull/2552/head
Maxim Prokhorov 1 year ago
parent
commit
74ad71bf74
2 changed files with 9 additions and 0 deletions
  1. +8
    -0
      code/espurna/types.h
  2. +1
    -0
      code/test/unit/CMakeLists.txt

+ 8
- 0
code/espurna/types.h View File

@ -341,19 +341,27 @@ inline String operator+=(String& lhs, StringView rhs) {
return lhs;
}
#ifndef PROGMEM_STRING_ATTR
#define PROGMEM_STRING_ATTR __attribute__((section( "\".irom0.pstr." __FILE__ "." __STRINGIZE(__LINE__) "." __STRINGIZE(__COUNTER__) "\", \"aSM\", @progbits, 1 #")))
#endif
#ifndef PROGMEM_STRING
#define PROGMEM_STRING(NAME, X)\
alignas(4) static constexpr char NAME[] PROGMEM_STRING_ATTR = (X)
#endif
#ifndef STRING_VIEW
#define STRING_VIEW(X) ({\
alignas(4) static constexpr char __pstr__[] PROGMEM_STRING_ATTR = (X);\
::espurna::StringView{__pstr__};\
})
#endif
#ifndef STRING_VIEW_INLINE
#define STRING_VIEW_INLINE(NAME, X)\
alignas(4) static constexpr char __pstr__ ## NAME ## __ [] PROGMEM_STRING_ATTR = (X);\
constexpr auto NAME = ::espurna::StringView(__pstr__ ## NAME ## __)
#endif
} // namespace espurna

+ 1
- 0
code/test/unit/CMakeLists.txt View File

@ -22,6 +22,7 @@ set(COMMON_FLAGS
-g
-fno-common
-funsigned-char
-DPROGMEM_STRING_ATTR=
-DCORE_MOCK
-DHOST_MOCK=1
-DLWIP_IPV6=0


Loading…
Cancel
Save