Treat [[gnu::__const]] the same as [[gnu::const]]. GCC's tokenizer can't tell

the difference.

llvm-svn: 193582
This commit is contained in:
Nick Lewycky 2013-10-29 03:33:57 +00:00
parent 451c8de2d8
commit d0604672d9
2 changed files with 10 additions and 1 deletions

View 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 {

View 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()); }
}