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 19:40:32 +09:00
committed by GitHub
parent c8180747db
commit 9af81ce8d0
37 changed files with 159 additions and 107 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ static void ibutton_protocols_get_group_by_id(
local_id -= ibutton_protocol_groups[i]->protocol_count;
}
}
furi_crash(NULL);
furi_crash();
}
iButtonProtocols* ibutton_protocols_alloc() {
@@ -48,7 +48,7 @@ void infrared_encoder_nec_reset(void* encoder_ptr, const InfraredMessage* messag
*data2 = (message->command & 0xFFC0) >> 6;
encoder->bits_to_encode = 42;
} else {
furi_assert(0);
furi_crash();
}
}
@@ -23,7 +23,7 @@ void infrared_encoder_sirc_reset(void* encoder_ptr, const InfraredMessage* messa
*data |= (message->address & 0x1FFF) << 7;
encoder->bits_to_encode = 20;
} else {
furi_assert(0);
furi_crash();
}
}
+1 -1
View File
@@ -88,7 +88,7 @@ FuriHalInfraredTxGetDataState
state = FuriHalInfraredTxGetDataStateDone;
}
} else {
furi_crash(NULL);
furi_crash();
}
return state;
+6 -6
View File
@@ -367,10 +367,11 @@ static FuriHalInfraredTxGetDataState
*duration = timing.duration;
state = timing.state;
} else {
furi_assert(0);
// Why bother if we crash anyway?..
*level = 0;
*duration = 100;
state = FuriHalInfraredTxGetDataStateDone;
furi_crash();
}
uint32_t flags_set = furi_thread_flags_set(
@@ -414,7 +415,7 @@ static bool infrared_get_new_signal(InfraredWorker* instance) {
} else if(response == InfraredWorkerGetSignalResponseStop) {
new_signal_obtained = false;
} else {
furi_assert(0);
furi_crash();
}
return new_signal_obtained;
@@ -443,9 +444,8 @@ static bool infrared_worker_tx_fill_buffer(InfraredWorker* instance) {
}
if(status == InfraredStatusError) {
furi_assert(0);
new_data_available = false;
break;
furi_crash();
} else if(status == InfraredStatusOk) {
timing.state = FuriHalInfraredTxGetDataStateOk;
} else if(status == InfraredStatusDone) {
@@ -456,7 +456,7 @@ static bool infrared_worker_tx_fill_buffer(InfraredWorker* instance) {
timing.state = FuriHalInfraredTxGetDataStateLastDone;
}
} else {
furi_assert(0);
furi_crash();
}
uint32_t written_size =
furi_stream_buffer_send(instance->stream, &timing, sizeof(InfraredWorkerTiming), 0);
@@ -548,7 +548,7 @@ static int32_t infrared_worker_tx_thread(void* thread_context) {
break;
default:
furi_assert(0);
furi_crash();
break;
}
}