Bug 23871 – ImportC: __attribute not recognized

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2023-04-30T17:16:52Z
Last change time
2023-05-02T04:07:04Z
Keywords
ImportC, pull
Assigned to
No Owner
Creator
naydef

Comments

Comment #0 by naydef — 2023-04-30T17:16:52Z
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
Comment #1 by dlang-bot — 2023-05-02T00:22:50Z
@WalterBright created dlang/dmd pull request #15160 "fix Issue 23871 - ImportC: __attribute not recognized" fixing this issue: - fix Issue 23871 - ImportC: __attribute not recognized https://github.com/dlang/dmd/pull/15160
Comment #2 by dlang-bot — 2023-05-02T04:07:04Z
dlang/dmd pull request #15160 "fix Issue 23871 - ImportC: __attribute not recognized" was merged into master: - d9686e153fe35aaf101e841930c820b7e41ace7e by Walter Bright: fix Issue 23871 - ImportC: __attribute not recognized https://github.com/dlang/dmd/pull/15160