From db9848cd92c4a3f7c7480ba99168e6ed8c4245d8 Mon Sep 17 00:00:00 2001 From: Florian Fleissner Date: Thu, 5 Dec 2019 13:38:31 +0100 Subject: [PATCH] Fixed clang problems with member function pointers Clang seems to have problem with recognizing that those functions are actually static members. This change makes it more obvious to the compiler, which functions we actually refer to. Signed-off-by: Florian Fleissner --- src/kaleidoscope/layers.cpp | 2 +- src/kaleidoscope/layers.h | 3 ++- src/kaleidoscope/plugin/EEPROM-Keymap.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/kaleidoscope/layers.cpp b/src/kaleidoscope/layers.cpp index f3efb80e..8cc702e9 100644 --- a/src/kaleidoscope/layers.cpp +++ b/src/kaleidoscope/layers.cpp @@ -40,7 +40,7 @@ uint32_t Layer_::layer_state_; uint8_t Layer_::top_active_layer_; Key Layer_::live_composite_keymap_[Kaleidoscope.device().numKeys()]; uint8_t Layer_::active_layers_[Kaleidoscope.device().numKeys()]; -Key(*Layer_::getKey)(uint8_t layer, KeyAddr key_addr) = Layer.getKeyFromPROGMEM; +Layer_::GetKeyFunction Layer_::getKey = &Layer_::getKeyFromPROGMEM; void Layer_::handleKeymapKeyswitchEvent(Key keymapEntry, uint8_t keyState) { if (keymapEntry.getKeyCode() >= LAYER_SHIFT_OFFSET) { diff --git a/src/kaleidoscope/layers.h b/src/kaleidoscope/layers.h index c4e258bc..7c434e35 100644 --- a/src/kaleidoscope/layers.h +++ b/src/kaleidoscope/layers.h @@ -116,7 +116,8 @@ class Layer_ { return eventHandler(mappedKey, KeyAddr(row, col), keyState); } - static Key(*getKey)(uint8_t layer, KeyAddr key_addr); + typedef Key(*GetKeyFunction)(uint8_t layer, KeyAddr key_addr); + static GetKeyFunction getKey; static Key getKeyFromPROGMEM(uint8_t layer, KeyAddr key_addr); DEPRECATED(ROW_COL_FUNC) static Key getKeyFromPROGMEM(uint8_t layer, byte row, byte col) { diff --git a/src/kaleidoscope/plugin/EEPROM-Keymap.cpp b/src/kaleidoscope/plugin/EEPROM-Keymap.cpp index 0deaaf45..790e9828 100644 --- a/src/kaleidoscope/plugin/EEPROM-Keymap.cpp +++ b/src/kaleidoscope/plugin/EEPROM-Keymap.cpp @@ -130,7 +130,7 @@ EventHandlerResult EEPROMKeymap::onFocusEvent(const char *command) { // we actully want. // dumpKeymap(progmem_layers_, - static_cast(Layer.getKeyFromPROGMEM)); + static_cast(Layer_::getKeyFromPROGMEM)); return EventHandlerResult::EVENT_CONSUMED; }