Fixed build warnings with gcc 7 in Layer_::getKeyFromPROGMEM(...)

(by disabling the warning for this tiny bit of code)
pull/814/head
Jesse Vincent 5 years ago
parent 46998b3036
commit d5c6bf28da
No known key found for this signature in database
GPG Key ID: CC228463465E40BC

@ -48,6 +48,14 @@ class Key {
void setFlags(uint8_t new_flags) { void setFlags(uint8_t new_flags) {
flags.value_ = new_flags; flags.value_ = new_flags;
} }
// gcc 7 (Arduino > 1.8.10) has a problem with the layer dimension of
// keymap_linear, as used by keyFromKeymap(...) being undefined.
// Because of this, we disable -Warray_bounds locally to avoid spurious warnings.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
constexpr const uint8_t &getFlags() const { constexpr const uint8_t &getFlags() const {
return flags.value_; return flags.value_;
} }
@ -58,6 +66,8 @@ class Key {
constexpr const uint8_t &getKeyCode() const { constexpr const uint8_t &getKeyCode() const {
return keyCode.value_; return keyCode.value_;
} }
#pragma GCC diagnostic pop
void setRaw(uint16_t raw) { void setRaw(uint16_t raw) {
flags.value_ = (uint8_t)(raw >> 8); flags.value_ = (uint8_t)(raw >> 8);

Loading…
Cancel
Save