forked from mirrors/qmk_firmware
Fix build failures with OPT = 0
due to inline functions (#19767)
Co-authored-by: Joel Challis <git@zvecr.com>
This commit is contained in:
parent
b1f4d49c43
commit
584b7cf801
5 changed files with 34 additions and 1 deletions
|
@ -2,6 +2,8 @@ PLATFORM_COMMON_DIR = $(PLATFORM_PATH)/$(PLATFORM_KEY)
|
||||||
|
|
||||||
TMK_COMMON_SRC += \
|
TMK_COMMON_SRC += \
|
||||||
$(PLATFORM_PATH)/suspend.c \
|
$(PLATFORM_PATH)/suspend.c \
|
||||||
|
$(PLATFORM_PATH)/synchronization_util.c \
|
||||||
|
$(PLATFORM_PATH)/timer.c \
|
||||||
$(PLATFORM_COMMON_DIR)/hardware_id.c \
|
$(PLATFORM_COMMON_DIR)/hardware_id.c \
|
||||||
$(PLATFORM_COMMON_DIR)/platform.c \
|
$(PLATFORM_COMMON_DIR)/platform.c \
|
||||||
$(PLATFORM_COMMON_DIR)/suspend.c \
|
$(PLATFORM_COMMON_DIR)/suspend.c \
|
||||||
|
|
17
platforms/synchronization_util.c
Normal file
17
platforms/synchronization_util.c
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright 2023 Sergey Vlasov (@sigprof)
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "synchronization_util.h"
|
||||||
|
|
||||||
|
// Generate out-of-line copies for inline functions defined in synchronization_util.h.
|
||||||
|
|
||||||
|
#if !defined(PLATFORM_SUPPORTS_SYNCHRONIZATION)
|
||||||
|
# if defined(SPLIT_KEYBOARD)
|
||||||
|
extern inline void split_shared_memory_lock(void);
|
||||||
|
extern inline void split_shared_memory_unlock(void);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(SPLIT_KEYBOARD)
|
||||||
|
QMK_IMPLEMENT_AUTOUNLOCK_HELPERS(split_shared_memory)
|
||||||
|
#endif
|
|
@ -29,6 +29,12 @@ inline void split_shared_memory_unlock(void){};
|
||||||
prefix##_unlock(); \
|
prefix##_unlock(); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Generate an out-of-line implementation in case the inline functions defined
|
||||||
|
* by the above macro don't actually get inlined. */
|
||||||
|
#define QMK_IMPLEMENT_AUTOUNLOCK_HELPERS(prefix) \
|
||||||
|
extern inline unsigned prefix##_autounlock_lock_helper(void); \
|
||||||
|
extern inline void prefix##_autounlock_unlock_helper(unsigned* unused_guard);
|
||||||
|
|
||||||
/* Convinience macro the automatically generate the correct RAII-style
|
/* Convinience macro the automatically generate the correct RAII-style
|
||||||
* lock_autounlock function macro */
|
* lock_autounlock function macro */
|
||||||
#define QMK_DECLARE_AUTOUNLOCK_CALL(prefix) unsigned prefix##_guard __attribute__((unused, cleanup(prefix##_autounlock_unlock_helper))) = prefix##_autounlock_lock_helper
|
#define QMK_DECLARE_AUTOUNLOCK_CALL(prefix) unsigned prefix##_guard __attribute__((unused, cleanup(prefix##_autounlock_unlock_helper))) = prefix##_autounlock_lock_helper
|
||||||
|
|
8
platforms/timer.c
Normal file
8
platforms/timer.c
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
// Copyright 2023 Sergey Vlasov (@sigprof)
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "timer.h"
|
||||||
|
|
||||||
|
// Generate out-of-line copies for inline functions defined in timer.h.
|
||||||
|
extern inline fast_timer_t timer_read_fast(void);
|
||||||
|
extern inline fast_timer_t timer_elapsed_fast(fast_timer_t last);
|
|
@ -24,7 +24,7 @@
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "mousekey.h"
|
#include "mousekey.h"
|
||||||
|
|
||||||
inline int8_t times_inv_sqrt2(int8_t x) {
|
static inline int8_t times_inv_sqrt2(int8_t x) {
|
||||||
// 181/256 is pretty close to 1/sqrt(2)
|
// 181/256 is pretty close to 1/sqrt(2)
|
||||||
// 0.70703125 0.707106781
|
// 0.70703125 0.707106781
|
||||||
// 1 too small for x=99 and x=198
|
// 1 too small for x=99 and x=198
|
||||||
|
|
Loading…
Reference in a new issue