diff --git a/src/dmd/dsymbolsem.d b/src/dmd/dsymbolsem.d index 2adac9f56936..d41ccf6cb260 100644 --- a/src/dmd/dsymbolsem.d +++ b/src/dmd/dsymbolsem.d @@ -4049,6 +4049,22 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor if (funcdecl.canInferAttributes(sc)) funcdecl.initInferAttributes(); + /* Warn about external function declarations that may become incorrect + * when @safe is made the default. + * + * extern(D) virtual functions are ok because the compiler will check + * them when they are overridden. + */ + if (funcdecl.isExternal() + && funcdecl.type.toTypeFunction().trust == TRUST.default_ + && !(funcdecl.isVirtual() + && (funcdecl.linkage == LINK.d || funcdecl.linkage == LINK.default_))) + { + deprecation(funcdecl.loc, + "`extern` function `%s` should be marked explicitly as `@safe`, `@system`, or `@trusted`", + funcdecl.toPrettyChars); + } + Module.dprogress++; funcdecl.semanticRun = PASS.semanticdone; diff --git a/src/dmd/func.d b/src/dmd/func.d index a4b28a36cc01..2f01d82c14cc 100644 --- a/src/dmd/func.d +++ b/src/dmd/func.d @@ -1260,6 +1260,13 @@ extern (C++) class FuncDeclaration : Declaration return false; } + final bool isExternal() + { + if (fbody || storage_class & STC.disable) + return false; + return (storage_class & STC.extern_) || (linkage != LINK.default_); + } + /********************************** * Decide if attributes for this function can be inferred from examining * the function body. diff --git a/test/compilable/compile1.d b/test/compilable/compile1.d index 1b6d1f4eb036..9c41274738c5 100644 --- a/test/compilable/compile1.d +++ b/test/compilable/compile1.d @@ -476,7 +476,7 @@ template test8163(T...) } enum N = 2; // N>=2 triggers the bug - extern Point[N] bar(); + @system extern Point[N] bar(); void foo() { diff --git a/test/compilable/cppmangle.d b/test/compilable/cppmangle.d index b9c4ea5921c0..d7158bc1a6fb 100644 --- a/test/compilable/cppmangle.d +++ b/test/compilable/cppmangle.d @@ -11,7 +11,7 @@ TEST_OUTPUT: import core.stdc.stdio; -extern (C++) int foob(int i, int j, int k); +extern (C++) int foob(int i, int j, int k) @system; class C { @@ -70,13 +70,13 @@ version (Win64) /****************************************/ -extern (C++) +extern (C++) @system interface D { int bar(int i, int j, int k); } -extern (C++) D getD(); +extern (C++) D getD() @system; void test2() { @@ -93,9 +93,9 @@ version (Posix) /****************************************/ -extern (C++) int callE(E); +extern (C++) int callE(E) @system; -extern (C++) +extern (C++) @system interface E { int bar(int i, int j, int k); @@ -131,7 +131,7 @@ version (Posix) /****************************************/ -extern (C++) void foo4(char* p); +extern (C++) void foo4(char* p) @system; void test4() { @@ -145,7 +145,7 @@ version (Posix) /****************************************/ -extern(C++) +extern(C++) @system { struct foo5 { int i; int j; void* p; } @@ -172,7 +172,7 @@ version (Posix) /****************************************/ -extern(C++) +extern(C++) @system { struct S6 { @@ -182,7 +182,7 @@ extern(C++) S6 foo6(); } -extern (C) int foosize6(); +extern (C) int foosize6() @system; void test6() { @@ -201,7 +201,7 @@ version (Posix) /****************************************/ -extern (C) int foo7(); +extern (C) int foo7() @system; struct S { @@ -217,7 +217,7 @@ void test7() /****************************************/ -extern (C++) void foo8(const char *); +extern (C++) void foo8(const char *) @system; void test8() { @@ -235,7 +235,7 @@ version (Posix) struct elem9 { } -extern(C++) void foobar9(elem9*, elem9*); +extern(C++) void foobar9(elem9*, elem9*) @system; void test9() { @@ -251,7 +251,7 @@ version (Posix) /****************************************/ // https://issues.dlang.org/show_bug.cgi?id=5148 -extern (C++) +extern (C++) @system { void foo10(const char*, const char*); void foo10(const int, const int); @@ -277,7 +277,7 @@ void test10() } // https://issues.dlang.org/show_bug.cgi?id=19504 -extern(C++) struct Class19504 { +extern(C++) @system struct Class19504 { pragma(mangle, "HOHOHO") ~this(); } @@ -324,7 +324,7 @@ version (Posix) class Expression; struct Loc {} -extern(C++) +extern(C++) @system class CallExp { static void test11696a(Loc, Expression, Expression); @@ -344,13 +344,13 @@ version (Posix) /**************************************/ // https://issues.dlang.org/show_bug.cgi?id=13337 -extern(C++, N13337a.N13337b.N13337c) +extern(C++, N13337a.N13337b.N13337c) @system { struct S13337{} void foo13337(S13337 s); } -extern(C++, `N13337a`, `N13337b`, `N13337c`) +extern(C++, `N13337a`, `N13337b`, `N13337c`) @system { struct S13337_2{} void foo13337_2(S13337 s); @@ -367,7 +367,7 @@ version (Posix) /**************************************/ // https://issues.dlang.org/show_bug.cgi?id=15789 -extern (C++) void test15789a(T...)(T args); +extern (C++) void test15789a(T...)(T args) @system; void test15789() { @@ -377,7 +377,7 @@ void test15789() /**************************************/ // https://issues.dlang.org/show_bug.cgi?id=7030 -extern(C++) +extern(C++) @system { struct Struct7030 { @@ -398,7 +398,7 @@ version (Posix) // Special cases of Itanium mangling -extern (C++, std) +extern (C++, std) @system { struct pair(T1, T2) { @@ -441,7 +441,7 @@ extern (C++, std) struct test18957 {} } -extern (C++, `std`) +extern (C++, `std`) @system { struct pair(T1, T2) { @@ -484,7 +484,7 @@ extern (C++, `std`) struct Struct18957 {} } -extern(C++) +extern(C++) @system { // Nspace std.allocator!int func_18957_1(std.allocator!(int)* v); @@ -493,7 +493,7 @@ extern(C++) X func_18957_2(X)(X* v); } -extern (C++) +extern (C++) @system { void func_20413(pair!(int, float), pair!(float, int)); } @@ -558,7 +558,7 @@ version (Posix) // all non-Windows machines /**************************************/ // https://issues.dlang.org/show_bug.cgi?id=15388 -extern (C++) void test15388(typeof(null)); +extern (C++) void test15388(typeof(null)) @system; version (Posix) { @@ -572,16 +572,16 @@ version (Windows) /**************************************/ // https://issues.dlang.org/show_bug.cgi?id=14086 -extern (C++) class Test14086 +extern (C++) @system class Test14086 { this(); ~this(); } -extern (C++) class Test14086_2 +extern (C++) @system class Test14086_2 { final ~this(); } -extern (C++) struct Test14086_S +extern (C++) @system struct Test14086_S { this(int); ~this(); @@ -615,7 +615,7 @@ version(Win64) /**************************************/ // https://issues.dlang.org/show_bug.cgi?id=18888 -extern (C++) +extern (C++) @system struct T18888(T) { void fun(); @@ -682,7 +682,7 @@ version (Win64) /**************************************/ // https://issues.dlang.org/show_bug.cgi?id=18891 -extern (C++) class C18891 +extern (C++) @system class C18891 { ~this(); extern (C++) struct Agg @@ -711,7 +711,7 @@ version (Win64) /**************************************/ // Test C++ operator mangling -extern (C++) struct TestOperators +extern (C++) @system struct TestOperators { int opCast(T)(); int opBinary(string op)(int x); @@ -894,7 +894,7 @@ version(Windows) // https://issues.dlang.org/show_bug.cgi?id=16479 // Missing substitution while mangling C++ template parameter for functions -version (Posix) extern (C++) +version (Posix) extern (C++) @system { // Make sure aliases are still resolved alias Alias16479 = int; @@ -1068,23 +1068,23 @@ version (Posix) extern (C++) // https://issues.dlang.org/show_bug.cgi?id=19278 // extern(C++, "name") doesn't accept expressions -extern(C++, "hello" ~ "world") +extern(C++, "hello" ~ "world") @system { void test19278(); } enum NS = "lookup"; -extern(C++, (NS)) +extern(C++, (NS)) @system { void test19278_2(); } alias AliasSeq(Args...) = Args; alias Tup = AliasSeq!("hello", "world"); -extern(C++, (Tup)) +extern(C++, (Tup)) @system { void test19278_3(); __gshared size_t test19278_var; } -extern(C++, (AliasSeq!(Tup, "yay"))) +extern(C++, (AliasSeq!(Tup, "yay"))) @system { void test19278_4(); } @@ -1114,7 +1114,7 @@ version(Posix) else version(Windows) enum __c_wchar_t : wchar; alias wchar_t = __c_wchar_t; -extern (C++) void test_char_mangling(char, wchar, dchar, wchar_t); +extern (C++) void test_char_mangling(char, wchar, dchar, wchar_t) @system; version (Posix) { static assert(test_char_mangling.mangleof == "_Z18test_char_manglingcDsDiw"); @@ -1128,14 +1128,14 @@ version (Win64) version (Posix) { extern(C++, PR10021_NS) struct PR10021_Struct(T){} - extern(C++) void PR10021_fun(int i)(PR10021_Struct!int); + extern(C++) void PR10021_fun(int i)(PR10021_Struct!int) @system; static assert(PR10021_fun!0.mangleof == `_Z11PR10021_funILi0EEvN10PR10021_NS14PR10021_StructIiEE`); } // https://github.com/dlang/dmd/pull/10021#discussion_r294095749 version (Posix) { - extern(C++, "a", "b") + extern(C++, "a", "b") @system struct PR10021_Struct2 { void func(); @@ -1149,17 +1149,17 @@ version (Posix) version (Posix) { extern(C++, `ns20022`) enum Enum20022_1 { A = 1, } - extern(C++) void fun20022_1(Enum20022_1); - extern(C++, `ns20022`) void fun20022_2(Enum20022_1); + extern(C++) void fun20022_1(Enum20022_1) @system; + extern(C++, `ns20022`) void fun20022_2(Enum20022_1) @system; - extern(C++, ns20022) + extern(C++, ns20022) @system { enum Enum20022_2 { A = 1, } void fun20022_5(Enum20022_1); void fun20022_6(Enum20022_2); } - extern(C++) void fun20022_3(Enum20022_2); - extern(C++, `ns20022`) void fun20022_4(Enum20022_2); + extern(C++) void fun20022_3(Enum20022_2) @system; + extern(C++, `ns20022`) void fun20022_4(Enum20022_2) @system; static assert(fun20022_1.mangleof == `_Z10fun20022_1N7ns2002211Enum20022_1E`); static assert(fun20022_2.mangleof == `_ZN7ns2002210fun20022_2ENS_11Enum20022_1E`); @@ -1179,14 +1179,14 @@ version (Posix) alias V20094 = xvector20094!(ubyte); } - extern(C++) void test20094(xvector20094!(V20094)* v); + extern(C++) void test20094(xvector20094!(V20094)* v) @system; static assert(test20094.mangleof == `_Z9test20094PN7ns2009412xvector20094INS0_IhEEEE`); } // https://issues.dlang.org/show_bug.cgi?id=20223 version (Posix) { - extern(C++) + extern(C++) @system { int test20223_1(T)(int function(const(T)* value)); int test20223_2(T)(int function(ref const(T) value)); @@ -1212,8 +1212,8 @@ version (Posix) // https://issues.dlang.org/show_bug.cgi?id=20224 version (Posix) { - extern(C++) public int test20224_1(T)(set20224!T set); // ok - extern(C++) public int test20224_2(T)(ref set20224!T set); // segfault + extern(C++) public int test20224_1(T)(set20224!T set) @system; // ok + extern(C++) public int test20224_2(T)(ref set20224!T set) @system; // segfault extern(C++) struct set20224 (T) { @@ -1235,11 +1235,11 @@ version (Posix) version (Posix) { extern (C++) struct Loc2 {}; - extern (C++) class FuncDeclaration + extern (C++) @system class FuncDeclaration { static FuncDeclaration create(ref const Loc2, ref const Loc2); }; - extern (C++) FuncDeclaration FuncDeclaration_create(ref const Loc2, ref const Loc2); + extern (C++) FuncDeclaration FuncDeclaration_create(ref const Loc2, ref const Loc2) @system; static assert(FuncDeclaration_create.mangleof == `_Z22FuncDeclaration_createRK4Loc2S1_`); static assert(FuncDeclaration.create.mangleof == `_ZN15FuncDeclaration6createERK4Loc2S2_`); @@ -1247,7 +1247,7 @@ version (Posix) enum Enum19542 = func19542!(int).mangleof; -extern(C++, `bar`) +extern(C++, `bar`) @system { void func19542(T)(); } diff --git a/test/compilable/cppmangle3.d b/test/compilable/cppmangle3.d index 6cab25e21c69..bb0f7b26a2a5 100644 --- a/test/compilable/cppmangle3.d +++ b/test/compilable/cppmangle3.d @@ -22,7 +22,7 @@ int foo; // no name clashing with above namespace extern(C++, "std", "chrono") { - void func(); + void func() @system; } version(Windows) static assert(func.mangleof == "?func@chrono@std@@YAXXZ"); @@ -32,7 +32,7 @@ struct Foo { extern(C++, "namespace") { - static void bar(); + static void bar() @system; } } diff --git a/test/compilable/cppmangle_abitag.d b/test/compilable/cppmangle_abitag.d index f681174430e3..29e4fdb63c2f 100644 --- a/test/compilable/cppmangle_abitag.d +++ b/test/compilable/cppmangle_abitag.d @@ -8,6 +8,7 @@ import core.attribute; extern(C++): +@system: alias Tuple(A...) = A; enum foo_bar = gnuAbiTag("foo", "bar"); diff --git a/test/compilable/ddoc11.d b/test/compilable/ddoc11.d index 3fcf2ca00da5..621c9a2df8b4 100644 --- a/test/compilable/ddoc11.d +++ b/test/compilable/ddoc11.d @@ -35,6 +35,7 @@ class Foo extern (C): +@system: /// struct div_t { int quot,rem; } @@ -49,7 +50,7 @@ struct lldiv_t { long quot,rem; } - void *calloc(size_t, size_t); /// + void *calloc(size_t, size_t); /// void *malloc(size_t); /// dittx /** diff --git a/test/compilable/ddoc11511.d b/test/compilable/ddoc11511.d index 117eba463d99..f5a0cbc20cdd 100644 --- a/test/compilable/ddoc11511.d +++ b/test/compilable/ddoc11511.d @@ -9,7 +9,7 @@ abcd = none1 bcdef = none23 ... = doo */ -void foo(int abcd, int bcdef, ...); +void foo(int abcd, int bcdef, ...) @system; /** Params: @@ -17,4 +17,4 @@ abcd = none1 bcdef = none23 arr = doo */ -void foo(int abcd, int bcdef, int[] arr...); +void foo(int abcd, int bcdef, int[] arr...) @system; diff --git a/test/compilable/ddoc2273.d b/test/compilable/ddoc2273.d index ec3b74a79396..c76cfe14a782 100644 --- a/test/compilable/ddoc2273.d +++ b/test/compilable/ddoc2273.d @@ -26,7 +26,7 @@ Templ!([1, 2, 3]) max(T...)() { } template Base64Impl(char Map62th, char Map63th, char Padding) { } /// -int sqlite3_config(int,...); +int sqlite3_config(int,...) @system; template staticIndexOf(T, TList...) { alias int staticIndexOf; } diff --git a/test/compilable/ddoc6491.d b/test/compilable/ddoc6491.d index 5fe37a33ea6b..8f2a1e0037ad 100644 --- a/test/compilable/ddoc6491.d +++ b/test/compilable/ddoc6491.d @@ -9,6 +9,6 @@ import core.cpuid; enum int c6491 = 4; /// test -void bug6491a(int a = ddoc6491.c6491, string b = core.cpuid.vendor); +void bug6491a(int a = ddoc6491.c6491, string b = core.cpuid.vendor) @system; diff --git a/test/compilable/ddoc7555.d b/test/compilable/ddoc7555.d index ec3001c500c4..10ce8fb1a3f3 100644 --- a/test/compilable/ddoc7555.d +++ b/test/compilable/ddoc7555.d @@ -50,4 +50,4 @@ Macros: X8=$8 X9=$9 */ -void dummy(); +void dummy() @system; diff --git a/test/compilable/ddoc9727.d b/test/compilable/ddoc9727.d index d15a3bf720ae..1d7ffb3330d7 100644 --- a/test/compilable/ddoc9727.d +++ b/test/compilable/ddoc9727.d @@ -4,7 +4,7 @@ module ddoc9727; /** The function foo. */ -void foo(int x); +void foo(int x) @system; /** */ unittest diff --git a/test/compilable/dtoh_ClassDeclaration.d b/test/compilable/dtoh_ClassDeclaration.d index 093020c133e2..55032a85d263 100644 --- a/test/compilable/dtoh_ClassDeclaration.d +++ b/test/compilable/dtoh_ClassDeclaration.d @@ -125,7 +125,7 @@ extern (C++) align(1) class Aligned this(int a) {} } -extern (C++) class A +extern (C++) @system class A { int a; C c; diff --git a/test/compilable/dtoh_StructDeclaration.d b/test/compilable/dtoh_StructDeclaration.d index 7c4b0ea2c21d..187231317520 100644 --- a/test/compilable/dtoh_StructDeclaration.d +++ b/test/compilable/dtoh_StructDeclaration.d @@ -145,7 +145,7 @@ extern (C++) align(1) struct Aligned this(int a) {} } -extern (C++) struct A +extern (C++) @system struct A { int a; S s; diff --git a/test/compilable/dtoh_functions.d b/test/compilable/dtoh_functions.d index 8d7b061d59c5..ba13664bad63 100644 --- a/test/compilable/dtoh_functions.d +++ b/test/compilable/dtoh_functions.d @@ -35,8 +35,8 @@ int foo(int x) return x * 42; } -extern (C) int fun(); -extern (C++) int fun2(); +extern (C) int fun() @system; +extern (C++) int fun2() @system; extern (C) int bar(int x) { diff --git a/test/compilable/extra-files/header17125.d b/test/compilable/extra-files/header17125.d index 7f249a8b867f..df2d342040d2 100644 --- a/test/compilable/extra-files/header17125.d +++ b/test/compilable/extra-files/header17125.d @@ -1,8 +1,8 @@ -void func1(real value = 10.35e4L); -void func2(real value = 520.199e3F); -void func3(real value = 9.70e5); -void func4(real value = 1024.5e2F); -void func5(real value = 41250.2e1L); +void func1(real value = 10.35e4L) @system; +void func2(real value = 520.199e3F) @system; +void func3(real value = 9.70e5) @system; +void func4(real value = 1024.5e2F) @system; +void func5(real value = 41250.2e1L) @system; int main() { return 0; diff --git a/test/compilable/extra-files/header2.d b/test/compilable/extra-files/header2.d index 383181f98012..12d23b2b0ee9 100644 --- a/test/compilable/extra-files/header2.d +++ b/test/compilable/extra-files/header2.d @@ -10,10 +10,10 @@ void bar(in void *p) { } -void f(void function() f2); +void f(void function() f2) @system; class C2; -void foo2(const C2 c); +void foo2(const C2 c) @system; struct Foo3 { diff --git a/test/compilable/extra-files/pkgDIP37/datetime/common.d b/test/compilable/extra-files/pkgDIP37/datetime/common.d index 5a402abe482a..c700e3a5f601 100644 --- a/test/compilable/extra-files/pkgDIP37/datetime/common.d +++ b/test/compilable/extra-files/pkgDIP37/datetime/common.d @@ -1,3 +1,3 @@ module pkgDIP37.datetime.common; -void def(); +void def() @system; diff --git a/test/compilable/extra-files/pkgDIP37/test17629/common.di b/test/compilable/extra-files/pkgDIP37/test17629/common.di index 9cd182f6a071..9ed35326b953 100644 --- a/test/compilable/extra-files/pkgDIP37/test17629/common.di +++ b/test/compilable/extra-files/pkgDIP37/test17629/common.di @@ -1,3 +1,3 @@ module pkgDIP37.test17629.common; -void foo17629(); +void foo17629() @system; diff --git a/test/compilable/fail137.d b/test/compilable/fail137.d index c6876d16e9f8..1391f6f19801 100644 --- a/test/compilable/fail137.d +++ b/test/compilable/fail137.d @@ -1,7 +1,7 @@ // https://issues.dlang.org/show_bug.cgi?id=751 // Compiler segfault on template expansion -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; template TypeTuple( TList... ) { diff --git a/test/compilable/fix20416.d b/test/compilable/fix20416.d index 19ad74df1cf7..f7c030bfde8d 100644 --- a/test/compilable/fix20416.d +++ b/test/compilable/fix20416.d @@ -7,7 +7,7 @@ alias P = int*; -ref P foo(return ref P); +ref P foo(return ref P) @system; P bar() { @@ -24,7 +24,7 @@ P bar() struct S { string x; - ref S foo() return; + ref S foo() return @system; } diff --git a/test/compilable/ice11906.d b/test/compilable/ice11906.d index f568701b4635..dbe5da783b6b 100644 --- a/test/compilable/ice11906.d +++ b/test/compilable/ice11906.d @@ -1,7 +1,7 @@ // REQUIRED_ARGS: -o- // PERMUTE_ARGS: -nothrow /*extern(Windows) */export int GetModuleHandleA(const char* lpModuleName); +nothrow /*extern(Windows) */export int GetModuleHandleA(const char* lpModuleName) @system; void main() { diff --git a/test/compilable/imports/a8392.d b/test/compilable/imports/a8392.d index 4677b50bbf21..b06ec2d3ab2a 100644 --- a/test/compilable/imports/a8392.d +++ b/test/compilable/imports/a8392.d @@ -4,7 +4,7 @@ import ice8392; class B { - this(B); + this(B) @system; } void foob(A a, B b) diff --git a/test/compilable/interpret3.d b/test/compilable/interpret3.d index f3bb39e3c03e..12a698288f54 100644 --- a/test/compilable/interpret3.d +++ b/test/compilable/interpret3.d @@ -7710,7 +7710,7 @@ static assert(!__traits(compiles, { alias bug18057 = RBNode!int; })); void test19140() { - real f19140(); + real f19140() @system; static if (__traits(compiles, (){ enum real r = f19140(); })) {} } diff --git a/test/compilable/isreturnonstack.d b/test/compilable/isreturnonstack.d index 920f0ec50114..82345bf4d913 100644 --- a/test/compilable/isreturnonstack.d +++ b/test/compilable/isreturnonstack.d @@ -1,7 +1,7 @@ struct S { int[10] a; } -int test1(); -S test2(); +int test1() @system; +S test2() @system; static assert(__traits(isReturnOnStack, test1) == false); static assert(__traits(isReturnOnStack, test2) == true); diff --git a/test/compilable/issue15818.d b/test/compilable/issue15818.d index 4aed650fb29c..2a908bff5416 100644 --- a/test/compilable/issue15818.d +++ b/test/compilable/issue15818.d @@ -1,10 +1,10 @@ module issue15818; -void f(int); -void f(int); -void f(int); -void f(int); -void f(int); +void f(int) @system; +void f(int) @system; +void f(int) @system; +void f(int) @system; +void f(int) @system; pragma(mangle, "_D10issue158181fFiZv") void theVeritableF(int){} diff --git a/test/compilable/ob1.d b/test/compilable/ob1.d index 99648767338e..2347fba797b1 100644 --- a/test/compilable/ob1.d +++ b/test/compilable/ob1.d @@ -7,14 +7,14 @@ struct Allocation { size_t length; } -void canFind(scope Allocation); +void canFind(scope Allocation) @system; -int* malloc(); -void free(int*); -void pitcher(); -void borrow(scope int*); -void borrow2c(const scope int*, const scope int*); -void out1(out int*); +int* malloc() @system; +void free(int*) @system; +void pitcher() @system; +void borrow(scope int*) @system; +void borrow2c(const scope int*, const scope int*) @system; +void out1(out int*) @system; /*****************************/ @@ -109,7 +109,7 @@ void deallocate(int* ptr, size_t length) @live /*******************************/ -void zoo1(int); +void zoo1(int) @system; @live void zoo2() { int* p = malloc(); diff --git a/test/compilable/pr9374.d b/test/compilable/pr9374.d index 912639d40d67..24903bbeea17 100644 --- a/test/compilable/pr9374.d +++ b/test/compilable/pr9374.d @@ -4,12 +4,12 @@ struct OnlyResult { - this(return scope ref int v2); + this(return scope ref int v2) @system; void* data; } -OnlyResult foo(return scope ref int v2); +OnlyResult foo(return scope ref int v2) @system; OnlyResult only(int y) { diff --git a/test/compilable/protection/basic/mod1.d b/test/compilable/protection/basic/mod1.d index 76527bd5ca7a..a81b940086aa 100644 --- a/test/compilable/protection/basic/mod1.d +++ b/test/compilable/protection/basic/mod1.d @@ -8,6 +8,6 @@ class Test { public void publicFoo(); protected void protectedFoo(); - package void packageFoo(); - private void privateFoo(); + package void packageFoo() @system; + private void privateFoo() @system; } diff --git a/test/compilable/protection/subpkg/explicit.d b/test/compilable/protection/subpkg/explicit.d index 306ec9f2866b..7b83c75b3d77 100644 --- a/test/compilable/protection/subpkg/explicit.d +++ b/test/compilable/protection/subpkg/explicit.d @@ -1,4 +1,4 @@ module protection.subpkg.explicit; -package(protection) void commonAncestorFoo(); -package(protection.subpkg) void samePkgFoo(); +package(protection) void commonAncestorFoo() @system; +package(protection.subpkg) void samePkgFoo() @system; diff --git a/test/compilable/sharedopt.d b/test/compilable/sharedopt.d index bac0ce03b5a9..cedd87abf51c 100644 --- a/test/compilable/sharedopt.d +++ b/test/compilable/sharedopt.d @@ -14,6 +14,6 @@ struct S int i; } -void destroyMutex(int i); +void destroyMutex(int i) @system; struct Mutex { int i; } diff --git a/test/compilable/test13008.d b/test/compilable/test13008.d index fd1f41db9cda..5221bc123599 100644 --- a/test/compilable/test13008.d +++ b/test/compilable/test13008.d @@ -6,5 +6,5 @@ TEST_OUTPUT* --- */ deprecated class Dep { } -deprecated Dep depFunc1(); // error -deprecated void depFunc2(Dep); // error +deprecated Dep depFunc1() @system; // error +deprecated void depFunc2(Dep) @system; // error diff --git a/test/compilable/test15802.d b/test/compilable/test15802.d index 9566eab6d9b6..f5e04bf35bb1 100644 --- a/test/compilable/test15802.d +++ b/test/compilable/test15802.d @@ -1,4 +1,4 @@ -extern(C++) { +extern(C++) @system { template Foo(T) { static int boo(); } diff --git a/test/compilable/test16031.d b/test/compilable/test16031.d index 7239522e1072..3cc18561112d 100644 --- a/test/compilable/test16031.d +++ b/test/compilable/test16031.d @@ -1,7 +1,7 @@ // REQUIRED_ARGS: -fPIC -lib // PERMUTE_ARGS: // DISABLED: win32 win64 -extern void throwing(); +@system extern void throwing(); void foo() { diff --git a/test/compilable/test16303.d b/test/compilable/test16303.d index 38589750755f..40ca9144386d 100644 --- a/test/compilable/test16303.d +++ b/test/compilable/test16303.d @@ -1,7 +1,7 @@ // https://issues.dlang.org/show_bug.cgi?id=16303 -void yayf(void function(int*) fp); -void yayd(void delegate(int*) dg); +void yayf(void function(int*) fp) @system; +void yayd(void delegate(int*) dg) @system; void bar() { diff --git a/test/compilable/test16492.d b/test/compilable/test16492.d index 3fe1961ae392..58d2156bf863 100644 --- a/test/compilable/test16492.d +++ b/test/compilable/test16492.d @@ -1,7 +1,7 @@ // ARG_SETS: -debug; -o-; -debug -preview=dip1000 // https://issues.dlang.org/show_bug.cgi?id=16492 -void mayCallGC(); +void mayCallGC() @system; void test() @nogc pure { diff --git a/test/compilable/test16621.d b/test/compilable/test16621.d index d5800b12401c..54cf47b7b3c8 100644 --- a/test/compilable/test16621.d +++ b/test/compilable/test16621.d @@ -14,7 +14,7 @@ struct Vector2f alias xxx this; } -void foo(ref Vector2f pos); +void foo(ref Vector2f pos) @system; void test() { diff --git a/test/compilable/test17349.d b/test/compilable/test17349.d index 06070e6d7513..195409182aa4 100644 --- a/test/compilable/test17349.d +++ b/test/compilable/test17349.d @@ -5,26 +5,26 @@ // https://issues.dlang.org/show_bug.cgi?id=16538 -const(int) retConst1(); -int retConst2(); +const(int) retConst1() @system; +int retConst2() @system; auto retConst = [&retConst1, &retConst2]; -const(int*) retConstPtr1(); -const(int)* retConstPtr2(); +const(int*) retConstPtr1() @system; +const(int)* retConstPtr2() @system; auto retConstPtr = [&retConstPtr1, &retConstPtr2]; -void constArray1(const(int)[1]); -void constArray2(const(int[1])); +void constArray1(const(int)[1]) @system; +void constArray2(const(int[1])) @system; auto constArray = [&constArray1, &constArray2]; -const(int)[] retConstSlice1(); -const(int[]) retConstSlice2(); +const(int)[] retConstSlice1() @system; +const(int[]) retConstSlice2() @system; auto retConstSlice = [&retConstSlice1, &retConstSlice2]; -void constSlice1(const(int)[]); -void constSlice2(const(int[])); +void constSlice1(const(int)[]) @system; +void constSlice2(const(int[])) @system; auto constSlice = [&constSlice1, &constSlice2]; -void ptrToConst1(const(int)*); -void ptrToConst2(const(int*)); +void ptrToConst1(const(int)*) @system; +void ptrToConst2(const(int*)) @system; auto ptrToConst = [&ptrToConst1, &ptrToConst2]; diff --git a/test/compilable/test17590.d b/test/compilable/test17590.d index 6eec76f7423e..38ec2c94b918 100644 --- a/test/compilable/test17590.d +++ b/test/compilable/test17590.d @@ -1,6 +1,6 @@ // REQUIRED_ARGS: -o- -void lazyfun(scope lazy int a) @nogc; +void lazyfun(scope lazy int a) @nogc @system; // Test that returning a local _static_ struct does not lead to allocation of a closure. auto foo_static(int a, bool b) @nogc { diff --git a/test/compilable/test17793.d b/test/compilable/test17793.d index d122a96ddaa2..589715881c54 100644 --- a/test/compilable/test17793.d +++ b/test/compilable/test17793.d @@ -3,8 +3,8 @@ import core.simd; version (D_AVX) { - double4 foo(); - void test(double[4]); + double4 foo() @system; + void test(double[4]) @system; void main() { diff --git a/test/compilable/test18474.d b/test/compilable/test18474.d index 454e9c507f33..5740075b1ef2 100644 --- a/test/compilable/test18474.d +++ b/test/compilable/test18474.d @@ -1,6 +1,6 @@ shared struct A { - this(this); + this(this) @system; } struct B diff --git a/test/compilable/test18737.d b/test/compilable/test18737.d index 17a27dfd0922..f8af9cef47fb 100644 --- a/test/compilable/test18737.d +++ b/test/compilable/test18737.d @@ -6,7 +6,7 @@ struct S { - this(char); + this(char) @system; this(int j) { diff --git a/test/compilable/test19491.d b/test/compilable/test19491.d index 3a341b3ad269..b0d35bc38cfc 100644 --- a/test/compilable/test19491.d +++ b/test/compilable/test19491.d @@ -2,7 +2,7 @@ class Foo { - shared this(); + shared this() @system; } void test() diff --git a/test/compilable/test19713.d b/test/compilable/test19713.d index 5201404e2043..49fcf16e1869 100644 --- a/test/compilable/test19713.d +++ b/test/compilable/test19713.d @@ -1,4 +1,4 @@ -extern (C++) +extern (C++) @system { double twice(double d) { diff --git a/test/compilable/test20417.d b/test/compilable/test20417.d index 230ad317db92..714dff89fe1c 100644 --- a/test/compilable/test20417.d +++ b/test/compilable/test20417.d @@ -1,9 +1,9 @@ // https://issues.dlang.org/show_bug.cgi?id=20417 -struct A { ~this(); } -void f(A, int); -A a(); -int i(); +struct A { ~this() @system; } +void f(A, int) @system; +A a() @system; +int i() @system; static assert(__traits(compiles, { f(a, i); })); static assert(__traits(compiles, f(a, i))); diff --git a/test/compilable/test20420.d b/test/compilable/test20420.d index 5d99e9c08528..e72fb7c63d9b 100644 --- a/test/compilable/test20420.d +++ b/test/compilable/test20420.d @@ -2,14 +2,14 @@ // https://issues.dlang.org/show_bug.cgi?id=20420 -struct S { ~this(); } +struct S { ~this() @system; } class C { this(S, int) {} } -int i(); +int i() @system; C create() { diff --git a/test/compilable/test3004.d b/test/compilable/test3004.d index baa0cd76a35c..a7a26cef7f06 100644 --- a/test/compilable/test3004.d +++ b/test/compilable/test3004.d @@ -11,7 +11,7 @@ function test3004.test --- */ -extern(C) int printf(char*, ...); +extern(C) int printf(char*, ...) @system; pragma(GNU_attribute, flatten) void test() { printf("Hello GNU world!\n".dup.ptr); } diff --git a/test/compilable/testcontracts.d b/test/compilable/testcontracts.d index 6a361903f594..fb96eadfdb2b 100644 --- a/test/compilable/testcontracts.d +++ b/test/compilable/testcontracts.d @@ -159,7 +159,7 @@ class Z17502 final class Foo17893(T) { - extern(C) void maythrow(); + extern(C) void maythrow() @system; void bar() in diff --git a/test/compilable/testfptr.d b/test/compilable/testfptr.d index e6a0dd670df2..4432e102ebde 100644 --- a/test/compilable/testfptr.d +++ b/test/compilable/testfptr.d @@ -1,11 +1,11 @@ // PERMUTE_ARGS: -ref int frvv(); +ref int frvv() @system; class A {} class B : A {} B restrictedfunc(in const(int)) @safe pure nothrow; -A relaxedfunc(in int); +A relaxedfunc(in int) @system; void bug3797() { diff --git a/test/compilable/testfwdref.d b/test/compilable/testfwdref.d index 3107ca6d84ff..ff127c9384fd 100644 --- a/test/compilable/testfwdref.d +++ b/test/compilable/testfwdref.d @@ -122,7 +122,7 @@ S10015!int s10015; /***************************************************/ // https://issues.dlang.org/show_bug.cgi?id=10101 -int front10101(int); +int front10101(int) @system; mixin template reflectRange10101() { @@ -303,8 +303,8 @@ class C12983(T) : B12983!float alias MyB12983 = B12983!float; -void f12983(); -void f12983(I12983); +void f12983() @system; +void f12983(I12983) @system; /***************************************************/ // https://issues.dlang.org/show_bug.cgi?id=12984 @@ -635,7 +635,7 @@ struct Array15726y(T) { struct Payload { - ~this(); + ~this() @system; } alias Data = RefCounted15726y!(Payload); diff --git a/test/compilable/traits.d b/test/compilable/traits.d index be55f9e7fdda..a254dc7c962c 100644 --- a/test/compilable/traits.d +++ b/test/compilable/traits.d @@ -70,8 +70,8 @@ else static assert(__traits(getLocation, MyStruct)[1] == 40); static assert(__traits(getLocation, MyStruct)[2] == 1); -int foo(); -int foo(int); +int foo() @system; +int foo(int) @system; static assert(__traits(getLocation, __traits(getOverloads, traits, "foo")[1])[1] == 74); diff --git a/test/compilable/vgc1.d b/test/compilable/vgc1.d index 8a11657ac3d6..3fe376363309 100644 --- a/test/compilable/vgc1.d +++ b/test/compilable/vgc1.d @@ -4,8 +4,8 @@ /***************** NewExp *******************/ struct S1 { } -struct S2 { this(int); } -struct S3 { this(int) @nogc; } +struct S2 { this(int) @system; } +struct S3 { this(int) @nogc @system; } /* TEST_OUTPUT: diff --git a/test/compilable/vgc2.d b/test/compilable/vgc2.d index c8959140da0a..65b04e46c066 100644 --- a/test/compilable/vgc2.d +++ b/test/compilable/vgc2.d @@ -53,7 +53,7 @@ void testCatAssign(int[] a, string s) /***************** ArrayLiteralExp *******************/ -int* barA(); +int* barA() @system; /* TEST_OUTPUT: diff --git a/test/compilable/vgc3.d b/test/compilable/vgc3.d index efdc5cd5eb3d..73f3ef14a8ad 100644 --- a/test/compilable/vgc3.d +++ b/test/compilable/vgc3.d @@ -20,7 +20,7 @@ void testArrayLength(int[] a) /***************** CallExp *******************/ -void barCall(); +void barCall() @system; /* TEST_OUTPUT: diff --git a/test/fail_compilation/bug15613.d b/test/fail_compilation/bug15613.d index 5b16f72ca232..7aaa41717ac6 100644 --- a/test/fail_compilation/bug15613.d +++ b/test/fail_compilation/bug15613.d @@ -8,8 +8,8 @@ fail_compilation/bug15613.d(17): cannot pass argument `8` of type `int` t --- */ -void f(int...); -void g(Object, ...); +void f(int...) @system; +void g(Object, ...) @system; void main() { @@ -25,7 +25,7 @@ fail_compilation/bug15613.d(32): cannot pass argument `& h` of type `void --- */ -void h(int[]...); +void h(int[]...) @system; void test() { diff --git a/test/fail_compilation/bug16165.d b/test/fail_compilation/bug16165.d index 1818e0d68f6c..ccbb5561da08 100644 --- a/test/fail_compilation/bug16165.d +++ b/test/fail_compilation/bug16165.d @@ -1,4 +1,4 @@ -void f(int x, Object y); +void f(int x, Object y) @system; void g() { @@ -7,7 +7,7 @@ void g() f(5, 6, 404); } -/* +/* TEST_OUTPUT: --- fail_compilation/bug16165.d(6): Error: function `bug16165.f(int x, Object y)` is not callable using argument types `(Object, Object, int)` diff --git a/test/fail_compilation/bug19569.d b/test/fail_compilation/bug19569.d index a314142a53d1..8b1f3d20c28f 100644 --- a/test/fail_compilation/bug19569.d +++ b/test/fail_compilation/bug19569.d @@ -53,11 +53,11 @@ fail_compilation/bug19569.d(66): `bug19569.test3!().test3()` */ -void test0(); -void test0() nothrow; +void test0() @system; +void test0() nothrow @system; -void test1(); -void test1() @nogc; +void test1() @system; +void test1() @nogc @system; void test2()(); void test2()() nothrow; diff --git a/test/fail_compilation/bug9631.d b/test/fail_compilation/bug9631.d index c7ac4e87596b..8806999eb7d8 100644 --- a/test/fail_compilation/bug9631.d +++ b/test/fail_compilation/bug9631.d @@ -75,7 +75,7 @@ void arg() S x; tem!().S y; - void f(int i, S s); + void f(int i, S s) @system; f(4, y); (tem!().S s){}(x); diff --git a/test/fail_compilation/cpp_abi_tag.d b/test/fail_compilation/cpp_abi_tag.d index e8247f971c09..86f7270b1a44 100644 --- a/test/fail_compilation/cpp_abi_tag.d +++ b/test/fail_compilation/cpp_abi_tag.d @@ -39,19 +39,19 @@ extern(C++) struct H {} // Note: There is no way to distinguish between // `extern(C++, "ns") { ... }` and `extern(C++, "ns") ...;` // So ABI tags have to be on the inside -extern(C++, "ns") @gnuAbiTag("x") void func1(); -extern(C++, ns2) @gnuAbiTag("x") void func2(); +extern(C++, "ns") @gnuAbiTag("x") void func1() @system; +extern(C++, ns2) @gnuAbiTag("x") void func2() @system; @gnuAbiTag("x") -extern(C++, "ns3") +extern(C++, "ns3") @system { void func3(); } @gnuAbiTag("x") -extern(C++, ns4) +extern(C++, ns4) @system { void func4(); } @gnuAbiTag("x") @gnuAbiTag("a") -extern(C++) void func5(); +extern(C++) void func5() @system; diff --git a/test/fail_compilation/cppeh2.d b/test/fail_compilation/cppeh2.d index 1d3ddc67e7f9..f080c35f9754 100644 --- a/test/fail_compilation/cppeh2.d +++ b/test/fail_compilation/cppeh2.d @@ -13,8 +13,8 @@ extern (C++, std) class exception { } } -void bar(); -void abc(); +void bar() @system; +void abc() @system; void foo() { diff --git a/test/fail_compilation/dep_extern_safety.d b/test/fail_compilation/dep_extern_safety.d new file mode 100644 index 000000000000..9a3ef7776f44 --- /dev/null +++ b/test/fail_compilation/dep_extern_safety.d @@ -0,0 +1,11 @@ +/* +REQUIRED_ARGS: -de +TEST_OUTPUT: +--- +fail_compilation/dep_extern_safety.d(10): Deprecation: `extern` function `dep_extern_safety.cfun` should be marked explicitly as `@safe`, `@system`, or `@trusted` +fail_compilation/dep_extern_safety.d(11): Deprecation: `extern` function `dep_extern_safety.dfun` should be marked explicitly as `@safe`, `@system`, or `@trusted` +--- +*/ + +extern extern(C) void cfun(); +extern extern(D) void dfun(); diff --git a/test/fail_compilation/diag3013.d b/test/fail_compilation/diag3013.d index 41c98b0c5198..74e8bf6d0c14 100644 --- a/test/fail_compilation/diag3013.d +++ b/test/fail_compilation/diag3013.d @@ -5,7 +5,7 @@ fail_compilation/diag3013.d(11): Error: cannot pass type `string` as a function --- */ -int format(string, string, string); +int format(string, string, string) @system; void main() { int s = string.format("abc", "def"); diff --git a/test/fail_compilation/diag4528.d b/test/fail_compilation/diag4528.d index ab7b2cf0fc74..0d6e58179126 100644 --- a/test/fail_compilation/diag4528.d +++ b/test/fail_compilation/diag4528.d @@ -11,9 +11,9 @@ fail_compilation/diag4528.d(18): Error: function `diag4528.Foo.pbsa` `static` fu class Foo { - private abstract void pva(); - package abstract void pka(); - private static abstract void pvsa(); - package static abstract void pksa(); - public static abstract void pbsa(); + private abstract void pva() @system; + package abstract void pka() @system; + private static abstract void pvsa() @system; + package static abstract void pksa() @system; + public static abstract void pbsa() @system; } diff --git a/test/fail_compilation/diag8101.d b/test/fail_compilation/diag8101.d index c795748ef6d5..b1e28a459d19 100644 --- a/test/fail_compilation/diag8101.d +++ b/test/fail_compilation/diag8101.d @@ -28,17 +28,17 @@ fail_compilation/diag8101.d(63): ... (1 more, -v to show) ... --- */ -void f_0(int); +void f_0(int) @system; -void f_1(int); -void f_1(int, int); +void f_1(int) @system; +void f_1(int, int) @system; -void f_2(int); -void f_2(int, int); -void f_2(int, int, int); -void f_2(int, int, int, int); -void f_2(int, int, int, int, int); -void f_2(int, int, int, int, int, int); +void f_2(int) @system; +void f_2(int, int) @system; +void f_2(int, int, int) @system; +void f_2(int, int, int, int) @system; +void f_2(int, int, int, int, int) @system; +void f_2(int, int, int, int, int, int) @system; void t_0(T1)(); diff --git a/test/fail_compilation/diag9247.d b/test/fail_compilation/diag9247.d index 1519b10f827b..de7e20c3c52a 100644 --- a/test/fail_compilation/diag9247.d +++ b/test/fail_compilation/diag9247.d @@ -8,5 +8,5 @@ fail_compilation/diag9247.d(12): Error: functions cannot return opaque type `S` struct S; -S foo(); +S foo() @system; S function() bar; diff --git a/test/fail_compilation/fail11532.d b/test/fail_compilation/fail11532.d index 144dec76b00f..46fc6721ca78 100644 --- a/test/fail_compilation/fail11532.d +++ b/test/fail_compilation/fail11532.d @@ -8,8 +8,8 @@ fail_compilation/fail11532.d(20): Error: cannot pass dynamic arrays to `extern(C --- */ -extern(C) void cvararg(int, ...); -extern(C++) void cppvararg(int, ...); +extern(C) void cvararg(int, ...) @system; +extern(C++) void cppvararg(int, ...) @system; void main() { diff --git a/test/fail_compilation/fail12436.d b/test/fail_compilation/fail12436.d index 5bdf0d5a891b..45ccc850acee 100644 --- a/test/fail_compilation/fail12436.d +++ b/test/fail_compilation/fail12436.d @@ -15,8 +15,8 @@ fail_compilation/fail12436.d(18): Error: functions cannot return a function fail_compilation/fail12436.d(19): Error: functions cannot return a tuple --- */ -FuncType test1(); -TupleType test2(); +FuncType test1() @system; +TupleType test2() @system; /* TEST_OUTPUT: @@ -25,14 +25,14 @@ fail_compilation/fail12436.d(28): Error: functions cannot return opaque type `Op fail_compilation/fail12436.d(29): Error: functions cannot return opaque type `Opaque[1]` by value --- */ -Opaque ret12436a(); // error -Opaque[1] ret12436b(); // error -Opaque* ret12436c(); // no error -Opaque[] ret12436d(); // no error -Opaque[]* ret12436e(); // no error +Opaque ret12436a() @system; // error +Opaque[1] ret12436b() @system; // error +Opaque* ret12436c() @system; // no error +Opaque[] ret12436d() @system; // no error +Opaque[]* ret12436e() @system; // no error -ref Opaque ret12436f(); // no error -ref Opaque[1] ret12436g(); // no error +ref Opaque ret12436f() @system; // no error +ref Opaque[1] ret12436g() @system; // no error /******************************************/ // parameter type @@ -54,14 +54,14 @@ fail_compilation/fail12436.d(56): Error: cannot have parameter of opaque type `O */ void param12436a(Opaque); // error void param12436b(Opaque[1]); // error -void param12436c(Opaque*); // no error -void param12436d(Opaque[]); // no error -void param12436e(Opaque[]*); // no error +void param12436c(Opaque*) @system; // no error +void param12436d(Opaque[]) @system; // no error +void param12436e(Opaque[]*) @system; // no error -void param12436f(ref Opaque); // no error -void param12436g(ref Opaque[1]); // no error -void param12436h(out Opaque); // no error -void param12436i(out Opaque[1]); // no error +void param12436f(ref Opaque) @system; // no error +void param12436g(ref Opaque[1]) @system; // no error +void param12436h(out Opaque) @system; // no error +void param12436i(out Opaque[1]) @system; // no error /* TEST_OUTPUT: diff --git a/test/fail_compilation/fail12622.d b/test/fail_compilation/fail12622.d index 1a8b18511c18..35f25af1a14a 100644 --- a/test/fail_compilation/fail12622.d +++ b/test/fail_compilation/fail12622.d @@ -17,7 +17,7 @@ fail_compilation/fail12622.d(30): Error: `@nogc` function `fail12622.foo` cannot -void bar(); +void bar() @system; pure nothrow @nogc @safe void foo() { diff --git a/test/fail_compilation/fail12901.d b/test/fail_compilation/fail12901.d index 31c90c1df61d..e55140bf44b0 100644 --- a/test/fail_compilation/fail12901.d +++ b/test/fail_compilation/fail12901.d @@ -8,7 +8,7 @@ fail_compilation/fail12901.d(11): Error: constructor `fail12901.S.this` `in` and struct S { int a; - this(int n) + this(int n) @system in { a = n; } // no body } diff --git a/test/fail_compilation/fail154.d b/test/fail_compilation/fail154.d index ee9eb42c3a1a..ba47b1971cfa 100644 --- a/test/fail_compilation/fail154.d +++ b/test/fail_compilation/fail154.d @@ -12,7 +12,7 @@ class X(T:Policy!(T), alias Policy) template MYP(T) { - void foo(T); + void foo(T) @system; } X!(MYP!(int)) x; diff --git a/test/fail_compilation/fail15626.d b/test/fail_compilation/fail15626.d index 8ef14cd5aae6..e24b49f74373 100644 --- a/test/fail_compilation/fail15626.d +++ b/test/fail_compilation/fail15626.d @@ -5,7 +5,7 @@ fail_compilation/fail15626.d(12): Error: class `fail15626.D` C++ base class `C` --- */ -extern (C++) +extern (C++) @system { class C { } interface I { void f(); } diff --git a/test/fail_compilation/fail18719.d b/test/fail_compilation/fail18719.d index bbc4ce944644..3254abf92a51 100644 --- a/test/fail_compilation/fail18719.d +++ b/test/fail_compilation/fail18719.d @@ -18,7 +18,7 @@ struct S import core.stdc.stdio; printf("Ctor called with %d\n", y); } - void opAssign(int) immutable; + void opAssign(int) immutable @system; } class C diff --git a/test/fail_compilation/fail20000.d b/test/fail_compilation/fail20000.d index fe481216be65..6b6e8d103ef7 100644 --- a/test/fail_compilation/fail20000.d +++ b/test/fail_compilation/fail20000.d @@ -17,8 +17,8 @@ fail_compilation/fail20000.d(39): Error: cast from `fail20000.CppInterface` to ` */ extern(C++) class CppClass { int a; } extern(C++) class CppClass2 { void* a; } -extern(C++) interface CppInterface { int b(); } -extern(C++) interface CppInterface2 { void* b(); } +extern(C++) @system interface CppInterface { int b(); } +extern(C++) @system interface CppInterface2 { void* b(); } class DClass { int c; } interface DInterface { int d(); } diff --git a/test/fail_compilation/fail20376.d b/test/fail_compilation/fail20376.d index 8410af535e2f..95c1d2c8f89d 100644 --- a/test/fail_compilation/fail20376.d +++ b/test/fail_compilation/fail20376.d @@ -9,7 +9,7 @@ fail_compilation/fail20376.d(17): Error: cannot implicitly convert expression `F struct Foo { - this(ref scope Foo); + this(ref scope Foo) @system; } ubyte fun() diff --git a/test/fail_compilation/fail20771.d b/test/fail_compilation/fail20771.d index 18e1c87980da..28d94c2cc0fd 100644 --- a/test/fail_compilation/fail20771.d +++ b/test/fail_compilation/fail20771.d @@ -5,7 +5,7 @@ fail_compilation/fail20771.d(19): Error: cannot pass types with postblits or cop fail_compilation/fail20771.d(20): Error: cannot pass types with postblits or copy constructors as variadic arguments --- */ -extern void variadic(...); +@system extern void variadic(...); struct S20771 { diff --git a/test/fail_compilation/fail20772.d b/test/fail_compilation/fail20772.d index a2fdac687987..632561810876 100644 --- a/test/fail_compilation/fail20772.d +++ b/test/fail_compilation/fail20772.d @@ -5,7 +5,7 @@ fail_compilation/fail20772.d(20): Error: cannot pass types with postblits or cop fail_compilation/fail20772.d(21): Error: cannot pass types with postblits or copy constructors as variadic arguments --- */ -extern void variadic(...); +@system extern void variadic(...); struct S20772 { diff --git a/test/fail_compilation/fail20775.d b/test/fail_compilation/fail20775.d index 3e050960a186..f3ab7467ecd7 100644 --- a/test/fail_compilation/fail20775.d +++ b/test/fail_compilation/fail20775.d @@ -5,7 +5,7 @@ fail_compilation/fail20775.d(19): Error: cannot pass types that need destruction fail_compilation/fail20775.d(20): Error: cannot pass types that need destruction as variadic arguments --- */ -extern void variadic(...); +@system extern void variadic(...); struct S20775 { diff --git a/test/fail_compilation/fail20800.d b/test/fail_compilation/fail20800.d index 1184b8e6ee87..0fa9e0d85def 100644 --- a/test/fail_compilation/fail20800.d +++ b/test/fail_compilation/fail20800.d @@ -15,7 +15,7 @@ struct RegexMatch } static m() { return RegexMatch(); } -void fun(int a); +void fun(int a) @system; void initCommands() { diff --git a/test/fail_compilation/fail328.d b/test/fail_compilation/fail328.d index 12347e579097..ca03fdbc985d 100644 --- a/test/fail_compilation/fail328.d +++ b/test/fail_compilation/fail328.d @@ -6,7 +6,7 @@ fail_compilation/fail328.d(9): `fail328.bar` is declared here --- */ -void bar(); +void bar() @system; @safe void foo() { diff --git a/test/fail_compilation/fail332.d b/test/fail_compilation/fail332.d index 12164b92e9ab..e1ce7e0be9df 100644 --- a/test/fail_compilation/fail332.d +++ b/test/fail_compilation/fail332.d @@ -21,7 +21,7 @@ void test() { foo(); foo(null); - + baz(""); baz(3, null); } @@ -43,7 +43,7 @@ fail_compilation/fail332.d(55): Error: function `fail332.bar(Object, int[2]...)` fail_compilation/fail332.d(55): expected 2 variadic argument(s), not 3 --- */ -void bar(Object, int[2]...); +void bar(Object, int[2]...) @system; void test2() { diff --git a/test/fail_compilation/fail335.d b/test/fail_compilation/fail335.d index 1800cd065b76..4d774b2b51ee 100644 --- a/test/fail_compilation/fail335.d +++ b/test/fail_compilation/fail335.d @@ -5,8 +5,8 @@ fail_compilation/fail335.d(9): Error: cannot overload both property and non-prop --- */ -void foo(); -@property void foo(int); +void foo() @system; +@property void foo(int) @system; void main() { diff --git a/test/fail_compilation/fail4421.d b/test/fail_compilation/fail4421.d index 3aedfc31f3ea..548f17ab2804 100644 --- a/test/fail_compilation/fail4421.d +++ b/test/fail_compilation/fail4421.d @@ -13,15 +13,15 @@ fail_compilation/fail4421.d(18): Error: function `fail4421.U1.__invariant1` dest union U1 { - this(this); - ~this(); + this(this) @system; + ~this() @system; invariant() { } } struct S1 { - this(this); - ~this(); + this(this) @system; + ~this() @system; invariant() { } } diff --git a/test/fail_compilation/fail_arrayexp.d b/test/fail_compilation/fail_arrayexp.d index 1a766ff80dd4..106795e43c22 100644 --- a/test/fail_compilation/fail_arrayexp.d +++ b/test/fail_compilation/fail_arrayexp.d @@ -14,7 +14,7 @@ int i; string str; union U {} alias typeAlias = const(int)[]; -void getVoid(); +void getVoid() @system; alias getTuple(T...) = T; void test19534() // https://issues.dlang.org/show_bug.cgi?id=19534 diff --git a/test/fail_compilation/fail_scope.d b/test/fail_compilation/fail_scope.d index 9be9ccbceaad..f83376a1561f 100644 --- a/test/fail_compilation/fail_scope.d +++ b/test/fail_compilation/fail_scope.d @@ -65,8 +65,8 @@ ref int test() /************/ -ref int foo8(ref int x); -ref int foo8(return ref int x); +ref int foo8(ref int x) @system; +ref int foo8(return ref int x) @system; void testover() { diff --git a/test/fail_compilation/fob2.d b/test/fail_compilation/fob2.d index ac1ee29a5e06..b271fb347d2f 100644 --- a/test/fail_compilation/fob2.d +++ b/test/fail_compilation/fob2.d @@ -2,8 +2,8 @@ REQUIRED_ARGS: -preview=dip1021 */ -int* malloc(); -void free(int*); +int* malloc() @system; +void free(int*) @system; /* TEST_OUTPUT: --- @@ -40,7 +40,7 @@ fail_compilation/fob2.d(202): Error: variable `fob2.zoo2.p` is left dangling at foo2(p, p + 1); } -@live void foo2( scope int* p, scope int* q ); +@live void foo2( scope int* p, scope int* q ) @system; /* TEST_OUTPUT: --- @@ -67,7 +67,7 @@ fail_compilation/fob2.d(432): Error: variable `fob2.test43.p` is not Owner, cann #line 400 -bool f(); +bool f() @system; @live void test41(int* p, int i) { diff --git a/test/fail_compilation/format.d b/test/fail_compilation/format.d index deab01904744..4cd34d7fff13 100644 --- a/test/fail_compilation/format.d +++ b/test/fail_compilation/format.d @@ -10,14 +10,14 @@ fail_compilation/format.d(104): Error: function `format.printf4` `pragma(printf) #line 100 -pragma(printf) void printf1(const(char)*, ...); -pragma(printf) extern (C) int printf2(const(int )*, ...); -pragma(printf) extern (C) int printf3(const(char)*); -pragma(printf) extern (C) int printf4(const(char)*, int, ...); +pragma(printf) void printf1(const(char)*, ...) @system; +pragma(printf) extern (C) int printf2(const(int )*, ...) @system; +pragma(printf) extern (C) int printf3(const(char)*) @system; +pragma(printf) extern (C) int printf4(const(char)*, int, ...) @system; -pragma(printf) extern (C) int printf5(const(char)*, ...); -pragma(printf) extern (C) int printf6(immutable(char)*, ...); -pragma(printf) extern (C) int printf7(char*, ...); +pragma(printf) extern (C) int printf5(const(char)*, ...) @system; +pragma(printf) extern (C) int printf6(immutable(char)*, ...) @system; +pragma(printf) extern (C) int printf7(char*, ...) @system; /* TEST_OUTPUT: @@ -33,12 +33,12 @@ fail_compilation/format.d(206): Error: function `format.vprintf4` `pragma(printf import core.stdc.stdarg; -pragma(printf) void vprintf1(const(char)*, va_list); -pragma(printf) extern (C) int vprintf2(const(int )*, va_list); -pragma(printf) extern (C) int vprintf3(const(char)*); -pragma(printf) extern (C) int vprintf4(const(char)*, int, va_list); +pragma(printf) void vprintf1(const(char)*, va_list) @system; +pragma(printf) extern (C) int vprintf2(const(int )*, va_list) @system; +pragma(printf) extern (C) int vprintf3(const(char)*) @system; +pragma(printf) extern (C) int vprintf4(const(char)*, int, va_list) @system; -pragma(printf) extern (C) int vprintf5(const(char)*, va_list); -pragma(printf) extern (C) int vprintf6(immutable(char)*, va_list); -pragma(printf) extern (C) int vprintf7(char*, va_list); +pragma(printf) extern (C) int vprintf5(const(char)*, va_list) @system; +pragma(printf) extern (C) int vprintf6(immutable(char)*, va_list) @system; +pragma(printf) extern (C) int vprintf7(char*, va_list) @system; diff --git a/test/fail_compilation/goto1.d b/test/fail_compilation/goto1.d index b35a1c3a0dc9..b18bf163a03f 100644 --- a/test/fail_compilation/goto1.d +++ b/test/fail_compilation/goto1.d @@ -6,8 +6,8 @@ fail_compilation/goto1.d(1010): Error: `return` statements cannot be in `finally --- */ -void foo(); -void bar(); +void foo() @system; +void bar() @system; #line 1000 diff --git a/test/fail_compilation/goto2.d b/test/fail_compilation/goto2.d index 410715c7380e..32b7f4226141 100644 --- a/test/fail_compilation/goto2.d +++ b/test/fail_compilation/goto2.d @@ -8,8 +8,8 @@ fail_compilation/goto2.d(1003): Error: cannot `goto` into `try` block */ -void foo(); -void bar(); +void foo() @system; +void bar() @system; #line 1000 diff --git a/test/fail_compilation/goto3.d b/test/fail_compilation/goto3.d index 4b811fa898a8..309ab95f6f56 100644 --- a/test/fail_compilation/goto3.d +++ b/test/fail_compilation/goto3.d @@ -7,8 +7,8 @@ fail_compilation/goto3.d(1012): Error: default cannot be in different `try` bloc */ -void foo(); -void bar(); +void foo() @system; +void bar() @system; #line 1000 diff --git a/test/fail_compilation/ice13788.d b/test/fail_compilation/ice13788.d index 99f3c4a6c35e..68bb2376ccf5 100644 --- a/test/fail_compilation/ice13788.d +++ b/test/fail_compilation/ice13788.d @@ -8,7 +8,7 @@ fail_compilation/ice13788.d(14): Error: pragma `mangle` mangled name characters --- */ -pragma(mangle) void f1(); -pragma(mangle, 1) void f2(); -pragma(mangle, "") void f3(); -pragma(mangle, "a"w) void f4(); +pragma(mangle) void f1() @system; +pragma(mangle, 1) void f2() @system; +pragma(mangle, "") void f3() @system; +pragma(mangle, "a"w) void f4() @system; diff --git a/test/fail_compilation/imports/fail347a.d b/test/fail_compilation/imports/fail347a.d index 2c2b1f6d6b1b..54bad9d84103 100644 --- a/test/fail_compilation/imports/fail347a.d +++ b/test/fail_compilation/imports/fail347a.d @@ -1,3 +1,3 @@ module imports.fail347a; -pure size_t strlen(in char* s); +pure size_t strlen(in char* s) @system; diff --git a/test/fail_compilation/nogc1.d b/test/fail_compilation/nogc1.d index 9519a3d7dc89..5aad75f97986 100644 --- a/test/fail_compilation/nogc1.d +++ b/test/fail_compilation/nogc1.d @@ -4,8 +4,8 @@ /***************** NewExp *******************/ struct S1 { } -struct S2 { this(int); } -struct S3 { this(int) @nogc; } +struct S2 { this(int) @system; } +struct S3 { this(int) @nogc @system; } /* TEST_OUTPUT: diff --git a/test/fail_compilation/nogc2.d b/test/fail_compilation/nogc2.d index d7b7d91d41d7..b6ebe2403371 100644 --- a/test/fail_compilation/nogc2.d +++ b/test/fail_compilation/nogc2.d @@ -53,7 +53,7 @@ fail_compilation/nogc2.d(51): Error: cannot use operator `~=` in `@nogc` functio /***************** ArrayLiteralExp *******************/ -@nogc int* barA(); +@system @nogc int* barA(); /* TEST_OUTPUT: diff --git a/test/fail_compilation/nogc3.d b/test/fail_compilation/nogc3.d index ea486d5ac0ae..29394922fd8f 100644 --- a/test/fail_compilation/nogc3.d +++ b/test/fail_compilation/nogc3.d @@ -20,7 +20,7 @@ fail_compilation/nogc3.d(18): Error: setting `length` in `@nogc` function `nogc3 /***************** CallExp *******************/ -void barCall(); +void barCall() @system; /* TEST_OUTPUT: diff --git a/test/fail_compilation/nosharedaccess.d b/test/fail_compilation/nosharedaccess.d index 6ab2c7dc43d6..fc2dd63cb17b 100644 --- a/test/fail_compilation/nosharedaccess.d +++ b/test/fail_compilation/nosharedaccess.d @@ -32,8 +32,8 @@ int test1(shared int j, shared(int)* p, shared(int)[] a, ref S s, ref shared S t /**************************************/ -void byref(ref shared int); -void byptr(shared(int)*); +void byref(ref shared int) @system; +void byptr(shared(int)*) @system; shared int x; @@ -56,7 +56,7 @@ fail_compilation/nosharedaccess.d(2010): Error: direct access to shared `k` is n #line 2000 -void func(int); +void func(int) @system; shared int i; diff --git a/test/fail_compilation/retscope.d b/test/fail_compilation/retscope.d index f3fad36671de..7239caa6e4df 100644 --- a/test/fail_compilation/retscope.d +++ b/test/fail_compilation/retscope.d @@ -135,7 +135,7 @@ char[] bar9() @safe struct S10 { - static int opApply(int delegate(S10*) dg); + static int opApply(int delegate(S10*) dg) @system; } S10* test10() @@ -513,10 +513,10 @@ fail_compilation/retscope.d(1716): Error: cannot implicitly convert expression ` --- */ -int* func(int* p); -int* funcs(scope int* p); -int* funcr(return int* p); -int* funcrs(return scope int* p); +int* func(int* p) @system; +int* funcs(scope int* p) @system; +int* funcr(return int* p) @system; +int* funcrs(return scope int* p) @system; void foo17() { diff --git a/test/fail_compilation/retscope4.d b/test/fail_compilation/retscope4.d index 138538ddaa79..f33094997463 100644 --- a/test/fail_compilation/retscope4.d +++ b/test/fail_compilation/retscope4.d @@ -14,7 +14,7 @@ fail_compilation/retscope4.d(3007): Deprecation: slice of static array temporary // https://issues.dlang.org/show_bug.cgi?id=12625 -int[16] func(); +int[16] func() @system; void foo() { diff --git a/test/fail_compilation/test12822.d b/test/fail_compilation/test12822.d index 510d9e2a9f15..77d7daa5a4fb 100644 --- a/test/fail_compilation/test12822.d +++ b/test/fail_compilation/test12822.d @@ -14,4 +14,4 @@ void test2(int delegate() dg) @safe dg.funcptr = &func; } -int func(); +int func() @system; diff --git a/test/fail_compilation/test16095.d b/test/fail_compilation/test16095.d index 0c9cfc3f5222..9aea2d18320c 100644 --- a/test/fail_compilation/test16095.d +++ b/test/fail_compilation/test16095.d @@ -22,7 +22,7 @@ void test1(C a) struct S { - void ping() shared; + void ping() shared @system; } void test2(S* a) diff --git a/test/fail_compilation/test16193.d b/test/fail_compilation/test16193.d index 13ce01cde0a0..6ead7470ad11 100644 --- a/test/fail_compilation/test16193.d +++ b/test/fail_compilation/test16193.d @@ -14,7 +14,7 @@ fail_compilation/test16193.d(41): test16193.abc.__foreachbody1 closes ove // https://issues.dlang.org/show_bug.cgi?id=16193 struct S { - int opApply(int delegate(int) dg) @nogc; + int opApply(int delegate(int) dg) @nogc @system; } void foo() { @@ -25,7 +25,7 @@ void foo() { } struct T { - int opApply(scope int delegate(int) dg) @nogc; + int opApply(scope int delegate(int) dg) @nogc @system; } diff --git a/test/fail_compilation/test16381.d b/test/fail_compilation/test16381.d index e284e2a9754f..e0faa1d3a841 100644 --- a/test/fail_compilation/test16381.d +++ b/test/fail_compilation/test16381.d @@ -9,7 +9,7 @@ fail_compilation/test16381.d(16): Error: `foo()` is not an lvalue and cannot be // https://issues.dlang.org/show_bug.cgi?id=16381 -__vector(float[4]) foo(); +__vector(float[4]) foo() @system; void bar() { diff --git a/test/fail_compilation/test16694.d b/test/fail_compilation/test16694.d index 1b15aa435fb5..4a4896de26ab 100644 --- a/test/fail_compilation/test16694.d +++ b/test/fail_compilation/test16694.d @@ -4,5 +4,5 @@ TEST_OUTPUT: fail_compilation/test16694.d(8): Error: cannot take address of imported symbol `bar` at compile time --- */ -export void bar(); +export void bar() @system; auto barptr = &bar; diff --git a/test/fail_compilation/test17425.d b/test/fail_compilation/test17425.d index f7628b83e22b..1133d20a7725 100644 --- a/test/fail_compilation/test17425.d +++ b/test/fail_compilation/test17425.d @@ -9,7 +9,7 @@ fail_compilation/test17425.d(31): Error: expected 2 arguments for `getParameterS // https://issues.dlang.org/show_bug.cgi?id=17425 -ref int foo(return ref const int* p, scope int* a, out int b, lazy int c); +ref int foo(return ref const int* p, scope int* a, out int b, lazy int c) @system; //pragma(msg, __traits(getParameterStorageClasses, foo, 0)); diff --git a/test/fail_compilation/test18484.d b/test/fail_compilation/test18484.d index 678609b770d9..241da34cd5b4 100644 --- a/test/fail_compilation/test18484.d +++ b/test/fail_compilation/test18484.d @@ -10,7 +10,7 @@ fail_compilation/test18484.d(24): Error: escaping reference to stack allocated v struct S { - int* bar() return; + int* bar() return @system; int i; } diff --git a/test/fail_compilation/test18708.d b/test/fail_compilation/test18708.d index 5c6f16282c29..f7049209c8ae 100644 --- a/test/fail_compilation/test18708.d +++ b/test/fail_compilation/test18708.d @@ -40,8 +40,8 @@ class C } } -int bar(S s); -int foo(); +int bar(S s) @system; +int foo() @system; /***********************************/ diff --git a/test/fail_compilation/test8556.d b/test/fail_compilation/test8556.d index 75c5c593eead..a5b25cfd887c 100644 --- a/test/fail_compilation/test8556.d +++ b/test/fail_compilation/test8556.d @@ -9,7 +9,7 @@ fail_compilation/test8556.d(55): Error: template instance `test8556.grab!(Circle --- */ -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; template isSliceable(R) { diff --git a/test/fail_compilation/typeerrors.d b/test/fail_compilation/typeerrors.d index e3a6729d38fa..eb3786d05488 100644 --- a/test/fail_compilation/typeerrors.d +++ b/test/fail_compilation/typeerrors.d @@ -27,7 +27,7 @@ fail_compilation/typeerrors.d(57): Error: slice `[2..1]` is out of range of [0.. template tuple(T...) { alias T tuple; } -void bar(); +void bar() @system; scope class C { } diff --git a/test/fail_compilation/vararg2.d b/test/fail_compilation/vararg2.d index eb235583efa5..9f05ec410464 100644 --- a/test/fail_compilation/vararg2.d +++ b/test/fail_compilation/vararg2.d @@ -9,8 +9,8 @@ fail_compilation/vararg2.d(111): cannot pass argument `1.0` of type `doub #line 100 -int* foo(int x, return const ...); -int* bar(int x, scope shared ...); +int* foo(int x, return const ...) @system; +int* bar(int x, scope shared ...) @system; void test1() { diff --git a/test/runnable/a18.d b/test/runnable/a18.d index f568982acee6..e52abd3787c9 100644 --- a/test/runnable/a18.d +++ b/test/runnable/a18.d @@ -10,7 +10,7 @@ Test enumerator import imports.a18a; -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; alias IContainer!(int) icontainer_t; diff --git a/test/runnable/a20.d b/test/runnable/a20.d index cedfb094d052..86d8cf67d406 100644 --- a/test/runnable/a20.d +++ b/test/runnable/a20.d @@ -6,7 +6,7 @@ import a20a; -extern(C) void dmd_coverDestPath(string path); +extern(C) void dmd_coverDestPath(string path) @system; void main(string[] args) { diff --git a/test/runnable/aliasthis.d b/test/runnable/aliasthis.d index cc12f55935d8..4e432be17d54 100644 --- a/test/runnable/aliasthis.d +++ b/test/runnable/aliasthis.d @@ -25,7 +25,7 @@ Success --- */ -extern (C) int printf(const(char*) fmt, ...); +extern (C) int printf(const(char*) fmt, ...) @system; import core.vararg; struct Tup(T...) @@ -169,7 +169,7 @@ struct S4617 alias forward.square sqr; // okay int field; - void mfunc(); + void mfunc() @system; template Templ(){} void tfunc()(){} } @@ -1363,7 +1363,7 @@ void test8735() assert(n == 1); // https://issues.dlang.org/show_bug.cgi?id=11502 - static void f(int i); + static void f(int i) @system; S8735!f sf; // https://issues.dlang.org/show_bug.cgi?id=9709 diff --git a/test/runnable/arrayop.d b/test/runnable/arrayop.d index 5158bacc8e88..c1d0d026bd4d 100644 --- a/test/runnable/arrayop.d +++ b/test/runnable/arrayop.d @@ -1,6 +1,6 @@ import std.math; -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; string abc; diff --git a/test/runnable/b20470.d b/test/runnable/b20470.d index 73d8d10ff04a..65af8465287b 100644 --- a/test/runnable/b20470.d +++ b/test/runnable/b20470.d @@ -78,8 +78,8 @@ void test2() static struct S { - void f(); - void g(); + void f() @system; + void g() @system; alias funcs = AliasSeq!(f, g); } diff --git a/test/runnable/bench1.d b/test/runnable/bench1.d index d19ba9a92626..53f8166ede4f 100644 --- a/test/runnable/bench1.d +++ b/test/runnable/bench1.d @@ -8,8 +8,8 @@ count = 10000 --- */ -extern(C) int printf(const char *, ...); -extern(C) int atoi(const char *); +extern(C) int printf(const char *, ...) @system; +extern(C) int atoi(const char *) @system; int main (string[] argv) { diff --git a/test/runnable/bug9010.d b/test/runnable/bug9010.d index ec9c2f8582b6..eca0da4dd738 100644 --- a/test/runnable/bug9010.d +++ b/test/runnable/bug9010.d @@ -12,7 +12,7 @@ struct A } -extern(C) void dmd_coverDestPath(string pathname); +extern(C) void dmd_coverDestPath(string pathname) @system; void main(string[] args) { diff --git a/test/runnable/casting.d b/test/runnable/casting.d index 50570e7dc801..86083f3b8ad2 100644 --- a/test/runnable/casting.d +++ b/test/runnable/casting.d @@ -4,7 +4,7 @@ RUN_OUTPUT: Success --- */ -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; template Seq(T...) { alias T Seq; } diff --git a/test/runnable/cov2.d b/test/runnable/cov2.d index dbac103f5d20..9fdbbb22b803 100644 --- a/test/runnable/cov2.d +++ b/test/runnable/cov2.d @@ -3,7 +3,7 @@ // REQUIRED_ARGS: -cov // EXECUTE_ARGS: ${RESULTS_DIR}/runnable -extern(C) void dmd_coverDestPath(string pathname); +extern(C) void dmd_coverDestPath(string pathname) @system; /***************************************************/ diff --git a/test/runnable/declaration.d b/test/runnable/declaration.d index 5be76fac6d74..c27ca5719d09 100644 --- a/test/runnable/declaration.d +++ b/test/runnable/declaration.d @@ -12,7 +12,7 @@ Success --- */ -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; /***************************************************/ // https://issues.dlang.org/show_bug.cgi?id=6475 diff --git a/test/runnable/eh.d b/test/runnable/eh.d index 5365db12c4fe..496e85ac7b5e 100644 --- a/test/runnable/eh.d +++ b/test/runnable/eh.d @@ -1,6 +1,6 @@ // PERMUTE_ARGS: -O -fPIC -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; /****************************************************/ diff --git a/test/runnable/eh2.d b/test/runnable/eh2.d index dc285a5dfab1..0189debdde42 100644 --- a/test/runnable/eh2.d +++ b/test/runnable/eh2.d @@ -1,6 +1,6 @@ // PERMUTE_ARGS: -fPIC -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; class Abc : Throwable { diff --git a/test/runnable/evalorder.d b/test/runnable/evalorder.d index 6805ee2e649d..1813b83f2cb6 100644 --- a/test/runnable/evalorder.d +++ b/test/runnable/evalorder.d @@ -4,7 +4,7 @@ RUN_OUTPUT: Success --- */ -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; void test14040() { diff --git a/test/runnable/extra-files/minimal/object.d b/test/runnable/extra-files/minimal/object.d index bc8b3729739e..76aa19561128 100644 --- a/test/runnable/extra-files/minimal/object.d +++ b/test/runnable/extra-files/minimal/object.d @@ -1,6 +1,6 @@ module object; -extern(C) void _Dmain(); +extern(C) void _Dmain() @system; extern(C) void main() { diff --git a/test/runnable/foreach5.d b/test/runnable/foreach5.d index 39071e372e6d..f63a5462c22f 100644 --- a/test/runnable/foreach5.d +++ b/test/runnable/foreach5.d @@ -12,7 +12,7 @@ test7406() --- */ -extern(C) int printf(const char* fmt, ...); +extern(C) int printf(const char* fmt, ...) @system; alias AliasSeq(X...) = X; diff --git a/test/runnable/funclit.d b/test/runnable/funclit.d index 5fc8a498ca70..dcde873a9b6e 100644 --- a/test/runnable/funclit.d +++ b/test/runnable/funclit.d @@ -16,7 +16,7 @@ Success */ import core.vararg; -extern (C) int printf(const char*, ...); +extern (C) int printf(const char*, ...) @system; /***************************************************/ // lambda syntax check diff --git a/test/runnable/functype.d b/test/runnable/functype.d index 28e2709ffc15..1884e52a30c1 100644 --- a/test/runnable/functype.d +++ b/test/runnable/functype.d @@ -1,4 +1,4 @@ -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; /***************************************************/ diff --git a/test/runnable/hello-profile.d b/test/runnable/hello-profile.d index 40867029f917..c7654ed57b1d 100644 --- a/test/runnable/hello-profile.d +++ b/test/runnable/hello-profile.d @@ -5,7 +5,7 @@ module hello; -extern(C) +extern(C) @system { int printf(const char*, ...); int trace_setlogfilename(string name); diff --git a/test/runnable/hello.d b/test/runnable/hello.d index b46f59dcd13a..e261cecffbfa 100644 --- a/test/runnable/hello.d +++ b/test/runnable/hello.d @@ -1,6 +1,6 @@ // PERMUTE_ARGS: -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; int main(char[][] args) { diff --git a/test/runnable/helloUTF16.d b/test/runnable/helloUTF16.d index 1e7556382eaf..7fd6bad9fae1 100644 Binary files a/test/runnable/helloUTF16.d and b/test/runnable/helloUTF16.d differ diff --git a/test/runnable/helloUTF16BE.d b/test/runnable/helloUTF16BE.d index fc86fb51950b..7fd6bad9fae1 100644 Binary files a/test/runnable/helloUTF16BE.d and b/test/runnable/helloUTF16BE.d differ diff --git a/test/runnable/helloUTF8.d b/test/runnable/helloUTF8.d index aed66134f097..f9a5c81c7fbb 100644 --- a/test/runnable/helloUTF8.d +++ b/test/runnable/helloUTF8.d @@ -6,7 +6,7 @@ hello world --- */ -extern(C) int printf(const char *, ...); +extern(C) int printf(const char *, ...) @system; int main(char[][] args) { diff --git a/test/runnable/ifti.d b/test/runnable/ifti.d index 88da217a9414..c6c06eca8d22 100644 --- a/test/runnable/ifti.d +++ b/test/runnable/ifti.d @@ -1,4 +1,4 @@ -extern (C) int printf(const scope char*, ...); +extern (C) int printf(const scope char*, ...) @system; struct S { int x = 3; diff --git a/test/runnable/imports/link13415a.d b/test/runnable/imports/link13415a.d index de3bbe2ac9bb..798d5adcf21a 100644 --- a/test/runnable/imports/link13415a.d +++ b/test/runnable/imports/link13415a.d @@ -7,7 +7,7 @@ struct S(alias func) } } -extern(C) int printf(in char*, ...); +extern(C) int printf(in char*, ...) @system; void f(int i = 77) { diff --git a/test/runnable/imports/mod2.d b/test/runnable/imports/mod2.d index 4933e0ac1c6e..ce793a842195 100644 --- a/test/runnable/imports/mod2.d +++ b/test/runnable/imports/mod2.d @@ -4,7 +4,7 @@ module imports.mod2; import mod1; -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; void greet() { diff --git a/test/runnable/imports/test13a.d b/test/runnable/imports/test13a.d index 4512e416dcf6..8fe37e7acefd 100644 --- a/test/runnable/imports/test13a.d +++ b/test/runnable/imports/test13a.d @@ -1,6 +1,6 @@ module imports.test13a; -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; public alias bool boolean; public alias int Order; diff --git a/test/runnable/imports/test3a.d b/test/runnable/imports/test3a.d index 7a00c58df68f..abcc590620c7 100644 --- a/test/runnable/imports/test3a.d +++ b/test/runnable/imports/test3a.d @@ -2,7 +2,7 @@ module imports.test3a; import imports.test3b; -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; class Afoo { diff --git a/test/runnable/imports/testmangle.d b/test/runnable/imports/testmangle.d index 5311a8360dae..b7bd8871c17e 100644 --- a/test/runnable/imports/testmangle.d +++ b/test/runnable/imports/testmangle.d @@ -8,7 +8,7 @@ public import core.demangle : demangle, demangleType; private { struct Detect; - Detect* detectMangle(Detect*); + Detect* detectMangle(Detect*) @system; void DetectTmpl(T)() {} } diff --git a/test/runnable/interface1.d b/test/runnable/interface1.d index 1168ba887783..05d7a1d26efc 100644 --- a/test/runnable/interface1.d +++ b/test/runnable/interface1.d @@ -1,5 +1,5 @@ -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; /*******************************************/ diff --git a/test/runnable/interface2.d b/test/runnable/interface2.d index 328f839896d2..4039dcf96517 100644 --- a/test/runnable/interface2.d +++ b/test/runnable/interface2.d @@ -7,7 +7,7 @@ runnable/interface2.d(98): Deprecation: The `delete` keyword has been deprecated --- */ -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; /*******************************************************/ @@ -1130,7 +1130,7 @@ void testTypeid() /*******************************************************/ -extern (C++) +extern (C++) @system { interface IA47 { diff --git a/test/runnable/interface3.d b/test/runnable/interface3.d index f0de22c95d03..19106b6c02f9 100644 --- a/test/runnable/interface3.d +++ b/test/runnable/interface3.d @@ -6,7 +6,7 @@ OK --- */ -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; interface IWriter { diff --git a/test/runnable/interpret2.d b/test/runnable/interpret2.d index 77bc25cd3a30..ecb09aef35ad 100644 --- a/test/runnable/interpret2.d +++ b/test/runnable/interpret2.d @@ -6,7 +6,7 @@ Success */ //import core.stdc.stdio; -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; template Tuple(A...) { diff --git a/test/runnable/link13350.d b/test/runnable/link13350.d index 2a2b40bb1e6e..ad456c51cd59 100644 --- a/test/runnable/link13350.d +++ b/test/runnable/link13350.d @@ -4,9 +4,9 @@ RUN_OUTPUT: Success --- */ -extern (C) int printf(const(char*) fmt, ...); +extern (C) int printf(const(char*) fmt, ...) @system; -static int foo(); +static int foo() @system; /**********************************/ diff --git a/test/runnable/literal.d b/test/runnable/literal.d index 99b177759b4e..fb4ed5e9f34c 100644 --- a/test/runnable/literal.d +++ b/test/runnable/literal.d @@ -5,7 +5,7 @@ Success --- */ -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; enum { diff --git a/test/runnable/mangle.d b/test/runnable/mangle.d index 7268c3feaaf1..b55681b5d6d6 100644 --- a/test/runnable/mangle.d +++ b/test/runnable/mangle.d @@ -56,7 +56,7 @@ void test10077i() /***************************************************/ // https://issues.dlang.org/show_bug.cgi?id=13050 -void func13050(int); +void func13050(int) @system; template decl13050(Arg) { void decl13050(Arg); diff --git a/test/runnable/nested.d b/test/runnable/nested.d index 003b9358c875..db694456d66a 100644 --- a/test/runnable/nested.d +++ b/test/runnable/nested.d @@ -1593,7 +1593,7 @@ void test4612() struct S4841(alias pred) { - void unused_func(); + void unused_func() @system; } void abc4841() { diff --git a/test/runnable/nogc.d b/test/runnable/nogc.d index c9a58b7e744b..2c47b031be0d 100644 --- a/test/runnable/nogc.d +++ b/test/runnable/nogc.d @@ -5,7 +5,7 @@ Success --- */ -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; /***********************/ diff --git a/test/runnable/nulltype.d b/test/runnable/nulltype.d index 87d794005051..70e7e5abbbc3 100644 --- a/test/runnable/nulltype.d +++ b/test/runnable/nulltype.d @@ -11,7 +11,7 @@ RUN_OUTPUT: Success --- */ -extern (C) int printf(const(char*) fmt, ...); +extern (C) int printf(const(char*) fmt, ...) @system; alias typeof(null) null_t; diff --git a/test/runnable/opdisp.d b/test/runnable/opdisp.d index 6aca559d7c44..3cc2637365ba 100644 --- a/test/runnable/opdisp.d +++ b/test/runnable/opdisp.d @@ -4,7 +4,7 @@ RUN_OUTPUT: Success --- */ -extern (C) int printf(const char* fmt, ...); +extern (C) int printf(const char* fmt, ...) @system; int pass(int n){ return n; } diff --git a/test/runnable/opover2.d b/test/runnable/opover2.d index 35356c8ebaa0..47e5fe1765d2 100644 --- a/test/runnable/opover2.d +++ b/test/runnable/opover2.d @@ -3,7 +3,7 @@ // Test operator overloading -extern (C) int printf(const(char*) fmt, ...); +extern (C) int printf(const(char*) fmt, ...) @system; template Seq(T...){ alias T Seq; } @@ -803,7 +803,7 @@ struct T void test11161() { - T t1, t2; + T t1, t2; assert(t1.tupleof != t2.tupleof); assert(t1 != t2); // fails } @@ -1522,7 +1522,7 @@ struct R10597 { void opIndex(int) {} void opSlice(int, int) {} - int opDollar(); + int opDollar() @system; } R10597 r; diff --git a/test/runnable/overload.d b/test/runnable/overload.d index 72255e452345..3c53997c1012 100644 --- a/test/runnable/overload.d +++ b/test/runnable/overload.d @@ -12,7 +12,7 @@ import imports.template_ovs1; import imports.template_ovs2; import imports.template_ovs3; -extern(C) int printf(const char* fmt, ...); +extern(C) int printf(const char* fmt, ...) @system; template TypeTuple(T...){ alias T TypeTuple; } template Id( T){ alias T Id; } @@ -459,7 +459,7 @@ void test8943() { struct S { - void foo(); + void foo() @system; } alias TypeTuple!(__traits(getOverloads, S, "foo")) Overloads; diff --git a/test/runnable/printargs.d b/test/runnable/printargs.d index 7d4d916f13d7..50cbae93f4dc 100644 --- a/test/runnable/printargs.d +++ b/test/runnable/printargs.d @@ -1,7 +1,7 @@ // PERMUTE_ARGS: // EXECUTE_ARGS: A B C -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; int main(char[][] args) { diff --git a/test/runnable/property2.d b/test/runnable/property2.d index 275729f2a3e9..763dce5fc08a 100644 --- a/test/runnable/property2.d +++ b/test/runnable/property2.d @@ -18,7 +18,7 @@ RUN_OUTPUT: Success --- */ -extern (C) int printf(const char* fmt, ...); +extern (C) int printf(const char* fmt, ...) @system; /*******************************************/ diff --git a/test/runnable/sctor.d b/test/runnable/sctor.d index f774cc9f296f..98691ac55fad 100644 --- a/test/runnable/sctor.d +++ b/test/runnable/sctor.d @@ -7,7 +7,7 @@ Success --- */ -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; /***************************************************/ // mutable field diff --git a/test/runnable/sdtor.d b/test/runnable/sdtor.d index 1a119b21bb4c..1889d268c880 100644 --- a/test/runnable/sdtor.d +++ b/test/runnable/sdtor.d @@ -17,7 +17,7 @@ S7353 import core.vararg; -extern (C) int printf(const(char*) fmt, ...) nothrow; +extern (C) int printf(const(char*) fmt, ...) nothrow @system; template TypeTuple(T...) { alias TypeTuple = T; } diff --git a/test/runnable/sieve.d b/test/runnable/sieve.d index bd9069e1d59a..73cf6bea16ab 100644 --- a/test/runnable/sieve.d +++ b/test/runnable/sieve.d @@ -44,7 +44,7 @@ int sieve() return 0; } -extern(C) void dmd_coverDestPath(string path); +extern(C) void dmd_coverDestPath(string path) @system; int main(string[] args) { diff --git a/test/runnable/template1.d b/test/runnable/template1.d index dde9213deb56..8f33d76b831b 100644 --- a/test/runnable/template1.d +++ b/test/runnable/template1.d @@ -1930,9 +1930,9 @@ class Conversion(T,U){ class Big{ char[2] dummy; } - static Small Test(U u); - static Big Test(...); - static T MakeT(); + static Small Test(U u) @system; + static Big Test(...) @system; + static T MakeT() @system; enum { exists = (Test(MakeT())).sizeof == (Small).sizeof } diff --git a/test/runnable/template9.d b/test/runnable/template9.d index 414a678607c9..da4b4282bd14 100644 --- a/test/runnable/template9.d +++ b/test/runnable/template9.d @@ -1516,10 +1516,10 @@ alias T7643!( Specs7643[] ) U7643; // Error: tuple A is used as a type /**********************************/ // https://issues.dlang.org/show_bug.cgi?id=7671 - inout(int)[3] id7671n1 ( inout(int)[3] ); + inout(int)[3] id7671n1 ( inout(int)[3] ) @system; inout( U )[n] id7671x1(U, size_t n)( inout( U )[n] ); -shared(inout int)[3] id7671n2 ( shared(inout int)[3] ); +shared(inout int)[3] id7671n2 ( shared(inout int)[3] ) @system; shared(inout U )[n] id7671x2(U, size_t n)( shared(inout U )[n] ); void test7671() @@ -3580,7 +3580,7 @@ static assert(!__traits(compiles, TemplateArgsOf12651!(S12651!int, S, float))); struct A12719 { - B12719!int b(); + B12719!int b() @system; } struct B12719(T) @@ -4617,7 +4617,7 @@ struct Hoge14481 template M14520(alias a) { enum M14520 = 1; } template M14520(string s) { enum M14520 = 2; } -int f14520a(); +int f14520a() @system; string f14520b() { assert(0); } string f14520c() { return "a"; } diff --git a/test/runnable/test10.d b/test/runnable/test10.d index b9f8885696ab..a77f4b4bbe01 100644 --- a/test/runnable/test10.d +++ b/test/runnable/test10.d @@ -8,7 +8,7 @@ it is 32 import imports.test10a; -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; int main() { diff --git a/test/runnable/test11.d b/test/runnable/test11.d index 15948f144828..276d82e87981 100644 --- a/test/runnable/test11.d +++ b/test/runnable/test11.d @@ -1,7 +1,7 @@ // REQUIRED_ARGS: -extern(C) int printf(const char*, ...); -extern(C) size_t strlen(const char*); +extern(C) int printf(const char*, ...) @system; +extern(C) size_t strlen(const char*) @system; /**************************************/ diff --git a/test/runnable/test12.d b/test/runnable/test12.d index dac4ed647b0c..813b05d7f0b6 100644 --- a/test/runnable/test12.d +++ b/test/runnable/test12.d @@ -1,7 +1,7 @@ // PERMUTE_ARGS: -unittest -O -release -inline -fPIC -g -extern(C) int printf(const char*, ...); -extern(C) int sprintf(char*, const char*, ...); +extern(C) int printf(const char*, ...) @system; +extern(C) int sprintf(char*, const char*, ...) @system; /**************************************/ @@ -413,7 +413,7 @@ void test15() class Conversion(T) { class Big {char[2] dummy;} - static Big Test(...); + static Big Test(...) @system; enum { exists = Test().sizeof } } @@ -1060,7 +1060,7 @@ struct S50() int i=f50(0).sizeof; } -int f50(...); +int f50(...) @system; /**************************************/ diff --git a/test/runnable/test14901.d b/test/runnable/test14901.d index 73a357a40866..4ec6ab7802cb 100644 --- a/test/runnable/test14901.d +++ b/test/runnable/test14901.d @@ -10,7 +10,7 @@ import imports.test14901d; extern(C) __gshared static int initCount; -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; void main() { diff --git a/test/runnable/test15.d b/test/runnable/test15.d index a543a24944c1..e681742d0222 100644 --- a/test/runnable/test15.d +++ b/test/runnable/test15.d @@ -12,7 +12,7 @@ import core.vararg; import std.string; import std.stdio : File; -extern (C) +extern (C) @system { int printf(const char*, ...); } diff --git a/test/runnable/test16.d b/test/runnable/test16.d index 06741f5bcc73..d307ff08468e 100644 --- a/test/runnable/test16.d +++ b/test/runnable/test16.d @@ -1,6 +1,6 @@ // REQUIRED_ARGS: -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; /************************************************/ // These seem to be the original tests for $ (originally 'length'). diff --git a/test/runnable/test17.d b/test/runnable/test17.d index 4b17ede464b9..e04626dd7507 100644 --- a/test/runnable/test17.d +++ b/test/runnable/test17.d @@ -1,7 +1,7 @@ import core.stdc.stdio: fflush, stdout; -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; void ulog(string s) { diff --git a/test/runnable/test19.d b/test/runnable/test19.d index 372d32f71e32..1e1b34512bb7 100644 --- a/test/runnable/test19.d +++ b/test/runnable/test19.d @@ -2,7 +2,7 @@ import std.algorithm: cmp; -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; /* ================================ */ diff --git a/test/runnable/test19163.d b/test/runnable/test19163.d index 460936b3f43c..1b2e523b0e93 100644 --- a/test/runnable/test19163.d +++ b/test/runnable/test19163.d @@ -3,7 +3,7 @@ // REQUIRED_ARGS: -cov // EXECUTE_ARGS: ${RESULTS_DIR}/runnable -extern(C) void dmd_coverDestPath(string pathname); +extern(C) void dmd_coverDestPath(string pathname) @system; void main(string[] args) { diff --git a/test/runnable/test20.d b/test/runnable/test20.d index 2f650a724687..3485bb73d02f 100644 --- a/test/runnable/test20.d +++ b/test/runnable/test20.d @@ -6,7 +6,7 @@ runnable/test20.d(448): Deprecation: The `delete` keyword has been deprecated. */ import core.vararg; -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; /*****************************************/ diff --git a/test/runnable/test22.d b/test/runnable/test22.d index 988b4a9c4da3..1ab05e5b7a2c 100644 --- a/test/runnable/test22.d +++ b/test/runnable/test22.d @@ -2,7 +2,7 @@ import core.stdc.stdarg; -extern(C) +extern(C) @system { int printf(const char*, ...); version(Windows) diff --git a/test/runnable/test29.d b/test/runnable/test29.d index 03c81c658778..5184ad8a5423 100644 --- a/test/runnable/test29.d +++ b/test/runnable/test29.d @@ -11,7 +11,7 @@ RUN_OUTPUT: import imports.test29a; import imports.test29b; -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; void main() { printf("%d\n", qwert); diff --git a/test/runnable/test3.d b/test/runnable/test3.d index 4c6b9deaa47e..6121f2cc307f 100644 --- a/test/runnable/test3.d +++ b/test/runnable/test3.d @@ -3,7 +3,7 @@ import imports.test3a; -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; class Foo { diff --git a/test/runnable/test36.d b/test/runnable/test36.d index a7c8af095332..b4effb1afaad 100644 --- a/test/runnable/test36.d +++ b/test/runnable/test36.d @@ -2,7 +2,7 @@ import core.stdc.stdio; interface IUnknown{ - extern(Windows): + extern(Windows) @system: void func(); } class ComObject :IUnknown @@ -14,7 +14,7 @@ extern (Windows): } interface IDataObject: IUnknown { - extern(Windows): + extern(Windows) @system: void method(); } package class invarianttest:ComObject, IDataObject diff --git a/test/runnable/test4.d b/test/runnable/test4.d index 037455a4b41d..29ecc45bfb3a 100644 --- a/test/runnable/test4.d +++ b/test/runnable/test4.d @@ -13,7 +13,7 @@ import core.exception; import core.stdc.math; import core.vararg; -extern(C) +extern(C) @system { int atoi(const char*); int memcmp(const void*, const void*, size_t); diff --git a/test/runnable/test42.d b/test/runnable/test42.d index cc791b695c76..2cd1a280b851 100644 --- a/test/runnable/test42.d +++ b/test/runnable/test42.d @@ -3871,7 +3871,7 @@ static assert(mixin(ice4390()) == ``); // https://issues.dlang.org/show_bug.cgi?id=190 alias int avocado; -void eat(avocado x225 = .x225); +void eat(avocado x225 = .x225) @system; avocado x225; void test225() diff --git a/test/runnable/test5.d b/test/runnable/test5.d index a14b4b13271f..e65c10e7dc6d 100644 --- a/test/runnable/test5.d +++ b/test/runnable/test5.d @@ -1,11 +1,11 @@ // PERMUTE_ARGS: -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; interface foo { - extern (C) int testc(int i); - extern (Windows) int testw(int i); + extern (C) int testc(int i) @system; + extern (Windows) int testw(int i) @system; extern (D) int testd(int i); } diff --git a/test/runnable/test52.d b/test/runnable/test52.d index 85b8d6725d73..836d37afdd77 100644 --- a/test/runnable/test52.d +++ b/test/runnable/test52.d @@ -8,7 +8,7 @@ count = 3 // https://issues.dlang.org/show_bug.cgi?id=2311 -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; __gshared ulong count; diff --git a/test/runnable/test7.d b/test/runnable/test7.d index d3d4909f1788..a69b58e7a391 100644 --- a/test/runnable/test7.d +++ b/test/runnable/test7.d @@ -2,7 +2,7 @@ // Test memset style array assignments. -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; /**************************************/ diff --git a/test/runnable/test7511.d b/test/runnable/test7511.d index bb879957d4c0..cb9dc18a55d4 100644 --- a/test/runnable/test7511.d +++ b/test/runnable/test7511.d @@ -4,7 +4,7 @@ RUN_OUTPUT: Success --- */ -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; /**********************************/ // https://issues.dlang.org/show_bug.cgi?id=7511 diff --git a/test/runnable/test8.d b/test/runnable/test8.d index 55615822a714..98119cf48151 100644 --- a/test/runnable/test8.d +++ b/test/runnable/test8.d @@ -9,7 +9,7 @@ module testxxx8; import core.vararg; -extern(C) +extern(C) @system { int atoi(const char*); int printf(const char*, ...); diff --git a/test/runnable/testaa.d b/test/runnable/testaa.d index 847d94de44d4..db5828ffc364 100644 --- a/test/runnable/testaa.d +++ b/test/runnable/testaa.d @@ -2,8 +2,8 @@ /* Test associative arrays */ -extern(C) int printf(const char*, ...); -extern(C) int memcmp(const void *s1, const void *s2, size_t n); +extern(C) int printf(const char*, ...) @system; +extern(C) int memcmp(const void *s1, const void *s2, size_t n) @system; import core.memory; // for GC.collect import std.random; // for uniform random numbers diff --git a/test/runnable/testaa2.d b/test/runnable/testaa2.d index fc475cd6db6f..869f083f4507 100644 --- a/test/runnable/testaa2.d +++ b/test/runnable/testaa2.d @@ -12,7 +12,7 @@ Success --- */ -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; /************************************************/ diff --git a/test/runnable/testabi.d b/test/runnable/testabi.d index 09856e61ff35..c7d450247093 100644 --- a/test/runnable/testabi.d +++ b/test/runnable/testabi.d @@ -7,7 +7,7 @@ else version(X86_64) //version = Run_X86_64_Tests; } -extern (C) int printf(const char*, ...); +extern (C) int printf(const char*, ...) @system; template tuple(A...) { alias A tuple; } diff --git a/test/runnable/testaliascast.d b/test/runnable/testaliascast.d index c55f82034994..6df4e76f7ee8 100644 --- a/test/runnable/testaliascast.d +++ b/test/runnable/testaliascast.d @@ -2,7 +2,7 @@ string result; -extern(C) void rt_finalize(void *ptr, bool det=true); +extern(C) void rt_finalize(void *ptr, bool det=true) @system; void clear(T)(T obj) if (is(T == class)) { rt_finalize(cast(void*)obj); diff --git a/test/runnable/testbounds.d b/test/runnable/testbounds.d index 494d0ba28c12..bc439bf15346 100644 --- a/test/runnable/testbounds.d +++ b/test/runnable/testbounds.d @@ -9,7 +9,7 @@ Success // Test array bounds checking import core.exception; -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; template TypeTuple(T...) { alias T TypeTuple; } diff --git a/test/runnable/testclass.d b/test/runnable/testclass.d index 2f3c22ea36f3..4a045fb06230 100644 --- a/test/runnable/testclass.d +++ b/test/runnable/testclass.d @@ -4,7 +4,7 @@ RUN_OUTPUT: Success --- */ -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; /******************************************/ // https://issues.dlang.org/show_bug.cgi?id=12078 diff --git a/test/runnable/testconst.d b/test/runnable/testconst.d index 0ca738b07e29..4bcf8b698b82 100644 --- a/test/runnable/testconst.d +++ b/test/runnable/testconst.d @@ -1750,12 +1750,12 @@ void test3748a(inout int = 1) void test3748b(inout int = 1) { // Top of the parameter type is non-ref & qualified - static inout(int[]) foo1( inout(int[]) a); - static shared(inout(int[])) bar1(shared(inout(int[])) a); + static inout(int[]) foo1( inout(int[]) a) @system; + static shared(inout(int[])) bar1(shared(inout(int[])) a) @system; // Top of the parameter type is non-ref & un-qualified - static inout(int) [] foo2( inout(int) [] a); - static shared(inout(int))[] bar2(shared(inout(int))[] a); + static inout(int) [] foo2( inout(int) [] a) @system; + static shared(inout(int))[] bar2(shared(inout(int))[] a) @system; // Top of the argument type is qualified int[] ma1; @@ -1815,12 +1815,12 @@ void test3748b(inout int = 1) void test3748c(inout int = 1) { // Top of the parameter type is ref & qualified - static inout(int[]) foo1(ref inout(int[]) a); - static shared(inout(int[])) bar1(ref shared(inout(int[])) a); + static inout(int[]) foo1(ref inout(int[]) a) @system; + static shared(inout(int[])) bar1(ref shared(inout(int[])) a) @system; // Top of the parameter type is ref & un-qualified - static inout(int) [] foo2(ref inout(int) [] a); - static shared(inout(int))[] bar2(ref shared(inout(int))[] a); + static inout(int) [] foo2(ref inout(int) [] a) @system; + static shared(inout(int))[] bar2(ref shared(inout(int))[] a) @system; // Top of the argument type is qualified int[] ma1; @@ -2204,7 +2204,7 @@ void test5473() static void g(){}; } - void dummy(); + void dummy() @system; alias typeof(dummy) VoidFunc; const C c = new C; @@ -3595,7 +3595,7 @@ void test11257() /************************************/ // https://issues.dlang.org/show_bug.cgi?id=11215 -shared(inout(void)**) f11215(inout int); +shared(inout(void)**) f11215(inout int) @system; static assert(is(typeof(f11215(0)) == shared(void**))); static assert(is(typeof(f11215((const int).init)) == shared(const(void)**))); diff --git a/test/runnable/testcontracts.d b/test/runnable/testcontracts.d index a0104651729f..52cf95162025 100644 --- a/test/runnable/testcontracts.d +++ b/test/runnable/testcontracts.d @@ -1,6 +1,6 @@ // PERMUTE_ARGS: -inline -g -O -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; /*******************************************/ diff --git a/test/runnable/testdstress.d b/test/runnable/testdstress.d index 6370a27cfab6..cff242eaab87 100644 --- a/test/runnable/testdstress.d +++ b/test/runnable/testdstress.d @@ -12,8 +12,8 @@ import core.memory; import core.exception; import core.vararg; -extern(C) void* malloc(size_t size); -extern(C) int printf(const char*, ...); +extern(C) void* malloc(size_t size) @system; +extern(C) int printf(const char*, ...) @system; /* ================================ */ diff --git a/test/runnable/testenum.d b/test/runnable/testenum.d index a7529510e9b4..b84acc507565 100644 --- a/test/runnable/testenum.d +++ b/test/runnable/testenum.d @@ -6,7 +6,7 @@ Success --- */ -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; /**********************************************/ diff --git a/test/runnable/testinvariant.d b/test/runnable/testinvariant.d index d3b3b6ffa165..2d31bd28cbfe 100644 --- a/test/runnable/testinvariant.d +++ b/test/runnable/testinvariant.d @@ -1,6 +1,6 @@ // PERMUTE_ARGS: -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; class Foo : Object { diff --git a/test/runnable/testpic.d b/test/runnable/testpic.d index ef3ab8667fcd..bb7e71214638 100644 --- a/test/runnable/testpic.d +++ b/test/runnable/testpic.d @@ -1,7 +1,7 @@ // PERMUTE_ARGS: -fPIC -O -fPIE // DISABLED: win32 win64 -extern (C) int printf(const char*, ...); +extern (C) int printf(const char*, ...) @system; /***************************************************/ diff --git a/test/runnable/testreturn.d b/test/runnable/testreturn.d index 42b93ba1ca85..04b7afc5d4e5 100644 --- a/test/runnable/testreturn.d +++ b/test/runnable/testreturn.d @@ -4,7 +4,7 @@ RUN_OUTPUT: Success --- */ -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; alias TypeTuple(T...) = T; diff --git a/test/runnable/testrightthis.d b/test/runnable/testrightthis.d index e5d7ba3aec37..5e475ca78703 100644 --- a/test/runnable/testrightthis.d +++ b/test/runnable/testrightthis.d @@ -7,7 +7,7 @@ Success --- */ -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; template TypeTuple(TL...) { alias TypeTuple = TL; } diff --git a/test/runnable/testscope2.d b/test/runnable/testscope2.d index d5c5f4b0d820..c07b008fdd54 100644 --- a/test/runnable/testscope2.d +++ b/test/runnable/testscope2.d @@ -15,10 +15,10 @@ import core.stdc.stdio; struct SS { - ref ulong foo1(return ref int* delegate() return p) return; - ref int foo2(return ref int delegate() p); - ref int foo3(inout ref int* p); - ref int foo4(return inout ref int* p); + ref ulong foo1(return ref int* delegate() return p) return @system; + ref int foo2(return ref int delegate() p) @system; + ref int foo3(inout ref int* p) @system; + ref int foo4(return inout ref int* p) @system; } pragma(msg, "foo1 ", typeof(&SS.foo1)); diff --git a/test/runnable/testswitch.d b/test/runnable/testswitch.d index c7b9378f8425..9cd20f5215bf 100644 --- a/test/runnable/testswitch.d +++ b/test/runnable/testswitch.d @@ -1,6 +1,6 @@ // PERMUTE_ARGS: -w -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; int testswitch(string h) { diff --git a/test/runnable/testthread2.d b/test/runnable/testthread2.d index 53f8a3b50f32..522b3ab595c4 100644 --- a/test/runnable/testthread2.d +++ b/test/runnable/testthread2.d @@ -61,7 +61,7 @@ struct LinearAA(K, V) { } } -extern (C) int rand(); +extern (C) int rand() @system; uint random(const uint max = uint.max) { diff --git a/test/runnable/testv.d b/test/runnable/testv.d index d146fd49dbf4..b4ab79de8222 100644 --- a/test/runnable/testv.d +++ b/test/runnable/testv.d @@ -1,5 +1,5 @@ -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; /*********************************************************/ diff --git a/test/runnable/traits.d b/test/runnable/traits.d index 16eec1e530dc..202754887782 100644 --- a/test/runnable/traits.d +++ b/test/runnable/traits.d @@ -472,8 +472,8 @@ void test15() struct S16 { } -int foo16(); -int bar16(); +int foo16() @system; +int bar16() @system; void test16() { @@ -493,7 +493,7 @@ struct S17 int s2; } -int foo17(); +int foo17() @system; void test17() { @@ -513,7 +513,7 @@ void test17() interface D18 { - extern(Windows): + extern(Windows) @system: void foo(); int foo(int); } diff --git a/test/runnable/uda.d b/test/runnable/uda.d index 72985e12cebf..8548cdfa65a8 100644 --- a/test/runnable/uda.d +++ b/test/runnable/uda.d @@ -100,8 +100,8 @@ void test3() /************************************************/ -@(1) void foo4(); -@(2) void foo4(int x); +@(1) void foo4() @system; +@(2) void foo4(int x) @system; void test4() { diff --git a/test/runnable/ufcs.d b/test/runnable/ufcs.d index 181ba8c39817..9e51d827c128 100644 --- a/test/runnable/ufcs.d +++ b/test/runnable/ufcs.d @@ -2,7 +2,7 @@ module ufcs; -extern (C) int printf(const char*, ...); +extern (C) int printf(const char*, ...) @system; /*******************************************/ diff --git a/test/runnable/uniformctor.d b/test/runnable/uniformctor.d index b41dd8f2b365..ac6605927eaf 100644 --- a/test/runnable/uniformctor.d +++ b/test/runnable/uniformctor.d @@ -4,7 +4,7 @@ RUN_OUTPUT: Success --- */ -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; template TypeTuple(TL...) { alias TypeTuple = TL; } import core.stdc.math : isnan; diff --git a/test/runnable/version.d b/test/runnable/version.d index 1186e4c6a366..4719dab2ae96 100644 --- a/test/runnable/version.d +++ b/test/runnable/version.d @@ -8,7 +8,7 @@ i = 2 --- */ -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; /*******************************************/ diff --git a/test/runnable/warning1.d b/test/runnable/warning1.d index 537088e97cc3..c9abc34ccf85 100644 --- a/test/runnable/warning1.d +++ b/test/runnable/warning1.d @@ -1,7 +1,7 @@ // REQUIRED_ARGS: -w // PERMUTE_ARGS: -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; /******************************************/ diff --git a/test/runnable/wc.d b/test/runnable/wc.d index f18a32ebba7a..e7b66297359c 100644 --- a/test/runnable/wc.d +++ b/test/runnable/wc.d @@ -3,7 +3,7 @@ import std.file; -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; int main (string[] args) { diff --git a/test/runnable/wc2.d b/test/runnable/wc2.d index 76c02a7f8807..eb7439c120bd 100644 --- a/test/runnable/wc2.d +++ b/test/runnable/wc2.d @@ -3,7 +3,7 @@ import std.file; -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; int main (string[] args) { diff --git a/test/runnable/xtest46.d b/test/runnable/xtest46.d index fdd21d39d88e..6b1f6af1ff61 100644 --- a/test/runnable/xtest46.d +++ b/test/runnable/xtest46.d @@ -4894,7 +4894,7 @@ void test5696() /***************************************************/ // https://issues.dlang.org/show_bug.cgi?id=5933 -int dummyfunc5933(); +int dummyfunc5933() @system; alias typeof(dummyfunc5933) FuncType5933; struct S5933a { auto x() { return 0; } } @@ -6369,7 +6369,7 @@ void test8665() /***************************************************/ -int foo8108(int, int); +int foo8108(int, int) @system; int foo8108(int a, int b) { @@ -6501,7 +6501,7 @@ template ParameterTuple(alias func) static assert(0); } -int foo161(ref float y); +int foo161(ref float y) @system; void test161() { @@ -6606,13 +6606,13 @@ struct S162 enum int ttt = generateMethodStubs!( S162 )(); - float height(); - int get( int ); - int get( long ); - void clear(); + float height() @system; + int get( int ) @system; + int get( long ) @system; + void clear() @system; - void draw( int ); - void draw( long ); + void draw( int ) @system; + void draw( long ) @system; } /***************************************************/ diff --git a/test/runnable/xtestenum.d b/test/runnable/xtestenum.d index ce77782b88cd..e723bdd1a0f8 100644 --- a/test/runnable/xtestenum.d +++ b/test/runnable/xtestenum.d @@ -7,7 +7,7 @@ Success --- */ -extern(C) int printf(const char*, ...); +extern(C) int printf(const char*, ...) @system; /***********************************/ diff --git a/test/runnable_cxx/abi_tags.d b/test/runnable_cxx/abi_tags.d index 80eead2dbe8c..3230f20bddd8 100644 --- a/test/runnable_cxx/abi_tags.d +++ b/test/runnable_cxx/abi_tags.d @@ -16,7 +16,7 @@ import core.attribute; alias Tuple(A...) = A; enum foo_bar = gnuAbiTag("foo", "bar"); -extern(C++) +extern(C++) @system { @gnuAbiTag("tag1") struct Tagged1 {} @gnuAbiTag("tag2") struct Tagged2 {} diff --git a/test/runnable_cxx/cabi1.d b/test/runnable_cxx/cabi1.d index 3a914cd0e57d..149bcaecd042 100644 --- a/test/runnable_cxx/cabi1.d +++ b/test/runnable_cxx/cabi1.d @@ -12,13 +12,13 @@ struct Foo5 { int i, j; } struct Foo6 { int i, j, k; } struct S7 { float a, b; } -extern (C) Foo1 ctest1(); -extern (C) Foo2 ctest2(); -extern (C) Foo3 ctest3(); -extern (C) Foo4 ctest4(); -extern (C) Foo5 ctest5(); -extern (C) Foo6 ctest6(); -extern (C) S7 ctest10(); +extern (C) Foo1 ctest1() @system; +extern (C) Foo2 ctest2() @system; +extern (C) Foo3 ctest3() @system; +extern (C) Foo4 ctest4() @system; +extern (C) Foo5 ctest5() @system; +extern (C) Foo6 ctest6() @system; +extern (C) S7 ctest10() @system; version(Windows) version = Windows_or_32bit; @@ -59,7 +59,7 @@ version(Windows_or_32bit) /*******************************************/ -extern (C) +extern (C) @system { char ctest7(char); ubyte ctest8(ubyte); @@ -75,7 +75,7 @@ void test2() /******************************************/ -extern (C) +extern (C) @system { void ctestrir(int x1, int x2, int x3, int x4, int x5, int x6, c_long_double a, int b, c_long_double c); } @@ -94,13 +94,13 @@ extern (C) void dtestrir(int x1, int x2, int x3, int x4, int x5, int x6, c_long_ assert(c == 401.0); } -extern (C) void test4(); +extern (C) void test4() @system; /******************************************/ struct S11 { ubyte a, b, c; } -extern (C) S11 ctest11(ubyte x, S11, ubyte y); +extern (C) S11 ctest11(ubyte x, S11, ubyte y) @system; void test11() { @@ -122,7 +122,7 @@ void test11() struct S12 { char a,d; char b,e; ubyte c; } -extern (C) S12 ctest12(ubyte x, S12, ubyte y); +extern (C) S12 ctest12(ubyte x, S12, ubyte y) @system; void test12() { @@ -145,7 +145,7 @@ void test12() struct S13 { ushort a, b, c; } -extern (C) S13 ctest13(ubyte x, S13, ubyte y); +extern (C) S13 ctest13(ubyte x, S13, ubyte y) @system; void test13() { @@ -167,7 +167,7 @@ void test13() struct S14 { char a,d,e,f; char b,g; ubyte c; } -extern (C) S14 ctest14(ubyte x, S14, ubyte y); +extern (C) S14 ctest14(ubyte x, S14, ubyte y) @system; void test14() { @@ -189,7 +189,7 @@ void test14() struct S15 { char a,d,e,f; char b,g,h,i; ubyte c; } -extern (C) S15 ctest15(ubyte x, S15, ubyte y); +extern (C) S15 ctest15(ubyte x, S15, ubyte y) @system; void test15() { @@ -218,7 +218,7 @@ struct S16 { } } -extern (C) S16 ctest16(ubyte x, S16, ubyte y); +extern (C) S16 ctest16(ubyte x, S16, ubyte y) @system; void test16() { diff --git a/test/runnable_cxx/cpp11.d b/test/runnable_cxx/cpp11.d index 6951dec8f70c..f463f1a5b6af 100644 --- a/test/runnable_cxx/cpp11.d +++ b/test/runnable_cxx/cpp11.d @@ -40,14 +40,14 @@ enum u32_19658 : uint { a } enum i64_19658 : long { a } enum u64_19658 : ulong { a } -extern(C++) void test19658_i8(i8_19658); -extern(C++) void test19658_u8(u8_19658); -extern(C++) void test19658_i16(i16_19658); -extern(C++) void test19658_u16(u16_19658); -extern(C++) void test19658_i32(i32_19658); -extern(C++) void test19658_u32(u32_19658); -extern(C++) void test19658_i64(i64_19658); -extern(C++) void test19658_u64(u64_19658); +extern(C++) void test19658_i8(i8_19658) @system; +extern(C++) void test19658_u8(u8_19658) @system; +extern(C++) void test19658_i16(i16_19658) @system; +extern(C++) void test19658_u16(u16_19658) @system; +extern(C++) void test19658_i32(i32_19658) @system; +extern(C++) void test19658_u32(u32_19658) @system; +extern(C++) void test19658_i64(i64_19658) @system; +extern(C++) void test19658_u64(u64_19658) @system; void test19658() { diff --git a/test/runnable_cxx/cpp_abi_tests.d b/test/runnable_cxx/cpp_abi_tests.d index 5785e6b1b3d4..0c9d1684151b 100644 --- a/test/runnable_cxx/cpp_abi_tests.d +++ b/test/runnable_cxx/cpp_abi_tests.d @@ -10,7 +10,7 @@ else version(Windows) enum __c_wchar_t : wchar; alias wchar_t = __c_wchar_t; -extern(C++) { +extern(C++) @system { struct S { @@ -20,7 +20,7 @@ struct S struct S18784 { int i; - this(int); + this(int) @system; } extern(C++, std) @@ -184,7 +184,7 @@ T[] values(T)() return values; } -extern(C++, `ns1`) +extern(C++, `ns1`) @system { // C++: `const char*, const char**` int constFunction1(const(char)*, const(char)**); @@ -196,7 +196,7 @@ extern(C++, `ns1`) int constFunction4(const(char*), const(char***)); } -extern(C++) +extern(C++) @system { struct SmallStruct { diff --git a/test/runnable_cxx/cpp_stdlib.d b/test/runnable_cxx/cpp_stdlib.d index dd7bb11fc648..45296916dea0 100644 --- a/test/runnable_cxx/cpp_stdlib.d +++ b/test/runnable_cxx/cpp_stdlib.d @@ -25,6 +25,7 @@ else } extern(C++): +@system: ref T identity (T) (ref T v); T** identityPP (T) (T** v); diff --git a/test/runnable_cxx/cppa.d b/test/runnable_cxx/cppa.d index 3d07a03213f8..946a7908293f 100644 --- a/test/runnable_cxx/cppa.d +++ b/test/runnable_cxx/cppa.d @@ -14,7 +14,7 @@ import core.stdc.config; import core.stdc.stdint; extern (C++) - int foob(int i, int j, int k); + int foob(int i, int j, int k) @system; class C { @@ -54,12 +54,12 @@ void test1() /****************************************/ -extern (C++) interface D +extern (C++) @system interface D { int bar(int i, int j, int k); } -extern (C++) D getD(); +extern (C++) D getD() @system; void test2() { @@ -70,9 +70,9 @@ void test2() /****************************************/ -extern (C++) int callE(E); +extern (C++) int callE(E) @system; -extern (C++) interface E +extern (C++) @system interface E { int bar(int i, int j, int k); } @@ -100,7 +100,7 @@ void test3() /****************************************/ -extern (C++) void foo4(char* p); +extern (C++) void foo4(char* p) @system; void test4() { @@ -109,7 +109,7 @@ void test4() /****************************************/ -extern(C++) +extern(C++) @system { struct foo5 { int i; int j; void* p; } @@ -131,7 +131,7 @@ void test5() /****************************************/ -extern(C++) +extern(C++) @system { struct S6 { @@ -155,7 +155,7 @@ extern(C++) S6_3 foo6_3(); } -extern (C) int foosize6(); +extern (C) int foosize6() @system; void test6() { @@ -174,7 +174,7 @@ version (X86) /****************************************/ -extern (C) int foo7(); +extern (C) int foo7() @system; struct S { @@ -190,7 +190,7 @@ void test7() /****************************************/ -extern (C++) void foo8(const(char)*); +extern (C++) void foo8(const(char)*) @system; void test8() { @@ -203,7 +203,7 @@ void test8() struct elem9 { } -extern(C++) void foobar9(elem9*, elem9*); +extern(C++) void foobar9(elem9*, elem9*) @system; void test9() { @@ -230,7 +230,7 @@ extern(C++) class D11802 : C11802 override void fun(B11802*) { x *= 3; } } -extern(C++) void test11802x(D11802); +extern(C++) void test11802x(D11802) @system; void test11802() { @@ -247,7 +247,7 @@ struct S13956 { } -extern(C++) void func13956(S13956 arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6); +extern(C++) void func13956(S13956 arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6) @system; extern(C++) void check13956(S13956 arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6) { @@ -268,7 +268,7 @@ void test13956() /****************************************/ // https://issues.dlang.org/show_bug.cgi?id=5148 -extern (C++) +extern (C++) @system { void foo10(const(char)*, const(char)*); void foo10(const int, const int); @@ -296,9 +296,9 @@ void test10() /****************************************/ -extern (C++, N11.M) { void bar11(); } +extern (C++, N11.M) @system { void bar11(); } -extern (C++, A11.B) { extern (C++, C) { void bar(); }} +extern (C++, A11.B) @system { extern (C++, C) { void bar(); }} void test11() { @@ -313,7 +313,7 @@ struct Struct10071 c_long_double r; } -extern(C++) size_t offset10071(); +extern(C++) size_t offset10071() @system; void test10071() { assert(offset10071() == Struct10071.r.offsetof); @@ -327,7 +327,7 @@ extern(C++) void myvprintfx(const(char)* format, va_list va) { vsprintf(valistbuffer.ptr, format, va); } -extern(C++) void myvprintf(const(char)*, va_list); +extern(C++) void myvprintf(const(char)*, va_list) @system; extern(C++) void myprintf(const(char)* format, ...) { va_list ap; @@ -393,7 +393,7 @@ extern(C++) void check13955(S13955a a, S13955b b, S13955c c, S13955d d) assert(d.b == 256); } -extern(C++) void func13955(S13955a a, S13955b b, S13955c c, S13955d d); +extern(C++) void func13955(S13955a a, S13955b b, S13955c c, S13955d d) @system; void test13955() { @@ -402,7 +402,7 @@ void test13955() /****************************************/ -extern(C++) class C13161 +extern(C++) @system class C13161 { void dummyfunc(); long val_5; @@ -415,9 +415,9 @@ extern(C++) class Test : C13161 long val_1; } -extern(C++) size_t getoffset13161(); +extern(C++) size_t getoffset13161() @system; -extern(C++) class C13161a +extern(C++) @system class C13161a { void dummyfunc(); c_long_double val_5; @@ -429,7 +429,7 @@ extern(C++) class Testa : C13161a bool val_0; } -extern(C++) size_t getoffset13161a(); +extern(C++) size_t getoffset13161a() @system; void test13161() { @@ -441,7 +441,7 @@ void test13161() version (linux) { - extern(C++, __gnu_cxx) + extern(C++, __gnu_cxx) @system { struct new_allocator(T) { @@ -454,7 +454,7 @@ version (linux) } } -extern (C++, std) +extern (C++, std) @system { extern (C++, class) struct allocator(T) { @@ -513,7 +513,7 @@ extern (C++, std) } } -extern (C++) +extern (C++) @system { version (linux) { @@ -578,7 +578,7 @@ else version(Windows) enum __c_wchar_t : wchar; } alias wchar_t = __c_wchar_t; -extern(C++) +extern(C++) @system { bool f13289_cpp_test(); @@ -631,8 +631,8 @@ version (CRuntime_Microsoft) else alias c_long_double myld; -extern (C++) myld testld(myld); -extern (C++) myld testldld(myld, myld); +extern (C++) myld testld(myld) @system; +extern (C++) myld testldld(myld, myld) @system; void test15() @@ -672,8 +672,8 @@ enum __c_ulong : x_ulong; alias __c_long mylong; alias __c_ulong myulong; -extern (C++) mylong testl(mylong); -extern (C++) myulong testul(myulong); +extern (C++) mylong testl(mylong) @system; +extern (C++) myulong testul(myulong) @system; void test16() @@ -747,7 +747,7 @@ struct S13707 } } -extern(C++) S13707 func13707(); +extern(C++) S13707 func13707() @system; void test13707() { @@ -763,11 +763,11 @@ struct S13932(int x) int member; } -extern(C++) void func13932(S13932!(-1) s); +extern(C++) void func13932(S13932!(-1) s) @system; /****************************************/ -extern(C++, N13337.M13337) +extern(C++, N13337.M13337) @system { struct S13337{} void foo13337(S13337 s); @@ -784,7 +784,7 @@ template Signature(T) alias Signature = typeof(*(T.init)); } -extern(C++) +extern(C++) @system { alias del1_t = Delegate1!(Signature!(void function())); alias del2_t = Delegate2!(Signature!(int function(float, double)), Signature!(int function(float, double))); @@ -807,8 +807,8 @@ template Tuple14200(T...) alias Tuple14200 = T; } -extern(C++) void test14200a(Tuple14200!(int)); -extern(C++) void test14200b(float, Tuple14200!(int, double)); +extern(C++) void test14200a(Tuple14200!(int)) @system; +extern(C++) void test14200b(float, Tuple14200!(int, double)) @system; void test14200() { @@ -819,7 +819,7 @@ void test14200() /****************************************/ // https://issues.dlang.org/show_bug.cgi?id=14956 -extern(C++) void test14956(S14956 s); +extern(C++) void test14956(S14956 s) @system; /****************************************/ // check order of overloads in vtable @@ -844,8 +844,8 @@ extern (C++) class Visitor2 : Visitor int visit2(DtorExpStatement) { return 5; } } -extern(C++) bool testVtableCpp(Visitor2 sv); -extern(C++) Visitor2 getVisitor2(); +extern(C++) bool testVtableCpp(Visitor2 sv) @system; +extern(C++) Visitor2 getVisitor2() @system; bool testVtableD(Visitor2 sv) { @@ -876,7 +876,7 @@ void testVtable() /****************************************/ /* problems detected by fuzzer */ -extern(C++) void fuzz1_cppvararg(int64_t arg10, int64_t arg11, bool arg12); +extern(C++) void fuzz1_cppvararg(int64_t arg10, int64_t arg11, bool arg12) @system; extern(C++) void fuzz1_dvararg(int64_t arg10, int64_t arg11, bool arg12) { fuzz1_checkValues(arg10, arg11, arg12); @@ -899,7 +899,7 @@ void fuzz1() } //////// -extern(C++) void fuzz2_cppvararg(uint64_t arg10, uint64_t arg11, bool arg12); +extern(C++) void fuzz2_cppvararg(uint64_t arg10, uint64_t arg11, bool arg12) @system; extern(C++) void fuzz2_dvararg(uint64_t arg10, uint64_t arg11, bool arg12) { fuzz2_checkValues(arg10, arg11, arg12); @@ -931,7 +931,7 @@ else static if (UNICODE) { -extern(C++) void fuzz3_cppvararg(wchar arg10, dchar arg11, bool arg12); +extern(C++) void fuzz3_cppvararg(wchar arg10, dchar arg11, bool arg12) @system; extern(C++) void fuzz3_dvararg(wchar arg10, dchar arg11, bool arg12) { fuzz2_checkValues(arg10, arg11, arg12); @@ -963,7 +963,7 @@ void fuzz() /****************************************/ -extern (C++) +extern (C++) @system { void throwit(); } @@ -1031,7 +1031,7 @@ else /****************************************/ -extern (C++) { void throwle(); void throwpe(); } +extern (C++) @system { void throwle(); void throwpe(); } void testeh3() { @@ -1075,7 +1075,7 @@ void test15576() /****************************************/ // https://issues.dlang.org/show_bug.cgi?id=15579 -extern (C++) +extern (C++) @system { class Base { @@ -1163,9 +1163,9 @@ extern(C++) class Base2 void baser() { } } -extern(C++) interface Interface2 { abstract void f(); } +extern(C++) @system interface Interface2 { abstract void f(); } -extern(C++) class Derived2 : Base2, Interface2 +extern(C++) @system class Derived2 : Base2, Interface2 { final override void f(); @@ -1210,7 +1210,7 @@ void test15455a(X8 s) assert(s.b.d == 5); } -extern (C++) void test15455b(X8 s); +extern (C++) void test15455b(X8 s) @system; void test15455() { @@ -1228,7 +1228,7 @@ void test15455() /****************************************/ // https://issues.dlang.org/show_bug.cgi?id=15372 -extern(C++) int foo15372(T)(int v); +extern(C++) int foo15372(T)(int v) @system; void test15372() { @@ -1240,7 +1240,7 @@ void test15372() /****************************************/ // https://issues.dlang.org/show_bug.cgi?id=15802 -extern(C++) { +extern(C++) @system { template Foo15802(T) { static int boo(T v); } @@ -1268,7 +1268,7 @@ void test16536() // https://issues.dlang.org/show_bug.cgi?id=15589 // extern(C++) virtual destructors are not put in vtbl[] -extern(C++) +extern(C++) @system { class A15589 { @@ -1308,7 +1308,7 @@ void test15589() assert(A15589.dtorSeq[] == [ 20, 3, 10, 2, 1 ]); // destroyed full hierarchy! } -extern(C++) +extern(C++) @system { class Cpp15589Base { @@ -1422,14 +1422,14 @@ extern(C++) struct Small18928 int x; } -extern(C++) class CC18928 +extern(C++) @system class CC18928 { Small18928 getVirtual(); // { return S(3); } final Small18928 getFinal(); // { return S(4); } static Small18928 getStatic(); // { return S(5); } } -extern(C++) CC18928 newCC18928(); +extern(C++) CC18928 newCC18928() @system; void test18928() { @@ -1470,6 +1470,7 @@ void test18953() // https://issues.dlang.org/show_bug.cgi?id=18966 extern(C++): +@system: class Base18966 { this() @safe nothrow; @@ -1599,7 +1600,7 @@ alias std_string = std.basic_string!(char); extern(C++) void callback18955(ref const(std_string) str) { } -extern(C++) void test18955(); +extern(C++) void test18955() @system; /****************************************/ diff --git a/test/runnable_cxx/externmangle.d b/test/runnable_cxx/externmangle.d index d3d20bd63766..41f4d291c262 100644 --- a/test/runnable_cxx/externmangle.d +++ b/test/runnable_cxx/externmangle.d @@ -4,6 +4,7 @@ import core.stdc.config; import core.stdc.stdint; extern(C++): +@system: struct Foo(X) { diff --git a/test/runnable_cxx/externmangle2.d b/test/runnable_cxx/externmangle2.d index e003c959f4e2..8ce7f321321f 100644 --- a/test/runnable_cxx/externmangle2.d +++ b/test/runnable_cxx/externmangle2.d @@ -2,6 +2,7 @@ // DISABLED: win extern(C++): +@system: struct Test32NS1 { diff --git a/test/runnable_cxx/stdint.d b/test/runnable_cxx/stdint.d index e599425d20c9..43f825866cbc 100644 --- a/test/runnable_cxx/stdint.d +++ b/test/runnable_cxx/stdint.d @@ -5,6 +5,7 @@ module stdint_test; import core.stdc.stdint; extern(C++): +@system: int testCppI8Mangle (int8_t, uint8_t, int_least8_t, uint_least8_t, int_fast8_t, uint_fast8_t); int testCppI16Mangle(int16_t, uint16_t, int_least16_t, uint_least16_t, int_fast16_t, uint_fast16_t);