Skip to content

Commit 8591df9

Browse files
committed
Add explicit @System to extern functions in tests
1 parent 932e523 commit 8591df9

File tree

211 files changed

+514
-507
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

211 files changed

+514
-507
lines changed

test/compilable/compile1.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ template test8163(T...)
476476
}
477477

478478
enum N = 2; // N>=2 triggers the bug
479-
extern Point[N] bar();
479+
@system extern Point[N] bar();
480480

481481
void foo()
482482
{

test/compilable/cppmangle.d

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ TEST_OUTPUT:
1111

1212
import core.stdc.stdio;
1313

14-
extern (C++) int foob(int i, int j, int k);
14+
extern (C++) int foob(int i, int j, int k) @system;
1515

1616
class C
1717
{
@@ -70,13 +70,13 @@ version (Win64)
7070

7171
/****************************************/
7272

73-
extern (C++)
73+
extern (C++) @system
7474
interface D
7575
{
7676
int bar(int i, int j, int k);
7777
}
7878

79-
extern (C++) D getD();
79+
extern (C++) D getD() @system;
8080

8181
void test2()
8282
{
@@ -93,9 +93,9 @@ version (Posix)
9393

9494
/****************************************/
9595

96-
extern (C++) int callE(E);
96+
extern (C++) int callE(E) @system;
9797

98-
extern (C++)
98+
extern (C++) @system
9999
interface E
100100
{
101101
int bar(int i, int j, int k);
@@ -131,7 +131,7 @@ version (Posix)
131131

132132
/****************************************/
133133

134-
extern (C++) void foo4(char* p);
134+
extern (C++) void foo4(char* p) @system;
135135

136136
void test4()
137137
{
@@ -145,7 +145,7 @@ version (Posix)
145145

146146
/****************************************/
147147

148-
extern(C++)
148+
extern(C++) @system
149149
{
150150
struct foo5 { int i; int j; void* p; }
151151

@@ -172,7 +172,7 @@ version (Posix)
172172

173173
/****************************************/
174174

175-
extern(C++)
175+
extern(C++) @system
176176
{
177177
struct S6
178178
{
@@ -182,7 +182,7 @@ extern(C++)
182182
S6 foo6();
183183
}
184184

185-
extern (C) int foosize6();
185+
extern (C) int foosize6() @system;
186186

187187
void test6()
188188
{
@@ -201,7 +201,7 @@ version (Posix)
201201

202202
/****************************************/
203203

204-
extern (C) int foo7();
204+
extern (C) int foo7() @system;
205205

206206
struct S
207207
{
@@ -217,7 +217,7 @@ void test7()
217217

218218
/****************************************/
219219

220-
extern (C++) void foo8(const char *);
220+
extern (C++) void foo8(const char *) @system;
221221

222222
void test8()
223223
{
@@ -235,7 +235,7 @@ version (Posix)
235235

236236
struct elem9 { }
237237

238-
extern(C++) void foobar9(elem9*, elem9*);
238+
extern(C++) void foobar9(elem9*, elem9*) @system;
239239

240240
void test9()
241241
{
@@ -251,7 +251,7 @@ version (Posix)
251251
/****************************************/
252252
// https://issues.dlang.org/show_bug.cgi?id=5148
253253

254-
extern (C++)
254+
extern (C++) @system
255255
{
256256
void foo10(const char*, const char*);
257257
void foo10(const int, const int);
@@ -277,7 +277,7 @@ void test10()
277277
}
278278

279279
// https://issues.dlang.org/show_bug.cgi?id=19504
280-
extern(C++) struct Class19504 {
280+
extern(C++) @system struct Class19504 {
281281
pragma(mangle, "HOHOHO")
282282
~this();
283283
}
@@ -324,7 +324,7 @@ version (Posix)
324324
class Expression;
325325
struct Loc {}
326326

327-
extern(C++)
327+
extern(C++) @system
328328
class CallExp
329329
{
330330
static void test11696a(Loc, Expression, Expression);
@@ -344,13 +344,13 @@ version (Posix)
344344
/**************************************/
345345
// https://issues.dlang.org/show_bug.cgi?id=13337
346346

347-
extern(C++, N13337a.N13337b.N13337c)
347+
extern(C++, N13337a.N13337b.N13337c) @system
348348
{
349349
struct S13337{}
350350
void foo13337(S13337 s);
351351
}
352352

353-
extern(C++, `N13337a`, `N13337b`, `N13337c`)
353+
extern(C++, `N13337a`, `N13337b`, `N13337c`) @system
354354
{
355355
struct S13337_2{}
356356
void foo13337_2(S13337 s);
@@ -367,7 +367,7 @@ version (Posix)
367367
/**************************************/
368368
// https://issues.dlang.org/show_bug.cgi?id=15789
369369

370-
extern (C++) void test15789a(T...)(T args);
370+
extern (C++) void test15789a(T...)(T args) @system;
371371

372372
void test15789()
373373
{
@@ -377,7 +377,7 @@ void test15789()
377377
/**************************************/
378378
// https://issues.dlang.org/show_bug.cgi?id=7030
379379

380-
extern(C++)
380+
extern(C++) @system
381381
{
382382
struct Struct7030
383383
{
@@ -398,7 +398,7 @@ version (Posix)
398398

399399
// Special cases of Itanium mangling
400400

401-
extern (C++, std)
401+
extern (C++, std) @system
402402
{
403403
struct pair(T1, T2)
404404
{
@@ -441,7 +441,7 @@ extern (C++, std)
441441
struct test18957 {}
442442
}
443443

444-
extern (C++, `std`)
444+
extern (C++, `std`) @system
445445
{
446446
struct pair(T1, T2)
447447
{
@@ -484,7 +484,7 @@ extern (C++, `std`)
484484
struct Struct18957 {}
485485
}
486486

487-
extern(C++)
487+
extern(C++) @system
488488
{
489489
// Nspace
490490
std.allocator!int func_18957_1(std.allocator!(int)* v);
@@ -493,7 +493,7 @@ extern(C++)
493493
X func_18957_2(X)(X* v);
494494
}
495495

496-
extern (C++)
496+
extern (C++) @system
497497
{
498498
void func_20413(pair!(int, float), pair!(float, int));
499499
}
@@ -558,7 +558,7 @@ version (Posix) // all non-Windows machines
558558
/**************************************/
559559
// https://issues.dlang.org/show_bug.cgi?id=15388
560560

561-
extern (C++) void test15388(typeof(null));
561+
extern (C++) void test15388(typeof(null)) @system;
562562

563563
version (Posix)
564564
{
@@ -572,16 +572,16 @@ version (Windows)
572572
/**************************************/
573573
// https://issues.dlang.org/show_bug.cgi?id=14086
574574

575-
extern (C++) class Test14086
575+
extern (C++) @system class Test14086
576576
{
577577
this();
578578
~this();
579579
}
580-
extern (C++) class Test14086_2
580+
extern (C++) @system class Test14086_2
581581
{
582582
final ~this();
583583
}
584-
extern (C++) struct Test14086_S
584+
extern (C++) @system struct Test14086_S
585585
{
586586
this(int);
587587
~this();
@@ -615,7 +615,7 @@ version(Win64)
615615
/**************************************/
616616
// https://issues.dlang.org/show_bug.cgi?id=18888
617617

618-
extern (C++)
618+
extern (C++) @system
619619
struct T18888(T)
620620
{
621621
void fun();
@@ -682,7 +682,7 @@ version (Win64)
682682
/**************************************/
683683
// https://issues.dlang.org/show_bug.cgi?id=18891
684684

685-
extern (C++) class C18891
685+
extern (C++) @system class C18891
686686
{
687687
~this();
688688
extern (C++) struct Agg
@@ -711,7 +711,7 @@ version (Win64)
711711
/**************************************/
712712
// Test C++ operator mangling
713713

714-
extern (C++) struct TestOperators
714+
extern (C++) @system struct TestOperators
715715
{
716716
int opCast(T)();
717717
int opBinary(string op)(int x);
@@ -894,7 +894,7 @@ version(Windows)
894894

895895
// https://issues.dlang.org/show_bug.cgi?id=16479
896896
// Missing substitution while mangling C++ template parameter for functions
897-
version (Posix) extern (C++)
897+
version (Posix) extern (C++) @system
898898
{
899899
// Make sure aliases are still resolved
900900
alias Alias16479 = int;
@@ -1068,23 +1068,23 @@ version (Posix) extern (C++)
10681068
// https://issues.dlang.org/show_bug.cgi?id=19278
10691069
// extern(C++, "name") doesn't accept expressions
10701070

1071-
extern(C++, "hello" ~ "world")
1071+
extern(C++, "hello" ~ "world") @system
10721072
{
10731073
void test19278();
10741074
}
10751075
enum NS = "lookup";
1076-
extern(C++, (NS))
1076+
extern(C++, (NS)) @system
10771077
{
10781078
void test19278_2();
10791079
}
10801080
alias AliasSeq(Args...) = Args;
10811081
alias Tup = AliasSeq!("hello", "world");
1082-
extern(C++, (Tup))
1082+
extern(C++, (Tup)) @system
10831083
{
10841084
void test19278_3();
10851085
__gshared size_t test19278_var;
10861086
}
1087-
extern(C++, (AliasSeq!(Tup, "yay")))
1087+
extern(C++, (AliasSeq!(Tup, "yay"))) @system
10881088
{
10891089
void test19278_4();
10901090
}
@@ -1114,7 +1114,7 @@ version(Posix)
11141114
else version(Windows)
11151115
enum __c_wchar_t : wchar;
11161116
alias wchar_t = __c_wchar_t;
1117-
extern (C++) void test_char_mangling(char, wchar, dchar, wchar_t);
1117+
extern (C++) void test_char_mangling(char, wchar, dchar, wchar_t) @system;
11181118
version (Posix)
11191119
{
11201120
static assert(test_char_mangling.mangleof == "_Z18test_char_manglingcDsDiw");
@@ -1128,14 +1128,14 @@ version (Win64)
11281128
version (Posix)
11291129
{
11301130
extern(C++, PR10021_NS) struct PR10021_Struct(T){}
1131-
extern(C++) void PR10021_fun(int i)(PR10021_Struct!int);
1131+
extern(C++) void PR10021_fun(int i)(PR10021_Struct!int) @system;
11321132
static assert(PR10021_fun!0.mangleof == `_Z11PR10021_funILi0EEvN10PR10021_NS14PR10021_StructIiEE`);
11331133
}
11341134

11351135
// https://github.com/dlang/dmd/pull/10021#discussion_r294095749
11361136
version (Posix)
11371137
{
1138-
extern(C++, "a", "b")
1138+
extern(C++, "a", "b") @system
11391139
struct PR10021_Struct2
11401140
{
11411141
void func();
@@ -1149,17 +1149,17 @@ version (Posix)
11491149
version (Posix)
11501150
{
11511151
extern(C++, `ns20022`) enum Enum20022_1 { A = 1, }
1152-
extern(C++) void fun20022_1(Enum20022_1);
1153-
extern(C++, `ns20022`) void fun20022_2(Enum20022_1);
1152+
extern(C++) void fun20022_1(Enum20022_1) @system;
1153+
extern(C++, `ns20022`) void fun20022_2(Enum20022_1) @system;
11541154

1155-
extern(C++, ns20022)
1155+
extern(C++, ns20022) @system
11561156
{
11571157
enum Enum20022_2 { A = 1, }
11581158
void fun20022_5(Enum20022_1);
11591159
void fun20022_6(Enum20022_2);
11601160
}
1161-
extern(C++) void fun20022_3(Enum20022_2);
1162-
extern(C++, `ns20022`) void fun20022_4(Enum20022_2);
1161+
extern(C++) void fun20022_3(Enum20022_2) @system;
1162+
extern(C++, `ns20022`) void fun20022_4(Enum20022_2) @system;
11631163

11641164
static assert(fun20022_1.mangleof == `_Z10fun20022_1N7ns2002211Enum20022_1E`);
11651165
static assert(fun20022_2.mangleof == `_ZN7ns2002210fun20022_2ENS_11Enum20022_1E`);
@@ -1179,14 +1179,14 @@ version (Posix)
11791179
alias V20094 = xvector20094!(ubyte);
11801180
}
11811181

1182-
extern(C++) void test20094(xvector20094!(V20094)* v);
1182+
extern(C++) void test20094(xvector20094!(V20094)* v) @system;
11831183
static assert(test20094.mangleof == `_Z9test20094PN7ns2009412xvector20094INS0_IhEEEE`);
11841184
}
11851185

11861186
// https://issues.dlang.org/show_bug.cgi?id=20223
11871187
version (Posix)
11881188
{
1189-
extern(C++)
1189+
extern(C++) @system
11901190
{
11911191
int test20223_1(T)(int function(const(T)* value));
11921192
int test20223_2(T)(int function(ref const(T) value));
@@ -1212,8 +1212,8 @@ version (Posix)
12121212
// https://issues.dlang.org/show_bug.cgi?id=20224
12131213
version (Posix)
12141214
{
1215-
extern(C++) public int test20224_1(T)(set20224!T set); // ok
1216-
extern(C++) public int test20224_2(T)(ref set20224!T set); // segfault
1215+
extern(C++) public int test20224_1(T)(set20224!T set) @system; // ok
1216+
extern(C++) public int test20224_2(T)(ref set20224!T set) @system; // segfault
12171217

12181218
extern(C++) struct set20224 (T)
12191219
{
@@ -1235,19 +1235,19 @@ version (Posix)
12351235
version (Posix)
12361236
{
12371237
extern (C++) struct Loc2 {};
1238-
extern (C++) class FuncDeclaration
1238+
extern (C++) @system class FuncDeclaration
12391239
{
12401240
static FuncDeclaration create(ref const Loc2, ref const Loc2);
12411241
};
1242-
extern (C++) FuncDeclaration FuncDeclaration_create(ref const Loc2, ref const Loc2);
1242+
extern (C++) FuncDeclaration FuncDeclaration_create(ref const Loc2, ref const Loc2) @system;
12431243

12441244
static assert(FuncDeclaration_create.mangleof == `_Z22FuncDeclaration_createRK4Loc2S1_`);
12451245
static assert(FuncDeclaration.create.mangleof == `_ZN15FuncDeclaration6createERK4Loc2S2_`);
12461246
}
12471247

12481248
enum Enum19542 = func19542!(int).mangleof;
12491249

1250-
extern(C++, `bar`)
1250+
extern(C++, `bar`) @system
12511251
{
12521252
void func19542(T)();
12531253
}

0 commit comments

Comments
 (0)