From 3e53d215f23aaa3ce9e32bb9a7a5baeed430cea7 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Tue, 14 Nov 2023 11:28:26 -0800 Subject: [PATCH] Porting to a newer GCC, there are stricter constraints on constexpr functions. They now need to contain only a return statement --- plugins/Kaleidoscope-Qukeys/src/kaleidoscope/plugin/Qukeys.h | 3 +-- src/kaleidoscope/KeyAddrBitfield.h | 2 +- src/kaleidoscope/key_defs.h | 4 +--- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/plugins/Kaleidoscope-Qukeys/src/kaleidoscope/plugin/Qukeys.h b/plugins/Kaleidoscope-Qukeys/src/kaleidoscope/plugin/Qukeys.h index 45b483e7e1..6fcf2678f2 100644 --- a/plugins/Kaleidoscope-Qukeys/src/kaleidoscope/plugin/Qukeys.h +++ b/plugins/Kaleidoscope-Qukeys/src/kaleidoscope/plugin/Qukeys.h @@ -46,9 +46,8 @@ namespace kaleidoscope { namespace plugin { constexpr Key ModTapKey(Key mod_key, Key tap_key) { - uint8_t mod = mod_key.getKeyCode() - HID_KEYBOARD_FIRST_MODIFIER; return Key(kaleidoscope::ranges::DUM_FIRST + - (mod << 8) + tap_key.getKeyCode()); + ((mod_key.getKeyCode() - HID_KEYBOARD_FIRST_MODIFIER) << 8) + tap_key.getKeyCode()); } constexpr Key LayerTapKey(uint8_t layer, Key tap_key) { diff --git a/src/kaleidoscope/KeyAddrBitfield.h b/src/kaleidoscope/KeyAddrBitfield.h index 22219a68c8..edf197ee15 100644 --- a/src/kaleidoscope/KeyAddrBitfield.h +++ b/src/kaleidoscope/KeyAddrBitfield.h @@ -50,7 +50,7 @@ class KeyAddrBitfield { static constexpr uint8_t bitIndex(KeyAddr k) { return k.toInt() % block_size; } - static constexpr KeyAddr index(uint8_t block_index, uint8_t bit_index) { + static KeyAddr index(uint8_t block_index, uint8_t bit_index) { uint8_t offset = (block_index * block_size) + bit_index; return KeyAddr(offset); } diff --git a/src/kaleidoscope/key_defs.h b/src/kaleidoscope/key_defs.h index 70a3309985..84d3246e62 100644 --- a/src/kaleidoscope/key_defs.h +++ b/src/kaleidoscope/key_defs.h @@ -273,9 +273,7 @@ constexpr Key addFlags(Key k, uint8_t add_flags) { // ============================================================================= /// Generate a ModLayer key (unchecked) constexpr Key modLayerKey(Key modifier, uint8_t layer) { - uint8_t mod = modifier.getRaw() - Key_LeftControl.getRaw(); - uint8_t code = mod + (layer * 8); - return Key(code, SYNTHETIC | SWITCH_TO_KEYMAP | IS_INTERNAL); + return Key(modifier.getRaw() - Key_LeftControl.getRaw() + (layer * 8), SYNTHETIC | SWITCH_TO_KEYMAP | IS_INTERNAL); } } // namespace kaleidoscope