Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2025-04-07
09:49 • Closed ticket [04aad56155]: __attribute__((noreturn)) conflicts with stdnoreturn... artifact: 280dc4fe3f user: jan.nijtmans
09:37
Fix [04aad56155]: __attribute__((noreturn)) conflicts with stdnoreturn.h check-in: 4dccf56126 user: jan.nijtmans tags: core-9-0-branch
09:21
Fix [04aad56155]: __attribute__((noreturn)) conflicts with stdnoreturn.h check-in: 5e08166b8c user: jan.nijtmans tags: core-8-6-branch
08:09 • Add attachment [/artifact/c0027159f04193ac|0001-Fix-potential-conflict-of-__attribute__-noreturn.pat... artifact: fbf368a565 user: petere
08:09 • New ticket [04aad56155] __attribute__((noreturn)) conflicts with stdnoreturn.h</... artifact: 3c0a86b7a0 user: petere

__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.