April 30, 2023
https://issues.dlang.org/show_bug.cgi?id=23871

          Issue ID: 23871
           Summary: ImportC: __attribute((noreturn)) not recognized
           Product: D
           Version: D2
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: naydef@abv.bg

main.d
----------------
import xawd;

void main()
{

}
----------------

xawd.c
----------------
#include <X11/Intrinsic.h>
----------------

Errors:
----------------
/usr/include/X11/Intrinsic.h(1729): Error: no type-specifier for parameter /usr/include/X11/Intrinsic.h(1733): Error: no type-specifier for parameter /usr/include/X11/Intrinsic.h(1753): Error: missing comma or semicolon after declaration of `XtAppErrorMsg`, found `__attribute` instead /usr/include/X11/Intrinsic.h(1762): Error: missing comma or semicolon after declaration of `XtErrorMsg`, found `__attribute` instead /usr/include/X11/Intrinsic.h(1785): Error: no type-specifier for parameter /usr/include/X11/Intrinsic.h(1789): Error: no type-specifier for parameter /usr/include/X11/Intrinsic.h(1804): Error: missing comma or semicolon after declaration of `XtAppError`, found `__attribute` instead /usr/include/X11/Intrinsic.h(1808): Error: missing comma or semicolon after declaration of `XtError`, found `__attribute` instead
----------------

For the first error:
----------------
extern XtErrorMsgHandler XtAppSetErrorMsgHandler(
    XtAppContext        /* app_context */,
    XtErrorMsgHandler   /* handler */ _X_NORETURN //line 1729
);
----------------
It seems it's caused by _X_NORETURN. The other errors are also caused by it, it seems.

For the error on line 1753:
----------------
extern void XtAppErrorMsg(
    XtAppContext        /* app_context */,
    _Xconst _XtString   /* name */,
    _Xconst _XtString   /* type */,
    _Xconst _XtString   /* class */,
    _Xconst _XtString   /* default */,
    String*             /* params */,
    Cardinal*           /* num_params */
) _X_NORETURN; //line 1753
----------------


_X_NORETURN seems to be defined like this:
-----------------
/* requires xproto >= 7.0.17 */
#if __has_attribute(noreturn) \
    || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)) \
    || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
# define _X_NORETURN __attribute((noreturn))
#else
# define _X_NORETURN
#endif /* GNUC  */
-----------------

It seems __attribute((noreturn)) is not recognized.

Using DMD64 D Compiler v2.103.0

--