Tcl Source Code

View Ticket
Login
Ticket UUID: 04aad56155f0546ddaaa2aaa66106f1b3057eeae
Title: __attribute__((noreturn)) conflicts with stdnoreturn.h
Type: Patch Version: 8.6.16, 9.0.1
Submitter: petere Created on: 2025-04-07 08:09:13
Subsystem: 50. Embedding Support Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2025-04-07 09:49:58
Resolution: Fixed Closed By: jan.nijtmans
    Closed on: 2025-04-07 09:49:58
Description:

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.

User Comments: jan.nijtmans added on 2025-04-07 09:49:58:

Thanks for the report. Fixed [4dccf561263d0f83|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!


Attachments: