spiffs icon indicating copy to clipboard operation
spiffs copied to clipboard

Add checks for SIPFFS_CACHE before any use of SPIFFS_CACHE_WR and SPIFFS_CACHE_STATS

Open temach opened this issue 7 years ago • 2 comments

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.

temach avatar Jan 22 '18 20:01 temach

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.

valkuc avatar Jan 22 '18 20:01 valkuc

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.

temach avatar Jan 23 '18 05:01 temach