Может кто-нибудь увидеть, где я продолжаю получать эту ошибку "переменная может быть унифицированным" - PullRequest
0 голосов
/ 26 сентября 2019

Я продолжаю получать ошибки компиляции из этого куска кода.

Я пытался использовать mallocing, но это не помогло.

else{

    thread_queue* new_running_queue = ready_queue -> link; //copy head
    ready_queue = ready_queue->link; //set head to next in ready_queue


    thread_queue* end = append_thread();//add thread to end of linked list
    end->thread = current_running_thread;
    int err = getcontext(current_running_thread->thread_context);//copy current state

    assert(!err);
    //copy manually of context in the last node in link list

    set_ucontext(end,current_running_thread->thread_context);

    //set the current running thread to the thread at the beginning of queue

    current_running_thread = new_running_queue->thread;
    current_running_thread->thread_id= new_running_queue->thread->thread_id;
    free(new_running_queue);

}

Ошибка:

‘({anonymous})’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
    int err = getcontext(current_running_thread->thread_context);//copy current state
        ^~~
thread.c:120:4: error: ‘end’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
    set_ucontext(end,current_running_thread->thread_context);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
thread.c:123:46: error: ‘new_running_queue’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
    current_running_thread = new_running_queue->thread;
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...