Furi: cleanup crash use (#3175)

* Furi: optional message in furi_crash and furi_halt
* Consistent furi_crash use
* UnitTests: crash instead of assert
* furi: check: fixed macro for default arg
* unit_tests: fixed crashes everywhere
* lib: infrared: fixed PVS warnings
* furi: eliminated __FURI_ASSERT_MESSAGE_FLAG
* Furi: update check.h docs
* Furi: add check.h usage note
* Docs: grammar

---------

Co-authored-by: hedger <hedger@nanode.su>
This commit is contained in:
あく
2023-10-31 14:40:32 +04:00
committed by GitHub
co-authored by hedger
parent c8180747db
commit 9af81ce8d0
37 changed files with 159 additions and 107 deletions
@@ -456,7 +456,7 @@ void animation_manager_unload_and_stall_animation(AnimationManager* animation_ma
}
furi_timer_stop(animation_manager->idle_animation_timer);
} else {
furi_assert(0);
furi_crash();
}
FURI_LOG_I(
@@ -528,7 +528,7 @@ void animation_manager_load_and_continue_animation(AnimationManager* animation_m
}
} else {
/* Unknown state is an error. But not in release version.*/
furi_assert(0);
furi_crash();
}
/* if can't restore previous animation - select new */
@@ -564,7 +564,7 @@ static void animation_manager_switch_to_one_shot_view(AnimationManager* animatio
} else if(stats.level == 2) {
one_shot_view_start_animation(animation_manager->one_shot_view, &A_Levelup2_128x64);
} else {
furi_assert(0);
furi_crash();
}
}
@@ -78,7 +78,7 @@ static bool desktop_view_pin_input_input(InputEvent* event, void* context) {
}
break;
default:
furi_assert(0);
furi_crash();
break;
}
}
@@ -129,7 +129,7 @@ static void desktop_view_pin_input_draw_cells(Canvas* canvas, DesktopViewPinInpu
canvas_draw_icon_ex(canvas, x + 2, y + 3, &I_Pin_arrow_up_7x9, IconRotation90);
break;
default:
furi_assert(0);
furi_crash();
break;
}
}
+4 -4
View File
@@ -135,7 +135,7 @@ void canvas_set_font(Canvas* canvas, Font font) {
} else if(font == FontBigNumbers) {
u8g2_SetFont(&canvas->fb, u8g2_font_profont22_tn);
} else {
furi_crash(NULL);
furi_crash();
}
}
@@ -175,7 +175,7 @@ void canvas_draw_str_aligned(
x -= (u8g2_GetStrWidth(&canvas->fb, str) / 2);
break;
default:
furi_crash(NULL);
furi_crash();
break;
}
@@ -189,7 +189,7 @@ void canvas_draw_str_aligned(
y += (u8g2_GetAscent(&canvas->fb) / 2);
break;
default:
furi_crash(NULL);
furi_crash();
break;
}
@@ -530,7 +530,7 @@ void canvas_set_orientation(Canvas* canvas, CanvasOrientation orientation) {
rotate_cb = U8G2_R1;
break;
default:
furi_assert(0);
furi_crash();
}
if(need_swap) FURI_SWAP(canvas->width, canvas->height);
+1 -1
View File
@@ -232,7 +232,7 @@ static size_t
} else if(horizontal == AlignRight) {
px_left = x;
} else {
furi_assert(0);
furi_crash();
}
if(len_px > px_left) {
@@ -79,7 +79,7 @@ static uint8_t byte_input_get_row_size(uint8_t row_index) {
row_size = COUNT_OF(keyboard_keys_row_2);
break;
default:
furi_crash(NULL);
furi_crash();
}
return row_size;
@@ -102,7 +102,7 @@ static const ByteInputKey* byte_input_get_row(uint8_t row_index) {
row = keyboard_keys_row_2;
break;
default:
furi_crash(NULL);
furi_crash();
}
return row;
+1 -1
View File
@@ -98,7 +98,7 @@ void popup_start_timer(void* context) {
if(timer_period == 0) timer_period = 1;
if(furi_timer_start(popup->timer, timer_period) != FuriStatusOk) {
furi_assert(0);
furi_crash();
};
}
}
@@ -101,7 +101,7 @@ static uint8_t get_row_size(uint8_t row_index) {
row_size = COUNT_OF(keyboard_keys_row_3);
break;
default:
furi_crash(NULL);
furi_crash();
}
return row_size;
@@ -121,7 +121,7 @@ static const TextInputKey* get_row(uint8_t row_index) {
row = keyboard_keys_row_3;
break;
default:
furi_crash(NULL);
furi_crash();
}
return row;
+2 -2
View File
@@ -82,7 +82,7 @@ void view_allocate_model(View* view, ViewModelType type, size_t size) {
model->data = malloc(size);
view->model = model;
} else {
furi_crash(NULL);
furi_crash();
}
}
@@ -99,7 +99,7 @@ void view_free_model(View* view) {
free(model);
view->model = NULL;
} else {
furi_crash(NULL);
furi_crash();
}
}
+1 -1
View File
@@ -207,7 +207,7 @@ void view_dispatcher_attach_to_gui(
} else if(type == ViewDispatcherTypeFullscreen) {
gui_add_view_port(gui, view_dispatcher->view_port, GuiLayerFullscreen);
} else {
furi_check(NULL);
furi_crash();
}
view_dispatcher->gui = gui;
}
+1 -1
View File
@@ -62,7 +62,7 @@ static void rpc_system_app_start_process(const PB_Main* request, void* context)
} else if(status == LoaderStatusOk) {
result = PB_CommandStatus_OK;
} else {
furi_crash(NULL);
furi_crash();
}
} else {
result = PB_CommandStatus_ERROR_INVALID_PARAMETERS;