Mercurial > hg > CbC > CbC_llvm
comparison clang/test/Sema/dllimport.c @ 207:2e18cbf3894f
LLVM12
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 08 Jun 2021 06:07:14 +0900 |
parents | 1d019706d866 |
children | c4bab56944e8 |
comparison
equal
deleted
inserted
replaced
173:0572611fdcc8 | 207:2e18cbf3894f |
---|---|
1 // RUN: %clang_cc1 -triple i686-win32 -fsyntax-only -fms-extensions -verify -std=c99 -DMS %s | 1 // RUN: %clang_cc1 -triple i686-win32 -fsyntax-only -fms-extensions -verify -std=c99 -DMS %s |
2 // RUN: %clang_cc1 -triple x86_64-win32 -fsyntax-only -fms-extensions -verify -std=c11 -DMS %s | 2 // RUN: %clang_cc1 -triple x86_64-win32 -fsyntax-only -fms-extensions -verify -std=c11 -DMS %s |
3 // RUN: %clang_cc1 -triple i686-mingw32 -fsyntax-only -fms-extensions -verify -std=c11 -DGNU %s | 3 // RUN: %clang_cc1 -triple i686-mingw32 -fsyntax-only -fms-extensions -verify -std=c11 -DGNU %s |
4 // RUN: %clang_cc1 -triple x86_64-mingw32 -fsyntax-only -fms-extensions -verify -std=c99 -DGNU %s | 4 // RUN: %clang_cc1 -triple x86_64-mingw32 -fsyntax-only -fms-extensions -verify -std=c99 -DGNU %s |
5 // RUN: %clang_cc1 -triple aarch64-win32 -fsyntax-only -fms-extensions -verify -std=c99 -DMS %s | 5 // RUN: %clang_cc1 -triple aarch64-win32 -fsyntax-only -fms-extensions -verify -std=c99 -DMS %s |
6 // RUN: %clang_cc1 -triple i686-windows-itanium -fsyntax-only -fms-extensions -verify -std=c99 -DWI %s | |
7 // RUN: %clang_cc1 -triple x86_64-windows-itanium -fsyntax-only -fms-extensions -verify -std=c11 -DWI %s | |
8 // RUN: %clang_cc1 -triple x86_64-scei-ps4 -fsyntax-only -fms-extensions -verify -std=c11 -DWI %s | |
9 // RUN: %clang_cc1 -triple x86_64-scei-ps4 -fsyntax-only -fms-extensions -verify -std=c99 -DWI %s | |
6 | 10 |
7 // Invalid usage. | 11 // Invalid usage. |
8 __declspec(dllimport) typedef int typedef1; | 12 __declspec(dllimport) typedef int typedef1; |
9 // expected-warning@-1{{'dllimport' attribute only applies to functions, variables, classes, and Objective-C interfaces}} | 13 // expected-warning@-1{{'dllimport' attribute only applies to functions, variables, classes, and Objective-C interfaces}} |
10 typedef __declspec(dllimport) int typedef2; | 14 typedef __declspec(dllimport) int typedef2; |
43 // Declare, then reject definition. | 47 // Declare, then reject definition. |
44 #ifdef GNU | 48 #ifdef GNU |
45 // expected-note@+2{{previous attribute is here}} | 49 // expected-note@+2{{previous attribute is here}} |
46 #endif | 50 #endif |
47 __declspec(dllimport) extern int ExternGlobalDeclInit; // expected-note{{previous declaration is here}} | 51 __declspec(dllimport) extern int ExternGlobalDeclInit; // expected-note{{previous declaration is here}} |
48 #ifdef MS | 52 #if defined(MS) || defined(WI) |
49 // expected-warning@+4{{'ExternGlobalDeclInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} | 53 // expected-warning@+4{{'ExternGlobalDeclInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} |
50 #else | 54 #else |
51 // expected-warning@+2{{'ExternGlobalDeclInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} | 55 // expected-warning@+2{{'ExternGlobalDeclInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} |
52 #endif | 56 #endif |
53 int ExternGlobalDeclInit = 1; | 57 int ExternGlobalDeclInit = 1; |
54 | 58 |
55 #ifdef GNU | 59 #ifdef GNU |
56 // expected-note@+2{{previous attribute is here}} | 60 // expected-note@+2{{previous attribute is here}} |
57 #endif | 61 #endif |
58 __declspec(dllimport) int GlobalDeclInit; // expected-note{{previous declaration is here}} | 62 __declspec(dllimport) int GlobalDeclInit; // expected-note{{previous declaration is here}} |
59 #ifdef MS | 63 #if defined(MS) || defined(WI) |
60 // expected-warning@+4{{'GlobalDeclInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} | 64 // expected-warning@+4{{'GlobalDeclInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} |
61 #else | 65 #else |
62 // expected-warning@+2{{'GlobalDeclInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} | 66 // expected-warning@+2{{'GlobalDeclInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} |
63 #endif | 67 #endif |
64 int GlobalDeclInit = 1; | 68 int GlobalDeclInit = 1; |
65 | 69 |
66 #ifdef GNU | 70 #ifdef GNU |
67 // expected-note@+2{{previous attribute is here}} | 71 // expected-note@+2{{previous attribute is here}} |
68 #endif | 72 #endif |
69 int *__attribute__((dllimport)) GlobalDeclChunkAttrInit; // expected-note{{previous declaration is here}} | 73 int *__attribute__((dllimport)) GlobalDeclChunkAttrInit; // expected-note{{previous declaration is here}} |
70 #ifdef MS | 74 #if defined(MS) || defined(WI) |
71 // expected-warning@+4{{'GlobalDeclChunkAttrInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} | 75 // expected-warning@+4{{'GlobalDeclChunkAttrInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} |
72 #else | 76 #else |
73 // expected-warning@+2{{'GlobalDeclChunkAttrInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} | 77 // expected-warning@+2{{'GlobalDeclChunkAttrInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} |
74 #endif | 78 #endif |
75 int *GlobalDeclChunkAttrInit = 0; | 79 int *GlobalDeclChunkAttrInit = 0; |
76 | 80 |
77 #ifdef GNU | 81 #ifdef GNU |
78 // expected-note@+2{{previous attribute is here}} | 82 // expected-note@+2{{previous attribute is here}} |
79 #endif | 83 #endif |
80 int GlobalDeclAttrInit __attribute__((dllimport)); // expected-note{{previous declaration is here}} | 84 int GlobalDeclAttrInit __attribute__((dllimport)); // expected-note{{previous declaration is here}} |
81 #ifdef MS | 85 #if defined(MS) || defined(WI) |
82 // expected-warning@+4{{'GlobalDeclAttrInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} | 86 // expected-warning@+4{{'GlobalDeclAttrInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} |
83 #else | 87 #else |
84 // expected-warning@+2{{'GlobalDeclAttrInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} | 88 // expected-warning@+2{{'GlobalDeclAttrInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} |
85 #endif | 89 #endif |
86 int GlobalDeclAttrInit = 1; | 90 int GlobalDeclAttrInit = 1; |
177 #ifdef GNU | 181 #ifdef GNU |
178 // expected-note@+2{{previous attribute is here}} | 182 // expected-note@+2{{previous attribute is here}} |
179 #endif | 183 #endif |
180 __declspec(dllimport) void redecl3(); // expected-note{{previous declaration is here}} | 184 __declspec(dllimport) void redecl3(); // expected-note{{previous declaration is here}} |
181 // NB: Both MSVC and Clang issue a warning and make redecl3 dllexport. | 185 // NB: Both MSVC and Clang issue a warning and make redecl3 dllexport. |
182 #ifdef MS | 186 #if defined(MS) || defined(WI) |
183 // expected-warning@+4{{'redecl3' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} | 187 // expected-warning@+4{{'redecl3' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} |
184 #else | 188 #else |
185 // expected-warning@+2{{'redecl3' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} | 189 // expected-warning@+2{{'redecl3' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} |
186 #endif | 190 #endif |
187 void redecl3() {} | 191 void redecl3() {} |
200 // expected-warning@+3{{'redecl6' redeclared inline; 'dllimport' attribute ignored}} | 204 // expected-warning@+3{{'redecl6' redeclared inline; 'dllimport' attribute ignored}} |
201 #endif | 205 #endif |
202 __declspec(dllimport) void redecl6(); | 206 __declspec(dllimport) void redecl6(); |
203 inline void redecl6() {} | 207 inline void redecl6() {} |
204 | 208 |
205 #ifdef MS | 209 #if defined(MS) || defined (WI) |
206 // expected-note@+5{{previous declaration is here}} | 210 // expected-note@+5{{previous declaration is here}} |
207 // expected-warning@+5{{redeclaration of 'redecl7' should not add 'dllimport' attribute}} | 211 // expected-warning@+5{{redeclaration of 'redecl7' should not add 'dllimport' attribute}} |
208 #else | 212 #else |
209 // expected-warning@+3{{'dllimport' attribute ignored on inline function}} | 213 // expected-warning@+3{{'dllimport' attribute ignored on inline function}} |
210 #endif | 214 #endif |