phosek created this revision.
phosek added a subscriber: cfe-commits.
phosek set the repository for this revision to rL LLVM.

This is a GCC extension, Clang should accept the attribute without a warning 
for compatibility with GCC.

https://llvm.org/bugs/show_bug.cgi?id=30980


Repository:
  rL LLVM

https://reviews.llvm.org/D26540

Files:
  include/clang/Basic/Attr.td
  test/Sema/attr-leaf.c


Index: test/Sema/attr-leaf.c
===================================================================
--- /dev/null
+++ test/Sema/attr-leaf.c
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -verify -fsyntax-only %s
+// expected-no-diagnostics
+
+void f(void) __attribute__((leaf));
Index: include/clang/Basic/Attr.td
===================================================================
--- include/clang/Basic/Attr.td
+++ include/clang/Basic/Attr.td
@@ -915,6 +915,11 @@
   let Documentation = [LayoutVersionDocs];
 }
 
+def Leaf : IgnoredAttr {
+  let Spellings = [GNU<"leaf">];
+  let Subjects = SubjectList<[Function]>;
+}
+
 def MaxFieldAlignment : InheritableAttr {
   // This attribute has no spellings as it is only ever created implicitly.
   let Spellings = [];


Index: test/Sema/attr-leaf.c
===================================================================
--- /dev/null
+++ test/Sema/attr-leaf.c
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -verify -fsyntax-only %s
+// expected-no-diagnostics
+
+void f(void) __attribute__((leaf));
Index: include/clang/Basic/Attr.td
===================================================================
--- include/clang/Basic/Attr.td
+++ include/clang/Basic/Attr.td
@@ -915,6 +915,11 @@
   let Documentation = [LayoutVersionDocs];
 }
 
+def Leaf : IgnoredAttr {
+  let Spellings = [GNU<"leaf">];
+  let Subjects = SubjectList<[Function]>;
+}
+
 def MaxFieldAlignment : InheritableAttr {
   // This attribute has no spellings as it is only ever created implicitly.
   let Spellings = [];
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to