From 966a0fc4681a6c3b55ed6c1404c10d9816eeefda Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Tue, 29 Oct 2013 03:33:57 +0000 Subject: [PATCH] Treat [[gnu::__const]] the same as [[gnu::const]]. GCC's tokenizer can't tell the difference. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193582 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/Attr.td | 3 ++- test/Parser/cxx0x-attributes.cpp | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td index d8ba91dcfe..16e249bcf5 100644 --- a/include/clang/Basic/Attr.td +++ b/include/clang/Basic/Attr.td @@ -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 { diff --git a/test/Parser/cxx0x-attributes.cpp b/test/Parser/cxx0x-attributes.cpp index 7f41be8051..824aeae06d 100644 --- a/test/Parser/cxx0x-attributes.cpp +++ b/test/Parser/cxx0x-attributes.cpp @@ -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()); } +} -- 2.40.0