Bug 22666 – ImportC: Error: attributes should be specified before the function definition

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-01-12T05:48:45Z
Last change time
2022-01-17T07:28:51Z
Keywords
ImportC, pull
Assigned to
No Owner
Creator
dave287091

Comments

Comment #0 by dave287091 — 2022-01-12T05:48:45Z
The system framework CoreFoundation on macOS has a header file that declares the following function: typedef unsigned long CFOptionFlags; typedef signed long CFIndex; static inline __attribute__((always_inline)) CFOptionFlags CFUserNotificationCheckBoxChecked(CFIndex i) __attribute__((availability(macos,introduced=10.0))) __attribute__((availability(ios,unavailable))) __attribute__((availability(watchos,unavailable))) __attribute__((availability(tvos,unavailable))) { return ((CFOptionFlags)(1UL << (8 + i))); } It fails with the following error message: Error: attributes should be specified before the function definition Apparently clang allows attributes in this position (after the parameter list), but gcc does not.
Comment #1 by bugzilla — 2022-01-13T08:38:13Z
I wish the people who inserted these extensions would make up their minds.
Comment #2 by dlang-bot — 2022-01-13T08:56:54Z
@WalterBright updated dlang/dmd pull request #13521 "fix Issue 22666 - ImportC: Error: attributes should be specified befo…" fixing this issue: - fix Issue 22666 - ImportC: Error: attributes should be specified before the function definition https://github.com/dlang/dmd/pull/13521
Comment #3 by dlang-bot — 2022-01-17T07:28:51Z
dlang/dmd pull request #13521 "fix Issue 22666 - ImportC: Error: attributes should be specified befo…" was merged into master: - 5d0fd730d2cfbefcb6fd8ca466f3ff0657f4266e by Walter Bright: fix Issue 22666 - ImportC: Error: attributes should be specified before the function definition https://github.com/dlang/dmd/pull/13521