|
16 | 16 | #include "pico/binary_info/structure.h" |
17 | 17 |
|
18 | 18 | #if !PICO_NO_BINARY_INFO |
19 | | -#define __bi_decl(name, bi, section_prefix, attr) static const attr __attribute__((section(section_prefix __STRING(name)))) struct _binary_info_core *name = bi |
| 19 | +#define __bi_decl(name, bi, section_prefix, attr) static const attr __attribute__((section(section_prefix __STRING(name)))) struct _binary_info_core *const name = bi |
20 | 20 | #define __bi_lineno_var_name __CONCAT(__bi_, __LINE__) |
21 | 21 | #define __bi_ptr_lineno_var_name __CONCAT(__bi_ptr, __LINE__) |
22 | 22 | #define __bi_enclosure_check_lineno_var_name __CONCAT(_error_bi_is_missing_enclosing_decl_,__LINE__) |
23 | 23 | #define __bi_mark_enclosure static const __unused int __bi_enclosure_check_lineno_var_name=0; |
24 | | -#if !defined(__GNUC__) || __cplusplus || __GNUC__ >= 8 |
| 24 | +#if __cplusplus || __GNUC__ >= 8 |
25 | 25 | #define __bi_enclosure_check(x) (x + __bi_enclosure_check_lineno_var_name) |
26 | 26 | #else |
27 | 27 | // skip the version check on older GCC non C++, as it doesn't compile.. this is only here to catch the |
|
39 | 39 | * binary information declared this way will also be stripped |
40 | 40 | * \ingroup pico_binary_info |
41 | 41 | */ |
42 | | -#define bi_decl_if_func_used(_decl) ({__bi_mark_enclosure _decl; __bi_decl(__bi_ptr_lineno_var_name, &__bi_lineno_var_name.core, ".binary_info.", ); *(volatile uint8_t *)&__bi_ptr_lineno_var_name;}); |
| 42 | +#define bi_decl_if_func_used(_decl) ({__bi_mark_enclosure _decl; __bi_decl(__bi_ptr_lineno_var_name, &__bi_lineno_var_name.core, ".binary_info.", ); *(const volatile uint8_t *)&__bi_ptr_lineno_var_name;}); |
43 | 43 |
|
44 | 44 | #define bi_decl_with_attr(_decl, _attr) __bi_mark_enclosure _attr _decl; __bi_decl(__bi_ptr_lineno_var_name, &__bi_lineno_var_name.core, ".binary_info.keep.", __used); |
45 | | -#define bi_decl_if_func_used_with_attr(_decl, _attr) ({__bi_mark_enclosure _attr _decl; __bi_decl(__bi_ptr_lineno_var_name, &__bi_lineno_var_name.core, ".binary_info.", ); *(volatile uint8_t *)&__bi_ptr_lineno_var_name;}); |
| 45 | +#define bi_decl_if_func_used_with_attr(_decl, _attr) ({__bi_mark_enclosure _attr _decl; __bi_decl(__bi_ptr_lineno_var_name, &__bi_lineno_var_name.core, ".binary_info.", ); *(const volatile uint8_t *)&__bi_ptr_lineno_var_name;}); |
46 | 46 | #else |
47 | 47 | #define __bi_decl(bi, name, attr) |
48 | 48 | #define bi_decl_with_attr(_decl, _attr) |
|
0 commit comments