m5stack / M5Unified

Unified library for M5Stack series
MIT License
276 stars 48 forks source link

S3 family compilation error: unused variable when compiler_warnings=all #82

Closed tobozo closed 8 months ago

tobozo commented 8 months ago

Hi and thanks for this awesome project :+1:

This line triggers a compilation error when the compiler warnings are at the maximum level in Arduino IDE:

https://github.com/m5stack/M5Unified/blob/855379142da91e4076703019323af3483462c7a6/src/utility/Power_Class.cpp#L527

~/Arduino/libraries/M5Unified/src/utility/Power_Class.cpp: In member function 'bool m5::Power_Class::getUsbOutput()':
~/Arduino/libraries/M5Unified/src/utility/Power_Class.cpp:527:62: error: unused variable 'port0_bitmask' [-Werror=unused-variable]
         static constexpr const uint32_t port0_bitmask = 0b00100000; // USB OTG EN
                                                              ^~~~~~~~~~~~~
cc1plus: some warnings being treated as errors

looks like dead code, removing this line doesn't seem to break anything, prefixing [[maybe_unused]] works too.

lovyan03 commented 8 months ago

Hello. @tobozo . Thanks for pointing out this issue ! We have removed the unnecessary variables and reflected it in the develop branch. This will be reflected in the next release.