title: warning: ‘noreturn’ function does return
body: <p>I'm doing a thread library (changing context with uncontext.h).
  My function is of type void, and I can't return. But even if I do not return, this warning appears when compiling:</p>
  
  <pre><code>dccthread.c: In function ‘dccthread_init’:
  dccthread.c:184:1: warning: ‘noreturn’ function does return [enabled by default]
   }
  </code></pre>
  
  <p>This is a simplified code of the function (without some details):</p>
  
  <pre><code>void dccthread_init(void (*func), int param) {
      int i=0;
      if (gerente==NULL)
      gerente = (dccthread_t *) malloc(sizeof(dccthread_t));
  
      getcontext(&amp;gerente-&gt;contexto);
      gerente-&gt;contexto.uc_link = NULL;
      gerente-&gt;contexto.uc_stack.ss_sp = malloc ( THREAD_STACK_SIZE );
      gerente-&gt;contexto.uc_stack.ss_size = THREAD_STACK_SIZE;
      gerente-&gt;contexto.uc_stack.ss_flags = 0;
      gerente-&gt;tid=-1;
  
      makecontext(&amp;gerente-&gt;contexto, gerente_escalonador, 0);
      if (principal==NULL)
      principal = (dccthread_t *) malloc(sizeof(dccthread_t));
  
      getcontext(&amp;principal-&gt;contexto);
      principal-&gt;contexto.uc_link = NULL;
      principal-&gt;contexto.uc_stack.ss_sp = malloc ( THREAD_STACK_SIZE );
      principal-&gt;contexto.uc_stack.ss_size = THREAD_STACK_SIZE;
      principal-&gt;contexto.uc_stack.ss_flags = 0;
      makecontext(&amp;principal-&gt;contexto, func, 1, param);
      swapcontext(&amp;gerente-&gt;contexto, &amp;principal-&gt;contexto);
  
  
  }
  </code></pre>
  
  <p>Note that I don't return anytime. But gcc give me this warning. Does anyone know what's the problem?</p>