c - How to silence -Wunreachable-code-return (GCC/Clang) -


when using function has noreturn attribute?

the following code gives warning @ last line.

extern void main_loop(void) __attribute__ ((noreturn));  int my_event_loop(void) {     main_loop();     return my_success_enum;   /* <- '-wunreachable-code-return' */ } 

note return value needed function fits interface , can assigned callback.


  • removing may give problems compilers don't support noreturn attribute.
  • using #pragma gcc diagnostic push/pop work quite verbose.

is there better way quiet warning @ last return?


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -