spiffs
spiffs copied to clipboard
Add checks for SIPFFS_CACHE before any use of SPIFFS_CACHE_WR and SPIFFS_CACHE_STATS
I had to compile code with SPIFFS_CACHE 0 and there were a lot of checks for SPIFFS_CACHE_WR that did not first check if SPIFFS_CACHE was turned on.
Is this really needed? Config file already have parenthesis around SPIFFS_CACHE_WR, SPIFFS_CACHE_STATS defines, so if SPIFFS_CACHE is not defined - SPIFFS_CACHE_WR and SPIFFS_CACHE_STATS will not be defined too.
Config has parenthesis, but source files use #if SPIFFS_CACHE_WR so this results in a warning -Wundef. Personally I like to compile with -Werror which fails the compile for me. As an alternative changing to #if defined(SPIFFS_CACHE_WR) should also silence the -Wundef warning, where we are being more explicit if the macro was defined at all.