[PATCH] D51190: [AttrDocs]: document gnu_inline function attribute

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 29 14:38:33 PDT 2018

rsmith added inline comments.

Comment at: include/clang/Basic/AttrDocs.td:3518
+the behavior of ``inline`` in both C99 inline semantics and C++ inline
Might be useful to be a bit more explicit about how it differs:

> [...] is just a hint. In particular, an out-of-line definition is still emitted for a function with external linkage even if all call sites are inlined, unlike in C99 inline semantics and C++ inline semantics.

Comment at: include/clang/Basic/AttrDocs.td:3524
+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
Maybe replace the "And in particular as special cases," with "Some important consequences:"

Comment at: include/clang/Basic/AttrDocs.td:3536
+basis. If ``__GNUC_GNU_INLINE__`` is defined, then the translation unit is
+already being compiled with GNU inline semantics as the implied default.
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.)

  rC Clang


More information about the cfe-commits mailing list