summaryrefslogtreecommitdiffstats
path: root/platforms/synchronization_util.h
diff options
context:
space:
mode:
authorSergey Vlasov <sigprof@gmail.com>2023-02-12 09:14:34 +0300
committerGitHub <noreply@github.com>2023-02-12 17:14:34 +1100
commit584b7cf801f98d58aefe5a9bbc4a163aba4c1b74 (patch)
tree16a82839ac645b3adf5775377583fbcbd27a8ed5 /platforms/synchronization_util.h
parentb1f4d49c43e5034b44e34c5ee6e2d9a72195e41d (diff)
Fix build failures with `OPT = 0` due to inline functions (#19767)
Co-authored-by: Joel Challis <git@zvecr.com>
Diffstat (limited to 'platforms/synchronization_util.h')
-rw-r--r--platforms/synchronization_util.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/platforms/synchronization_util.h b/platforms/synchronization_util.h
index 59933945c3..4969eff478 100644
--- a/platforms/synchronization_util.h
+++ b/platforms/synchronization_util.h
@@ -29,6 +29,12 @@ inline void split_shared_memory_unlock(void){};
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
* lock_autounlock function macro */
#define QMK_DECLARE_AUTOUNLOCK_CALL(prefix) unsigned prefix##_guard __attribute__((unused, cleanup(prefix##_autounlock_unlock_helper))) = prefix##_autounlock_lock_helper