]> granicus.if.org Git - clang/commitdiff
mingw-w64: enable support for __declspec(selectany)
authorMartell Malone <martellmalone@gmail.com>
Tue, 18 Apr 2017 15:56:24 +0000 (15:56 +0000)
committerMartell Malone <martellmalone@gmail.com>
Tue, 18 Apr 2017 15:56:24 +0000 (15:56 +0000)
Add selectany as a GCC spelling for mingw-w64

Reviewers: rnk

Differential revision: https://reviews.llvm.org/D32083

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

include/clang/Basic/Attr.td
test/Sema/attr-selectany.c
test/SemaCXX/attr-selectany.cpp

index bf62408db2ccad316cb4e39e9fcca328e110e893..69dbdba3ec177d33892c7e64cd83f8d9ab464149 100644 (file)
@@ -2351,9 +2351,8 @@ def DLLImport : InheritableAttr, TargetSpecificAttr<TargetWindows> {
   let Documentation = [DLLImportDocs];
 }
 
-def SelectAny : InheritableAttr {
-  let Spellings = [Declspec<"selectany">];
-  let LangOpts = [MicrosoftExt];
+def SelectAny : InheritableAttr, TargetSpecificAttr<TargetWindows> {
+  let Spellings = [Declspec<"selectany">, GCC<"selectany">];
   let Documentation = [Undocumented];
 }
 
index 01cca7d7cfa52ea8676a5955907ab31fd0fbe681..9fa2fcade539f21eadfc26291273257bff886879 100644 (file)
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -fms-compatibility -fms-extensions -verify %s
+// RUN: %clang_cc1 -triple x86_64-win32 -fdeclspec -verify %s
+// RUN: %clang_cc1 -triple x86_64-mingw32 -verify %s
 
 extern __declspec(selectany) const int x1 = 1; // no warning, const means we need extern in C++
 
index 9dc14b3c3818429b72834b4644f8cba2db97e153..62fca09ab36411d75b181a6b91802f6742ed3433 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fms-compatibility -fms-extensions -fsyntax-only -verify -std=c++11 %s
+// RUN: %clang_cc1 -triple x86_64-win32 -fms-compatibility -fms-extensions -fsyntax-only -verify -std=c++11 %s
 // MSVC produces similar diagnostics.
 
 __declspec(selectany) void foo() { } // expected-error{{'selectany' can only be applied to data items with external linkage}}