diff --git a/src/default/spiffs_config.h b/src/default/spiffs_config.h index c1a46c0..56703ef 100644 --- a/src/default/spiffs_config.h +++ b/src/default/spiffs_config.h @@ -16,6 +16,7 @@ #include #include #include +#include // ----------- >8 ------------ // compile time switches diff --git a/src/spiffs.h b/src/spiffs.h index 0758646..6711cd0 100644 --- a/src/spiffs.h +++ b/src/spiffs.h @@ -106,7 +106,7 @@ typedef enum { SPIFFS_CHECK_FIX_LOOKUP, SPIFFS_CHECK_DELETE_ORPHANED_INDEX, SPIFFS_CHECK_DELETE_PAGE, - SPIFFS_CHECK_DELETE_BAD_FILE, + SPIFFS_CHECK_DELETE_BAD_FILE } spiffs_check_report; /* file system check callback function */ @@ -125,7 +125,7 @@ typedef enum { /* the file has been updated or moved to another page */ SPIFFS_CB_UPDATED, /* the file has been deleted */ - SPIFFS_CB_DELETED, + SPIFFS_CB_DELETED } spiffs_fileop_type; /* file system listener callback function */ diff --git a/src/spiffs_gc.c b/src/spiffs_gc.c index 8abb8df..8264a68 100644 --- a/src/spiffs_gc.c +++ b/src/spiffs_gc.c @@ -255,10 +255,7 @@ s32_t spiffs_gc_find_candidate( s32_t *cand_scores = (s32_t *)(fs->work + max_candidates * sizeof(spiffs_block_ix)); // align cand_scores on s32_t boundary -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpointer-to-int-cast" cand_scores = (s32_t*)(((ptrdiff_t)cand_scores + sizeof(ptrdiff_t) - 1) & ~(sizeof(ptrdiff_t) - 1)); -#pragma GCC diagnostic pop *block_candidates = cand_blocks; diff --git a/src/spiffs_hydrogen.c b/src/spiffs_hydrogen.c index bb92a5e..09a48cb 100644 --- a/src/spiffs_hydrogen.c +++ b/src/spiffs_hydrogen.c @@ -89,12 +89,9 @@ s32_t SPIFFS_mount(spiffs *fs, spiffs_config *config, u8_t *work, fs->work = &work[0]; fs->lu_work = &work[SPIFFS_CFG_LOG_PAGE_SZ(fs)]; memset(fd_space, 0, fd_space_size); - // align fd_space pointer to pointer size byte boundary, below is safe + // align fd_space pointer to pointer size byte boundary u8_t ptr_size = sizeof(void*); -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpointer-to-int-cast" - u8_t addr_lsb = ((u8_t)fd_space) & (ptr_size-1); -#pragma GCC diagnostic pop + u8_t addr_lsb = ((u8_t)(intptr_t)fd_space) & (ptr_size-1); if (addr_lsb) { fd_space += (ptr_size-addr_lsb); fd_space_size -= (ptr_size-addr_lsb); @@ -102,11 +99,8 @@ s32_t SPIFFS_mount(spiffs *fs, spiffs_config *config, u8_t *work, fs->fd_space = fd_space; fs->fd_count = (fd_space_size/sizeof(spiffs_fd)); - // align cache pointer to 4 byte boundary, below is safe -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpointer-to-int-cast" - addr_lsb = ((u8_t)cache) & (ptr_size-1); -#pragma GCC diagnostic pop + // align cache pointer to 4 byte boundary + addr_lsb = ((u8_t)(intptr_t)cache) & (ptr_size-1); if (addr_lsb) { u8_t *cache_8 = (u8_t *)cache; cache_8 += (ptr_size-addr_lsb); diff --git a/src/test/params_test.h b/src/test/params_test.h index 36a8205..fe2f48e 100644 --- a/src/test/params_test.h +++ b/src/test/params_test.h @@ -37,15 +37,23 @@ void real_assert(int c, const char *n, const char *file, int l); /////////// SPIFFS BUILD CONFIG //////////// // test using filesystem magic +#ifndef SPIFFS_USE_MAGIC #define SPIFFS_USE_MAGIC 1 +#endif // test using filesystem magic length +#ifndef SPIFFS_USE_MAGIC_LENGTH #define SPIFFS_USE_MAGIC_LENGTH 1 +#endif // test using extra param in callback +#ifndef SPIFFS_HAL_CALLBACK_EXTRA #define SPIFFS_HAL_CALLBACK_EXTRA 1 +#endif // test using filehandle offset +#ifndef SPIFFS_FILEHDL_OFFSET #define SPIFFS_FILEHDL_OFFSET 1 // use this offset #define TEST_SPIFFS_FILEHDL_OFFSET 0x1000 +#endif // dbg output #define SPIFFS_DBG(...) //printf(__VA_ARGS__)