[FL-2520] FW build with -Wextra (#1185)

* Fixing compiler warnings with -Wextra
* More warnings suppression, WIP
* Even more warning fixes
* Added new lines at end of text files.
* Padding fix
* Additional fixes to warnings on different build configurations; added -Wextra to default build pipeline
* Fixes for Secplus v1
* -additional warnings
* +-Wredundant-decls fixes
* FuriHal: print stack overflow task name in console
* FuriHal: add missing include

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
hedger
2022-05-06 16:37:10 +03:00
committed by GitHub
parent 1ca98170d9
commit 4d6b170769
461 changed files with 940 additions and 519 deletions

View File

@@ -35,4 +35,4 @@ const char* filesystem_api_error_get_desc(FS_Error error_id) {
break;
}
return result;
}
}

View File

@@ -57,4 +57,4 @@ const char* filesystem_api_error_get_desc(FS_Error error_id);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -100,6 +100,7 @@ void storage_tick(Storage* app) {
}
int32_t storage_srv(void* p) {
UNUSED(p);
Storage* app = storage_app_alloc();
furi_record_create("storage", app);

View File

@@ -325,4 +325,4 @@ void storage_get_next_filename(
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -37,6 +37,7 @@ static void storage_cli_print_error(FS_Error error) {
}
static void storage_cli_info(Cli* cli, string_t path) {
UNUSED(cli);
Storage* api = furi_record_open("storage");
if(string_cmp_str(path, "/int") == 0) {
@@ -101,6 +102,7 @@ static void storage_cli_format(Cli* cli, string_t path) {
};
static void storage_cli_list(Cli* cli, string_t path) {
UNUSED(cli);
if(string_cmp_str(path, "/") == 0) {
printf("\t[D] int\r\n");
printf("\t[D] ext\r\n");
@@ -137,6 +139,7 @@ static void storage_cli_list(Cli* cli, string_t path) {
}
static void storage_cli_read(Cli* cli, string_t path) {
UNUSED(cli);
Storage* api = furi_record_open("storage");
File* file = storage_file_alloc(api);
@@ -295,6 +298,7 @@ static void storage_cli_write_chunk(Cli* cli, string_t path, string_t args) {
}
static void storage_cli_stat(Cli* cli, string_t path) {
UNUSED(cli);
Storage* api = furi_record_open("storage");
if(string_cmp_str(path, "/") == 0) {
@@ -334,6 +338,7 @@ static void storage_cli_stat(Cli* cli, string_t path) {
}
static void storage_cli_copy(Cli* cli, string_t old_path, string_t args) {
UNUSED(cli);
Storage* api = furi_record_open("storage");
string_t new_path;
string_init(new_path);
@@ -354,6 +359,7 @@ static void storage_cli_copy(Cli* cli, string_t old_path, string_t args) {
}
static void storage_cli_remove(Cli* cli, string_t path) {
UNUSED(cli);
Storage* api = furi_record_open("storage");
FS_Error error = storage_common_remove(api, string_get_cstr(path));
@@ -365,6 +371,7 @@ static void storage_cli_remove(Cli* cli, string_t path) {
}
static void storage_cli_rename(Cli* cli, string_t old_path, string_t args) {
UNUSED(cli);
Storage* api = furi_record_open("storage");
string_t new_path;
string_init(new_path);
@@ -385,6 +392,7 @@ static void storage_cli_rename(Cli* cli, string_t old_path, string_t args) {
}
static void storage_cli_mkdir(Cli* cli, string_t path) {
UNUSED(cli);
Storage* api = furi_record_open("storage");
FS_Error error = storage_common_mkdir(api, string_get_cstr(path));
@@ -396,6 +404,7 @@ static void storage_cli_mkdir(Cli* cli, string_t path) {
}
static void storage_cli_md5(Cli* cli, string_t path) {
UNUSED(cli);
Storage* api = furi_record_open("storage");
File* file = storage_file_alloc(api);
@@ -433,6 +442,7 @@ static void storage_cli_md5(Cli* cli, string_t path) {
}
void storage_cli(Cli* cli, string_t args, void* context) {
UNUSED(context);
string_t cmd;
string_t path;
string_init(cmd);
@@ -522,6 +532,8 @@ void storage_cli(Cli* cli, string_t args, void* context) {
}
static void storage_cli_factory_reset(Cli* cli, string_t args, void* context) {
UNUSED(args);
UNUSED(context);
printf("All data will be lost. Are you sure (y/n)?\r\n");
char c = cli_getc(cli);
if(c == 'y' || c == 'Y') {

View File

@@ -72,4 +72,4 @@ bool storage_pop_storage_file(File* file, StorageData* storage);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -19,4 +19,4 @@ FS_Error storage_int_restore(Storage* api, const char* srcname) {
tar_archive_unpack_to(archive, INT_PATH);
tar_archive_free(archive);
return success ? FSE_OK : FSE_INTERNAL;
}
}

View File

@@ -131,4 +131,4 @@ typedef struct {
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -40,7 +40,7 @@ static StorageData* get_storage_by_file(File* file, StorageData* storages) {
}
static const char* remove_vfs(const char* path) {
return path + MIN(4, strlen(path));
return path + MIN(4u, strlen(path));
}
static const char* ext_path = "/ext";

View File

@@ -13,4 +13,4 @@ void storage_process_message(Storage* app, StorageMessage* message);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -18,4 +18,4 @@ const char* sd_api_get_fs_type_text(SDFsType fs_type) {
return "UNKNOWN";
break;
}
}
}

View File

@@ -30,4 +30,4 @@ const char* sd_api_get_fs_type_text(SDFsType fs_type);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -316,6 +316,7 @@ static void do_test_end(Storage* api, const char* path) {
}
int32_t storage_test_app(void* p) {
UNUSED(p);
Storage* api = furi_record_open("storage");
do_test_start(api, "/int");
do_test_start(api, "/any");

View File

@@ -79,4 +79,4 @@ void sd_notify_eject(NotificationApp* notifications) {
void sd_notify_error(NotificationApp* notifications) {
notification_message(notifications, &sd_sequence_error);
}
}

View File

@@ -14,4 +14,4 @@ void sd_notify_error(NotificationApp* notifications);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -113,6 +113,7 @@ FS_Error sd_unmount_card(StorageData* storage) {
FS_Error sd_format_card(StorageData* storage) {
#ifdef FURI_RAM_EXEC
UNUSED(storage);
return FSE_NOT_READY;
#else
uint8_t* work_area;
@@ -349,6 +350,10 @@ static uint16_t
static uint16_t
storage_ext_file_write(void* ctx, File* file, const void* buff, uint16_t const bytes_to_write) {
#ifdef FURI_RAM_EXEC
UNUSED(ctx);
UNUSED(file);
UNUSED(buff);
UNUSED(bytes_to_write);
return FSE_NOT_READY;
#else
StorageData* storage = ctx;
@@ -389,6 +394,8 @@ static uint64_t storage_ext_file_tell(void* ctx, File* file) {
static bool storage_ext_file_truncate(void* ctx, File* file) {
#ifdef FURI_RAM_EXEC
UNUSED(ctx);
UNUSED(file);
return FSE_NOT_READY;
#else
StorageData* storage = ctx;
@@ -402,6 +409,8 @@ static bool storage_ext_file_truncate(void* ctx, File* file) {
static bool storage_ext_file_sync(void* ctx, File* file) {
#ifdef FURI_RAM_EXEC
UNUSED(ctx);
UNUSED(file);
return FSE_NOT_READY;
#else
StorageData* storage = ctx;
@@ -497,6 +506,7 @@ static bool storage_ext_dir_rewind(void* ctx, File* file) {
/******************* Common FS Functions *******************/
static FS_Error storage_ext_common_stat(void* ctx, const char* path, FileInfo* fileinfo) {
UNUSED(ctx);
SDFileInfo _fileinfo;
SDError result = f_stat(path, &_fileinfo);
@@ -511,7 +521,9 @@ static FS_Error storage_ext_common_stat(void* ctx, const char* path, FileInfo* f
}
static FS_Error storage_ext_common_remove(void* ctx, const char* path) {
UNUSED(ctx);
#ifdef FURI_RAM_EXEC
UNUSED(path);
return FSE_NOT_READY;
#else
SDError result = f_unlink(path);
@@ -520,7 +532,9 @@ static FS_Error storage_ext_common_remove(void* ctx, const char* path) {
}
static FS_Error storage_ext_common_mkdir(void* ctx, const char* path) {
UNUSED(ctx);
#ifdef FURI_RAM_EXEC
UNUSED(path);
return FSE_NOT_READY;
#else
SDError result = f_mkdir(path);
@@ -533,7 +547,11 @@ static FS_Error storage_ext_common_fs_info(
const char* fs_path,
uint64_t* total_space,
uint64_t* free_space) {
UNUSED(fs_path);
#ifdef FURI_RAM_EXEC
UNUSED(ctx);
UNUSED(total_space);
UNUSED(free_space);
return FSE_NOT_READY;
#else
StorageData* storage = ctx;
@@ -610,4 +628,4 @@ void storage_ext_init(StorageData* storage) {
// do not notify on first launch, notifications app is waiting for our thread to read settings
storage_ext_tick_internal(storage, false);
}
}

View File

@@ -13,4 +13,4 @@ FS_Error sd_format_card(StorageData* storage);
FS_Error sd_card_info(StorageData* storage, SDInfo* sd_info);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -129,6 +129,7 @@ static int storage_int_device_erase(const struct lfs_config* c, lfs_block_t bloc
}
static int storage_int_device_sync(const struct lfs_config* c) {
UNUSED(c);
FURI_LOG_D(TAG, "Device sync: skipping, cause ");
return 0;
}
@@ -648,6 +649,7 @@ static FS_Error storage_int_common_fs_info(
const char* fs_path,
uint64_t* total_space,
uint64_t* free_space) {
UNUSED(fs_path);
StorageData* storage = ctx;
lfs_t* lfs = lfs_get_from_storage(storage);

View File

@@ -10,4 +10,4 @@ void storage_int_init(StorageData* storage);
#ifdef __cplusplus
}
#endif
#endif