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

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 27 15:25:07 PDT 2018


nickdesaulniers updated this revision to Diff 162761.
nickdesaulniers added a comment.

- s/c89/GNU inline extension/g and mention -std=gnu89/-fgnu89-inline


Repository:
  rC Clang

https://reviews.llvm.org/D51190

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td


Index: include/clang/Basic/AttrDocs.td
===================================================================
--- include/clang/Basic/AttrDocs.td
+++ include/clang/Basic/AttrDocs.td
@@ -3505,3 +3505,22 @@
 invoking clang with -fno-c++-static-destructors.
   }];
 }
+
+def GnuInlineDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+The ``gnu_inline`` attribute specifies that a function marked ``extern inline``
+should follow the GNU inline extension that if the function cannot be inlined
+(possibly due to being referred to by function pointer), then no out of line
+definition will be emitted (instead of c99's behaviour of always emitting an
+out of line definition).
+
+If ``__GNUC_STDC_INLINE__`` is defined, then the current translation unit is
+not being compiled with ``gnu_inline`` semantics, and the ``gnu_inline``
+function attribute can be used to get GNU inline semantics on a per function basis.
+If ``__GNUC_STDC_INLINE__`` is not defined, then the translation unit is
+already being compiled with GNU inline semantics as the implied default.
+
+This is the default behavior with ``-std=gnu89`` or ``-fgnu89-inline``.
+  }];
+}
Index: include/clang/Basic/Attr.td
===================================================================
--- include/clang/Basic/Attr.td
+++ include/clang/Basic/Attr.td
@@ -1170,7 +1170,7 @@
 def GNUInline : InheritableAttr {
   let Spellings = [GCC<"gnu_inline">];
   let Subjects = SubjectList<[Function]>;
-  let Documentation = [Undocumented];
+  let Documentation = [GnuInlineDocs];
 }
 
 def Hot : InheritableAttr {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51190.162761.patch
Type: text/x-patch
Size: 1589 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180827/f3006c42/attachment.bin>


More information about the cfe-commits mailing list