This wasn't documented https://clang.llvm.org/docs/AttributeReference.html, and briefly mentioned https://clang.llvm.org/docs/UsersManual.html#differences-between-various-standard-modes.
Details
Diff Detail
- Repository
- rC Clang
- Build Status
Buildable 22075 Build 22075: arc lint + arc unit
Event Timeline
Thanks for taking the time to write documentation.
The phrase "C89 convention" is misleading; the original ISO C standard doesn't define the inline keyword at all. Maybe something along the lines of "GNU inline extension". And maybe mention it's the default with -std=gnu89.
include/clang/Basic/AttrDocs.td | ||
---|---|---|
3514–3516 | This description is neither entirely correct nor complete. gnu_inline means:
And in particular as special cases, static inline emits an out-of-line version if needed, a plain inline definition emits an out-of-line version always, and an extern inline definition (in a header) followed by a (non-extern) inline declaration in a source file emits an out-of-line version of the function in that source file but provides the function body for inlining to all includers of the header. Please capitalize the C in C99. | |
3518–3522 | It would make sense to also mention __GNUC_GNU_INLINE__ here, and that exactly one of these two macros will be defined for any compilation (although the macros are meaningless in C++ and should not be used there). | |
3524 | This is the default behavior for all pre-C99 C compilations, notably including -std=c89 (and -std=c94). |
include/clang/Basic/AttrDocs.td | ||
---|---|---|
3518 | Might be useful to be a bit more explicit about how it differs:
| |
3524 | Maybe replace the "And in particular as special cases," with "Some important consequences:" | |
3536 | I'd add: "It is unspecified which macro is defined in a C++ compilation." (In practice, Clang always defines the GNU_INLINE macro, as do very old versions of GCC. More recent versions of GCC define GNU_INLINE in C++98 mode and STDC_INLINE in C++11 mode onwards, despite C++98 and C++11 having identical inline semantics. I don't think we want to give any guarantees about our behavior here.) |
- link to correct doc
- explicitly mention extern inline
- s/c89/GNU inline extension/g and mention -std=gnu89/-fgnu89-inline
- Take rsmith's sugguested wording. Add info about GNUC_STDC_INLINE.
- some final touches recommended by rsmith
BTW, seems like these docs have tests that weren't updated. Fixed with rL341002, but please take a look if that's not the right fix.
This description is neither entirely correct nor complete. gnu_inline means:
And in particular as special cases, static inline emits an out-of-line version if needed, a plain inline definition emits an out-of-line version always, and an extern inline definition (in a header) followed by a (non-extern) inline declaration in a source file emits an out-of-line version of the function in that source file but provides the function body for inlining to all includers of the header.
Please capitalize the C in C99.