diff options
| author | Pablo MartÃnez | 2025-05-22 15:31:15 +0200 |
|---|---|---|
| committer | GitHub | 2025-05-22 15:31:15 +0200 |
| commit | 955809bd5aee8b1444595b450eeeef1f42799995 (patch) | |
| tree | 08da1f696605925286f681a2b738fa5f35cd0386 /lib | |
| parent | fa24b0fcce2c5f3330f2d798c3caf91a130babdb (diff) | |
Add `compiler_support.h` (#25274)
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/fnv/qmk_fnv_type_validation.c | 9 | ||||
| -rw-r--r-- | lib/python/qmk/cli/generate/community_modules.py | 6 |
2 files changed, 9 insertions, 6 deletions
diff --git a/lib/fnv/qmk_fnv_type_validation.c b/lib/fnv/qmk_fnv_type_validation.c index e8576617ba..5e8ef5c54c 100644 --- a/lib/fnv/qmk_fnv_type_validation.c +++ b/lib/fnv/qmk_fnv_type_validation.c @@ -1,14 +1,15 @@ // Copyright 2022 Nick Brassel (@tzarc) // SPDX-License-Identifier: GPL-2.0-or-later #include "fnv.h" +#include "compiler_support.h" // This library was originally sourced from: // http://www.isthe.com/chongo/tech/comp/fnv/index.html // // Version at the time of retrieval on 2022-06-26: v5.0.3 -_Static_assert(sizeof(long long) == 8, "long long should be 64 bits"); -_Static_assert(sizeof(unsigned long long) == 8, "unsigned long long should be 64 bits"); +STATIC_ASSERT(sizeof(long long) == 8, "long long should be 64 bits"); +STATIC_ASSERT(sizeof(unsigned long long) == 8, "unsigned long long should be 64 bits"); -_Static_assert(sizeof(Fnv32_t) == 4, "Fnv32_t should be 32 bits"); -_Static_assert(sizeof(Fnv64_t) == 8, "Fnv64_t should be 64 bits"); +STATIC_ASSERT(sizeof(Fnv32_t) == 4, "Fnv32_t should be 32 bits"); +STATIC_ASSERT(sizeof(Fnv64_t) == 8, "Fnv64_t should be 64 bits"); diff --git a/lib/python/qmk/cli/generate/community_modules.py b/lib/python/qmk/cli/generate/community_modules.py index 1f37b760ca..a5ab61f9bd 100644 --- a/lib/python/qmk/cli/generate/community_modules.py +++ b/lib/python/qmk/cli/generate/community_modules.py @@ -52,7 +52,7 @@ def _render_keycodes(module_jsons): lines.append('') lines.append(' LAST_COMMUNITY_MODULE_KEY') lines.append('};') - lines.append('_Static_assert((int)LAST_COMMUNITY_MODULE_KEY <= (int)(QK_COMMUNITY_MODULE_MAX+1), "Too many community module keycodes");') + lines.append('STATIC_ASSERT((int)LAST_COMMUNITY_MODULE_KEY <= (int)(QK_COMMUNITY_MODULE_MAX+1), "Too many community module keycodes");') return lines @@ -215,9 +215,11 @@ def generate_community_modules_h(cli): '#include <stdbool.h>', '#include <keycodes.h>', '', + '#include "compiler_support.h"', + '', '#define COMMUNITY_MODULES_API_VERSION_BUILDER(ver_major,ver_minor,ver_patch) (((((uint32_t)(ver_major))&0xFF) << 24) | ((((uint32_t)(ver_minor))&0xFF) << 16) | (((uint32_t)(ver_patch))&0xFF))', f'#define COMMUNITY_MODULES_API_VERSION COMMUNITY_MODULES_API_VERSION_BUILDER({ver_major},{ver_minor},{ver_patch})', - f'#define ASSERT_COMMUNITY_MODULES_MIN_API_VERSION(ver_major,ver_minor,ver_patch) _Static_assert(COMMUNITY_MODULES_API_VERSION_BUILDER(ver_major,ver_minor,ver_patch) <= COMMUNITY_MODULES_API_VERSION, "Community module requires a newer version of QMK modules API -- needs: " #ver_major "." #ver_minor "." #ver_patch ", current: {api_version}.")', + f'#define ASSERT_COMMUNITY_MODULES_MIN_API_VERSION(ver_major,ver_minor,ver_patch) STATIC_ASSERT(COMMUNITY_MODULES_API_VERSION_BUILDER(ver_major,ver_minor,ver_patch) <= COMMUNITY_MODULES_API_VERSION, "Community module requires a newer version of QMK modules API -- needs: " #ver_major "." #ver_minor "." #ver_patch ", current: {api_version}.")', '', 'typedef struct keyrecord_t keyrecord_t; // forward declaration so we don\'t need to include quantum.h', '', |