Added comment block explaining the pragma

Explanation of why the #pragma ignoring uninitialised variables is justified, and the build setting that triggers the warning.
This commit is contained in:
Richard Groves 2021-08-11 15:48:44 +01:00 коммит произвёл GitHub
Родитель 4cd7a1ddd3
Коммит 73256ed668
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -532,6 +532,12 @@ kern_return_t PLCrashMachExceptionForward (task_t task,
plcrash_mach_exception_port_set_t *port_state)
{
#pragma clang diagnostic push
/**
* Disable uninitialized variable warnings for `behavior`, `flavor`, `port` and `thread_state_count` which will be triggered
* if the build setting for Uninitialized Variables Warning is Yes (Aggressive)
* behavior, flavor and port can be seen to be either initialized in the loop (found -> true) or the function will exit (found -> false)
* thread_state_count will be initialized for all cases except behavior == EXCEPTION_DEFAULT, in which case the thread_state_count is not used in the `switch (behavior)` block
*/
#pragma clang diagnostic ignored "-Wconditional-uninitialized"
exception_behavior_t behavior;