Пожалуй, подниму тему.
Внезапно наткнулся на странные предупреждения. Например, в этом скетче (пример к моей же библиотеке)
Получаю вот такую красоту:
Спойлер
/mnt/B6F0D77CF0D74173/_Documents/Vladimir/YandexDisk/Arduino/libraries/shButton/shButton.h:52:7: warning: type 'struct shButton' violates the C++ One Definition Rule [-Wodr]
class shButton
^
/mnt/B6F0D77CF0D74173/_Documents/Vladimir/YandexDisk/Arduino/libraries/shButton/shButton.h:52:7: note: a different type is defined in another translation unit
class shButton
^
/mnt/B6F0D77CF0D74173/_Documents/Vladimir/YandexDisk/Arduino/libraries/shButton/shButton.h:88:22: note: the first difference of corresponding definitions is field 'btn_flag'
uint8_t btn_flag = 0;
^
/mnt/B6F0D77CF0D74173/_Documents/Vladimir/YandexDisk/Arduino/libraries/shButton/shButton.h:52:7: note: a type with different number of fields is defined in another translation unit
class shButton
^
/mnt/B6F0D77CF0D74173/_Documents/Vladimir/YandexDisk/Arduino/libraries/shButton/shButton.h:191:8: warning: 'setVirtualClickOn' violates the C++ One Definition Rule [-Wodr]
void setVirtualClickOn(bool virtualclick_on = true);
^
/mnt/B6F0D77CF0D74173/_Documents/Vladimir/YandexDisk/Arduino/libraries/shButton/shButton.cpp:189:6: note: implicit this pointer type mismatch
void shButton::setVirtualClickOn(bool virtualclick_on)
^
/mnt/B6F0D77CF0D74173/_Documents/Vladimir/YandexDisk/Arduino/libraries/shButton/shButton.h:52:7: note: type 'struct shButton' itself violates the C++ One Definition Rule
class shButton
^
/mnt/B6F0D77CF0D74173/_Documents/Vladimir/YandexDisk/Arduino/libraries/shButton/shButton.cpp:189:6: note: 'setVirtualClickOn' was previously declared here
void shButton::setVirtualClickOn(bool virtualclick_on)
^
/mnt/B6F0D77CF0D74173/_Documents/Vladimir/YandexDisk/Arduino/libraries/shButton/shButton.cpp:189:6: note: code may be misoptimized unless -fno-strict-aliasing is used
/mnt/B6F0D77CF0D74173/_Documents/Vladimir/YandexDisk/Arduino/libraries/shButton/shButton.h:198:8: warning: 'setLongClickMode' violates the C++ One Definition Rule [-Wodr]
void setLongClickMode(uint8_t longclickmode);
^
/mnt/B6F0D77CF0D74173/_Documents/Vladimir/YandexDisk/Arduino/libraries/shButton/shButton.cpp:194:6: note: implicit this pointer type mismatch
void shButton::setLongClickMode(uint8_t longclickmode)
^
/mnt/B6F0D77CF0D74173/_Documents/Vladimir/YandexDisk/Arduino/libraries/shButton/shButton.h:52:7: note: type 'struct shButton' itself violates the C++ One Definition Rule
class shButton
^
/mnt/B6F0D77CF0D74173/_Documents/Vladimir/YandexDisk/Arduino/libraries/shButton/shButton.cpp:194:6: note: 'setLongClickMode' was previously declared here
void shButton::setLongClickMode(uint8_t longclickmode)
^
/mnt/B6F0D77CF0D74173/_Documents/Vladimir/YandexDisk/Arduino/libraries/shButton/shButton.cpp:194:6: note: code may be misoptimized unless -fno-strict-aliasing is used
/mnt/B6F0D77CF0D74173/_Documents/Vladimir/YandexDisk/Arduino/libraries/shButton/shButton.h:111:11: warning: 'getButtonState' violates the C++ One Definition Rule [-Wodr]
uint8_t getButtonState();
^
/mnt/B6F0D77CF0D74173/_Documents/Vladimir/YandexDisk/Arduino/libraries/shButton/shButton.cpp:120:9: note: implicit this pointer type mismatch
uint8_t shButton::getButtonState()
^
/mnt/B6F0D77CF0D74173/_Documents/Vladimir/YandexDisk/Arduino/libraries/shButton/shButton.h:52:7: note: type 'struct shButton' itself violates the C++ One Definition Rule
class shButton
^
/mnt/B6F0D77CF0D74173/_Documents/Vladimir/YandexDisk/Arduino/libraries/shButton/shButton.cpp:120:9: note: 'getButtonState' was previously declared here
uint8_t shButton::getButtonState()
^
/mnt/B6F0D77CF0D74173/_Documents/Vladimir/YandexDisk/Arduino/libraries/shButton/shButton.cpp:120:9: note: code may be misoptimized unless -fno-strict-aliasing is used
/mnt/B6F0D77CF0D74173/_Documents/Vladimir/YandexDisk/Arduino/libraries/shButton/shButton.h:98:3: warning: '__comp_ctor ' violates the C++ One Definition Rule [-Wodr]
shButton(uint8_t pin, uint8_t inputtype = PULL_UP, uint8_t btntype = BTN_NO);
^
/home/vladimir/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 /tmp/arduino_build_632476/UseButtonFlag.ino.elf /tmp/arduino_build_632476/UseButtonFlag.ino.eep/mnt/B6F0D77CF0D74173/_Documents/Vladimir/YandexDisk/Arduino/libraries/shButton/shButton.cpp:6:1: note: implicit this pointer type mismatch
shButton::shButton(uint8_t pin, uint8_t inputtype, uint8_t btntype)
^
/mnt/B6F0D77CF0D74173/_Documents/Vladimir/YandexDisk/Arduino/libraries/shButton/shButton.h:52:7: note: type 'struct shButton' itself violates the C++ One Definition Rule
class shButton
^
/mnt/B6F0D77CF0D74173/_Documents/Vladimir/YandexDisk/Arduino/libraries/shButton/shButton.cpp:6:1: note: '__comp_ctor ' was previously declared here
shButton::shButton(uint8_t pin, uint8_t inputtype, uint8_t btntype)
^
/mnt/B6F0D77CF0D74173/_Documents/Vladimir/YandexDisk/Arduino/libraries/shButton/shButton.cpp:6:1: note: code may be misoptimized unless -fno-strict-aliasing is used
В других примерах к библиотеке ничего подобного нет, предупреждения начинают сыпать только если в скетче используется #define USE_BUTTON_FLAG
Что компилятор пытается мне донести?