vortigont / esp32-flashz

zlib compressed OTA firmware update for ESP32. Implements on-the-fly OTA images decompression on upload/flashing
GNU General Public License v2.0
33 stars 4 forks source link

-Werror=unused-variable -Wespressif=lets-break-everyones-library #4

Closed tobozo closed 1 year ago

tobozo commented 1 year ago

Hi!

got this error treated as a warning while running a compilation CI test with compilation warnings set to all.

  /home/runner/Arduino/libraries/esp32-flashz/src/flashz.cpp: In member function 'size_t FlashZ::writezStream(Stream&, size_t)':
  /home/runner/Arduino/libraries/esp32-flashz/src/flashz.cpp:307:9: error: unused variable 'err' [-Werror=unused-variable]
       int err = deco.inflate_stream_to_cb(data, len, [this](size_t i, const uint8_t* d, size_t s, bool f) -> int { return flash_cb(i, d, s, f); });
           ^~~
  cc1plus: some warnings being treated as errors

there are several ways this can be fixed:

#pragma GCC diagnostic ignored "-Wunused-variable"
if( err ) {
   // do something
}
vortigont commented 1 year ago

tnx @tobozo yeah, I had an intention to handle the error for writeStreamz() initially. But since this func usually runs asynchronously, it need an external callback handler of a kind. Hope to implement it someday :) Will silence it for now but let's keep it in the code to remind me about my duties :)