]> granicus.if.org Git - clang/commitdiff
Treat [[gnu::__const]] the same as [[gnu::const]]. GCC's tokenizer can't tell
authorNick Lewycky <nicholas@mxc.ca>
Tue, 29 Oct 2013 03:33:57 +0000 (03:33 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Tue, 29 Oct 2013 03:33:57 +0000 (03:33 +0000)
the difference.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193582 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/Attr.td
test/Parser/cxx0x-attributes.cpp

index d8ba91dcfe1f8e4cb5f776e962f1b7bca5c8a6de..16e249bcf5314cbcf66f0c3fb244fe0b56dacb43 100644 (file)
@@ -314,7 +314,8 @@ def Common : InheritableAttr {
 }
 
 def Const : InheritableAttr {
-  let Spellings = [GNU<"const">, GNU<"__const">, CXX11<"gnu", "const">];
+  let Spellings = [GNU<"const">, GNU<"__const">,
+                   CXX11<"gnu", "const">, CXX11<"gnu", "__const">];
 }
 
 def Constructor : InheritableAttr {
index 7f41be805143209e51fb0c7ec644ef10d9eb460a..824aeae06d6a1b799ff3c5c1c4fc99a0ed965d48 100644 (file)
@@ -304,3 +304,11 @@ class A {
   A([[gnu::unused]] int a);
 };
 A::A([[gnu::unused]] int a) {}
+
+namespace GccConst {
+  // GCC's tokenizer treats const and __const as the same token.
+  [[gnu::const]] int *f1();
+  [[gnu::__const]] int *f2();
+  void f(const int *);
+  void g() { f(f1()); f(f2()); }
+}