Skip to content
Tcl Source Code View Ticket
Login

View Ticket

__attribute__((noreturn)) conflicts with stdnoreturn.h

Closed / Fixed04aad56155f0546ddaaa2aaa66106f1b3057eeaeCreated 2 years agoUpdated 2 years ago
Descriptionmarkdown2025-04-07 08:09:13

If <stdnoreturn.h> is included first, then noreturn is defined to _Noreturn, and then __attribute__((noreturn)) will end up being __attribute__((_Noreturn)), which would not be recognized and might result in a compiler warning. To avoid this, use the alternative spelling __attribute__((__noreturn__)) instead. This is supported by the same compiler versions.

But I don't know if there is an equivalent workaround for __declspec(noreturn). An alternative might be to do #define TCL_NORETURN _Noreturn if the compiler is in C11 mode.

Referenced by2
  • 4dccf56126Fix [04aad56155]: __attribute__((noreturn)) conflicts with stdnoreturn.h check-in2025-04-07 09:37:29
  • 5e08166b8cFix [04aad56155]: __attribute__((noreturn)) conflicts with stdnoreturn.h check-in2025-04-07 09:21:48
jan.nijtmanswiki2025-04-07 09:49:58

Thanks for the report. Fixed [here]

Since <stdnoreturn.h> has issues on various platforms, and _Noreturn is already deprecated in C23, I recommend not to use `<stdnoreturn.h>`. But since the double-underscored variants give less chance to problems, your suggestion is better than doing nothing.

See: https://www.gnu.org/software/gnulib/manual/html_node/stdnoreturn_002eh.html

Thanks!

Log in (anonymous is fine) to add a comment.