From 007c596e637ba3a933a07b5ee277201612c7fb61 Mon Sep 17 00:00:00 2001 From: Martell Malone Date: Tue, 18 Apr 2017 15:56:24 +0000 Subject: [PATCH] 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300562 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/Attr.td | 5 ++--- test/Sema/attr-selectany.c | 3 ++- test/SemaCXX/attr-selectany.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td index bf62408db2..69dbdba3ec 100644 --- a/include/clang/Basic/Attr.td +++ b/include/clang/Basic/Attr.td @@ -2351,9 +2351,8 @@ def DLLImport : InheritableAttr, TargetSpecificAttr { let Documentation = [DLLImportDocs]; } -def SelectAny : InheritableAttr { - let Spellings = [Declspec<"selectany">]; - let LangOpts = [MicrosoftExt]; +def SelectAny : InheritableAttr, TargetSpecificAttr { + let Spellings = [Declspec<"selectany">, GCC<"selectany">]; let Documentation = [Undocumented]; } diff --git a/test/Sema/attr-selectany.c b/test/Sema/attr-selectany.c index 01cca7d7cf..9fa2fcade5 100644 --- a/test/Sema/attr-selectany.c +++ b/test/Sema/attr-selectany.c @@ -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++ diff --git a/test/SemaCXX/attr-selectany.cpp b/test/SemaCXX/attr-selectany.cpp index 9dc14b3c38..62fca09ab3 100644 --- a/test/SemaCXX/attr-selectany.cpp +++ b/test/SemaCXX/attr-selectany.cpp @@ -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}} -- 2.40.0