adafruit / RTClib

A fork of Jeelab's fantastic RTC Arduino library
MIT License
798 stars 709 forks source link

Fix CI failure due to unused variables #265

Closed edgar-bonet closed 2 years ago

edgar-bonet commented 2 years ago

Since the merge of PR #257, the CI workflow has been failing in “test platforms”. The failure is due to errors while compiling the example sketch DS3231_alarm.ino on ESP32:

DS3231_alarm.ino:70:14: error: variable 'alarm1' set but not used [-Werror=unused-but-set-variable]
       DateTime alarm1 = rtc.getAlarm1();
                ^~~~~~
DS3231_alarm.ino:71:22: error: unused variable 'alarm1mode' [-Werror=unused-variable]
       Ds3231Alarm1Mode alarm1mode = rtc.getAlarm1Mode();
                        ^~~~~~~~~~
  cc1plus: some warnings being treated as errors

On the other platforms being tested, the same warnings show up. However, only the ESP32 toolchain is promoting warnings to errors.

Fix this by using the variables instead of recomputing their values later.

caternuson commented 2 years ago

Thanks!