r300562 - mingw-w64: enable support for __declspec(selectany)

Martell Malone via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 18 08:56:25 PDT 2017


Author: martell
Date: Tue Apr 18 10:56:24 2017
New Revision: 300562

URL: http://llvm.org/viewvc/llvm-project?rev=300562&view=rev
Log:
mingw-w64: enable support for __declspec(selectany)

Add selectany as a GCC spelling for mingw-w64

Reviewers: rnk

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

Modified:
    cfe/trunk/include/clang/Basic/Attr.td
    cfe/trunk/test/Sema/attr-selectany.c
    cfe/trunk/test/SemaCXX/attr-selectany.cpp

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=300562&r1=300561&r2=300562&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Tue Apr 18 10:56:24 2017
@@ -2351,9 +2351,8 @@ def DLLImport : InheritableAttr, TargetS
   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];
 }
 

Modified: cfe/trunk/test/Sema/attr-selectany.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-selectany.c?rev=300562&r1=300561&r2=300562&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-selectany.c (original)
+++ cfe/trunk/test/Sema/attr-selectany.c Tue Apr 18 10:56:24 2017
@@ -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++
 

Modified: cfe/trunk/test/SemaCXX/attr-selectany.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/attr-selectany.cpp?rev=300562&r1=300561&r2=300562&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/attr-selectany.cpp (original)
+++ cfe/trunk/test/SemaCXX/attr-selectany.cpp Tue Apr 18 10:56:24 2017
@@ -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}}




More information about the cfe-commits mailing list