diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2022-02-20 20:02:23 +0100 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2022-02-20 23:37:32 +0100 |
commit | 6384eff56dba1fac071c1b525f7e49cf03f2737f (patch) | |
tree | 7263a4a6ec603a81f6df660f4f6b19a4607513fc /libphobos | |
parent | Fortran: improve check of pointer initialization in DATA statements (diff) | |
download | gcc-6384eff56dba1fac071c1b525f7e49cf03f2737f.tar.gz gcc-6384eff56dba1fac071c1b525f7e49cf03f2737f.tar.bz2 gcc-6384eff56dba1fac071c1b525f7e49cf03f2737f.tar.xz |
d: Merge upstream dmd cb49e99f8, druntime 55528bd1, phobos 1a3e80ec2.
D front-end changes:
- Import dmd v2.099.0-beta.1.
- It's now an error to use `alias this' for partial assignment.
- The `delete' keyword has been removed from the language.
- Using `this' and `super' as types has been removed from the
language, the parser no longer specially handles this wrong code
with an informative error.
D Runtime changes:
- Import druntime v2.099.0-beta.1.
Phobos changes:
- Import phobos v2.099.0-beta.1.
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd cb49e99f8.
* dmd/VERSION: Update version to v2.099.0-beta.1.
* decl.cc (layout_class_initializer): Update call to NewExp::create.
* expr.cc (ExprVisitor::visit (DeleteExp *)): Remove handling of
deleting arrays and pointers.
(ExprVisitor::visit (DotVarExp *)): Convert complex types to the
front-end library type representing them.
(ExprVisitor::visit (StringExp *)): Use getCodeUnit instead of charAt
to get the value of each index in a string expression.
* runtime.def (DELMEMORY): Remove.
(DELARRAYT): Remove.
* types.cc (TypeVisitor::visit (TypeEnum *)): Handle anonymous enums.
libphobos/ChangeLog:
* libdruntime/MERGE: Merge upstream druntime 55528bd1.
* src/MERGE: Merge upstream phobos 1a3e80ec2.
* testsuite/libphobos.hash/test_hash.d: Update.
* testsuite/libphobos.betterc/test19933.d: New test.
Diffstat (limited to 'libphobos')
45 files changed, 615 insertions, 559 deletions
diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE index 251d78de19b..49f6ae282e0 100644 --- a/libphobos/libdruntime/MERGE +++ b/libphobos/libdruntime/MERGE | |||
@@ -1,4 +1,4 @@ | |||
1 | dbd0c874a345438b8b4379a67525a933436d039a | 1 | 55528bd1e963d858eaa63901fc818b957c349fbc |
2 | 2 | ||
3 | The first line of this file holds the git revision number of the last | 3 | The first line of this file holds the git revision number of the last |
4 | merge done from the dlang/druntime repository. | 4 | merge done from the dlang/druntime repository. |
diff --git a/libphobos/libdruntime/__builtins.di b/libphobos/libdruntime/__builtins.di index cd64881529e..e5c448e00cf 100644 --- a/libphobos/libdruntime/__builtins.di +++ b/libphobos/libdruntime/__builtins.di | |||
@@ -38,3 +38,68 @@ alias __builtin_va_copy = core.stdc.stdarg.va_copy; | |||
38 | /* dmd's ImportC rewrites __builtin_va_arg into an instantiation of va_arg | 38 | /* dmd's ImportC rewrites __builtin_va_arg into an instantiation of va_arg |
39 | */ | 39 | */ |
40 | alias va_arg = core.stdc.stdarg.va_arg; | 40 | alias va_arg = core.stdc.stdarg.va_arg; |
41 | |||
42 | version (CRuntime_Microsoft) | ||
43 | { | ||
44 | //https://docs.microsoft.com/en-us/cpp/cpp/int8-int16-int32-int64?view=msvc-170 | ||
45 | alias __int8 = byte; | ||
46 | alias __int16 = short; | ||
47 | alias __int32 = int; | ||
48 | alias __int64 = long; | ||
49 | } | ||
50 | |||
51 | /*********** floating point *************/ | ||
52 | |||
53 | /* https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html | ||
54 | */ | ||
55 | |||
56 | version (DigitalMars) | ||
57 | { | ||
58 | double __builtin_inf()() { return double.infinity; } | ||
59 | float __builtin_inff()() { return float.infinity; } | ||
60 | real __builtin_infl()() { return real.infinity; } | ||
61 | |||
62 | alias __builtin_huge_val = __builtin_inf; | ||
63 | alias __builtin_huge_valf = __builtin_inff; | ||
64 | alias __builtin_huge_vall = __builtin_infl; | ||
65 | |||
66 | import core.stdc.math; | ||
67 | |||
68 | alias __builtin_fabs = core.stdc.math.fabs; | ||
69 | alias __builtin_fabsf = core.stdc.math.fabsf; | ||
70 | alias __builtin_fabsl = core.stdc.math.fabsl; | ||
71 | |||
72 | ushort __builtin_bswap16()(ushort value) | ||
73 | { | ||
74 | import core.bitop; | ||
75 | return core.bitop.byteswap(value); | ||
76 | } | ||
77 | |||
78 | uint __builtin_bswap32()(uint value) | ||
79 | { | ||
80 | import core.bitop; | ||
81 | return core.bitop.bswap(value); | ||
82 | } | ||
83 | |||
84 | ulong __builtin_bswap64()(ulong value) | ||
85 | { | ||
86 | import core.bitop; | ||
87 | return core.bitop.bswap(value); | ||
88 | } | ||
89 | |||
90 | // Stub these out to no-ops | ||
91 | int __builtin_constant_p(T)(T exp) { return 0; } // should be something like __traits(compiles, enum X = expr) | ||
92 | long __builtin_expect()(long exp, long c) { return exp; } | ||
93 | void* __builtin_assume_aligned()(const void* p, size_t align_, ...) { return cast(void*)p; } | ||
94 | |||
95 | // https://releases.llvm.org/13.0.0/tools/clang/docs/LanguageExtensions.html#builtin-assume | ||
96 | void __builtin_assume(T)(lazy T arg) { } | ||
97 | |||
98 | /* Header on macOS for arm64 references this. | ||
99 | * Don't need to implement it, it just needs to compile | ||
100 | */ | ||
101 | align (16) struct __uint128_t | ||
102 | { | ||
103 | ulong a, b; | ||
104 | } | ||
105 | } | ||
diff --git a/libphobos/libdruntime/core/attribute.d b/libphobos/libdruntime/core/attribute.d index b0b973fbfa6..69b20f0bd3c 100644 --- a/libphobos/libdruntime/core/attribute.d +++ b/libphobos/libdruntime/core/attribute.d | |||
@@ -241,3 +241,52 @@ version (UdaGNUAbiTag) struct gnuAbiTag | |||
241 | this.tags = tags; | 241 | this.tags = tags; |
242 | } | 242 | } |
243 | } | 243 | } |
244 | |||
245 | /** | ||
246 | * Use this attribute to ensure that values of a `struct` or `union` type are | ||
247 | * not discarded. | ||
248 | * | ||
249 | * The value of an expression is considered to be discarded if | ||
250 | * | ||
251 | * $(UL | ||
252 | * $(LI | ||
253 | * the expression is the top-level expression in a statement or the | ||
254 | * left-hand expression in a comma expression, and | ||
255 | * ), | ||
256 | * $(LI | ||
257 | * the expression is not an assignment (`=`, `+=`, etc.), increment | ||
258 | * (`++`), or decrement (`--`) expression. | ||
259 | * ), | ||
260 | * ) | ||
261 | * | ||
262 | * If the declaration of a `struct` or `union` type has the `@mustuse` | ||
263 | * attribute, the compiler will emit an error any time a value of that type | ||
264 | * would be discarded. | ||
265 | * | ||
266 | * Currently, `@mustuse` is only recognized by the compiler when attached to | ||
267 | * `struct` and `union` declarations. To allow for future expansion, attaching | ||
268 | * `@mustuse` to a `class`, `interface`, `enum`, or function declaration is | ||
269 | * currently forbidden, and will result in a compile-time error. All other uses | ||
270 | * of `@mustuse` are ignored. | ||
271 | * | ||
272 | * Examples: | ||
273 | * --- | ||
274 | * @mustuse struct ErrorCode { int value; } | ||
275 | * | ||
276 | * extern(C) ErrorCode doSomething(); | ||
277 | * | ||
278 | * void main() | ||
279 | * { | ||
280 | * // error: would discard a value of type ErrorCode | ||
281 | * //doSomething(); | ||
282 | * | ||
283 | * ErrorCode result; | ||
284 | * // ok: value is assigned to a variable | ||
285 | * result = doSomething(); | ||
286 | * | ||
287 | * // ok: can ignore the value explicitly with a cast | ||
288 | * cast(void) doSomething(); | ||
289 | * } | ||
290 | * --- | ||
291 | */ | ||
292 | enum mustuse; | ||
diff --git a/libphobos/libdruntime/core/bitop.d b/libphobos/libdruntime/core/bitop.d index 40f224214e3..59445f09147 100644 --- a/libphobos/libdruntime/core/bitop.d +++ b/libphobos/libdruntime/core/bitop.d | |||
@@ -758,19 +758,6 @@ version (DigitalMars) version (AnyX86) | |||
758 | } | 758 | } |
759 | 759 | ||
760 | 760 | ||
761 | // @@@DEPRECATED_2.099@@@ | ||
762 | deprecated("volatileLoad has been moved to core.volatile. Use core.volatile.volatileLoad instead.") | ||
763 | { | ||
764 | public import core.volatile : volatileLoad; | ||
765 | } | ||
766 | |||
767 | // @@@DEPRECATED_2.099@@@ | ||
768 | deprecated("volatileStore has been moved to core.volatile. Use core.volatile.volatileStore instead.") | ||
769 | { | ||
770 | public import core.volatile : volatileStore; | ||
771 | } | ||
772 | |||
773 | |||
774 | /** | 761 | /** |
775 | * Reverses the order of bits in a 32-bit integer. | 762 | * Reverses the order of bits in a 32-bit integer. |
776 | */ | 763 | */ |
diff --git a/libphobos/libdruntime/core/int128.d b/libphobos/libdruntime/core/int128.d index aad2cf23942..2f628c03138 100644 --- a/libphobos/libdruntime/core/int128.d +++ b/libphobos/libdruntime/core/int128.d | |||
@@ -801,6 +801,7 @@ unittest | |||
801 | const Cm10_0 = inc(com(C10_0)); // Cent(0, -10); | 801 | const Cm10_0 = inc(com(C10_0)); // Cent(0, -10); |
802 | const Cm10_1 = inc(com(C10_1)); // Cent(-1, -11); | 802 | const Cm10_1 = inc(com(C10_1)); // Cent(-1, -11); |
803 | const Cm10_3 = inc(com(C10_3)); // Cent(-3, -11); | 803 | const Cm10_3 = inc(com(C10_3)); // Cent(-3, -11); |
804 | const Cm20_0 = inc(com(C20_0)); // Cent(0, -20); | ||
804 | 805 | ||
805 | enum Cs_3 = Cent(3, I.min); | 806 | enum Cs_3 = Cent(3, I.min); |
806 | 807 | ||
@@ -904,6 +905,7 @@ unittest | |||
904 | assert(mul(C9_3, C10) == C90_30); | 905 | assert(mul(C9_3, C10) == C90_30); |
905 | assert(mul(Cs_3, C10) == C30); | 906 | assert(mul(Cs_3, C10) == C30); |
906 | assert(mul(Cm10, Cm10) == C100); | 907 | assert(mul(Cm10, Cm10) == C100); |
908 | assert(mul(C20_0, Cm1) == Cm20_0); | ||
907 | 909 | ||
908 | assert( or(C4_8, C3_1) == C7_9); | 910 | assert( or(C4_8, C3_1) == C7_9); |
909 | assert(and(C4_8, C7_9) == C4_8); | 911 | assert(and(C4_8, C7_9) == C4_8); |
diff --git a/libphobos/libdruntime/core/internal/array/appending.d b/libphobos/libdruntime/core/internal/array/appending.d index 1e58ddc9880..172263c684a 100644 --- a/libphobos/libdruntime/core/internal/array/appending.d +++ b/libphobos/libdruntime/core/internal/array/appending.d | |||
@@ -35,14 +35,14 @@ template _d_arrayappendcTXImpl(Tarr : T[], T) | |||
35 | * is temporarily declared `@trusted pure` until the implementation can be brought up to modern D expectations. | 35 | * is temporarily declared `@trusted pure` until the implementation can be brought up to modern D expectations. |
36 | */ | 36 | */ |
37 | static if (isCopyingNothrow!T) // `nothrow` deduction doesn't work, so this is needed | 37 | static if (isCopyingNothrow!T) // `nothrow` deduction doesn't work, so this is needed |
38 | ref Tarr _d_arrayappendcTX(return scope ref Tarr px, size_t n) @trusted pure nothrow | 38 | ref Tarr _d_arrayappendcTX(return ref scope Tarr px, size_t n) @trusted pure nothrow |
39 | { | 39 | { |
40 | pragma(inline, false); | 40 | pragma(inline, false); |
41 | 41 | ||
42 | mixin(_d_arrayappendcTXBody); | 42 | mixin(_d_arrayappendcTXBody); |
43 | } | 43 | } |
44 | else | 44 | else |
45 | ref Tarr _d_arrayappendcTX(return scope ref Tarr px, size_t n) @trusted pure nothrow | 45 | ref Tarr _d_arrayappendcTX(return ref scope Tarr px, size_t n) @trusted pure nothrow |
46 | { | 46 | { |
47 | pragma(inline, false); | 47 | pragma(inline, false); |
48 | 48 | ||
@@ -96,14 +96,14 @@ template _d_arrayappendTImpl(Tarr : T[], T) | |||
96 | * is temporarily declared `@trusted pure` until the implementation can be brought up to modern D expectations. | 96 | * is temporarily declared `@trusted pure` until the implementation can be brought up to modern D expectations. |
97 | */ | 97 | */ |
98 | static if (isCopyingNothrow!T) | 98 | static if (isCopyingNothrow!T) |
99 | ref Tarr _d_arrayappendT(return scope ref Tarr x, scope Tarr y) @trusted pure nothrow | 99 | ref Tarr _d_arrayappendT(return ref scope Tarr x, scope Tarr y) @trusted pure nothrow |
100 | { | 100 | { |
101 | pragma(inline, false); | 101 | pragma(inline, false); |
102 | 102 | ||
103 | mixin(_d_arrayappendTBody); | 103 | mixin(_d_arrayappendTBody); |
104 | } | 104 | } |
105 | else | 105 | else |
106 | ref Tarr _d_arrayappendT(return scope ref Tarr x, scope Tarr y) @trusted pure | 106 | ref Tarr _d_arrayappendT(return ref scope Tarr x, scope Tarr y) @trusted pure |
107 | { | 107 | { |
108 | pragma(inline, false); | 108 | pragma(inline, false); |
109 | 109 | ||
diff --git a/libphobos/libdruntime/core/internal/array/comparison.d b/libphobos/libdruntime/core/internal/array/comparison.d index 1a68b9b9e71..821f96e25c0 100644 --- a/libphobos/libdruntime/core/internal/array/comparison.d +++ b/libphobos/libdruntime/core/internal/array/comparison.d | |||
@@ -60,24 +60,21 @@ int __cmp(T)(scope const T[] lhs, scope const T[] rhs) @trusted | |||
60 | immutable len = lhs.length <= rhs.length ? lhs.length : rhs.length; | 60 | immutable len = lhs.length <= rhs.length ? lhs.length : rhs.length; |
61 | foreach (const u; 0 .. len) | 61 | foreach (const u; 0 .. len) |
62 | { | 62 | { |
63 | static if (__traits(isFloating, T)) | 63 | auto a = lhs.ptr[u], b = rhs.ptr[u]; |
64 | static if (is(T : creal)) | ||
64 | { | 65 | { |
65 | immutable a = lhs.ptr[u], b = rhs.ptr[u]; | 66 | // Use rt.cmath2._Ccmp instead ? |
66 | static if (is(T == cfloat) || is(T == cdouble) | 67 | // Also: if NaN is present, numbers will appear equal. |
67 | || is(T == creal)) | 68 | auto r = (a.re > b.re) - (a.re < b.re); |
68 | { | 69 | if (!r) r = (a.im > b.im) - (a.im < b.im); |
69 | // Use rt.cmath2._Ccmp instead ? | 70 | } |
70 | auto r = (a.re > b.re) - (a.re < b.re); | 71 | else |
71 | if (!r) r = (a.im > b.im) - (a.im < b.im); | 72 | { |
72 | } | 73 | // This pattern for three-way comparison is better than conditional operators |
73 | else | 74 | // See e.g. https://godbolt.org/z/3j4vh1 |
74 | { | 75 | const r = (a > b) - (a < b); |
75 | const r = (a > b) - (a < b); | ||
76 | } | ||
77 | if (r) return r; | ||
78 | } | 76 | } |
79 | else if (lhs.ptr[u] != rhs.ptr[u]) | 77 | if (r) return r; |
80 | return lhs.ptr[u] < rhs.ptr[u] ? -1 : 1; | ||
81 | } | 78 | } |
82 | return (lhs.length > rhs.length) - (lhs.length < rhs.length); | 79 | return (lhs.length > rhs.length) - (lhs.length < rhs.length); |
83 | } | 80 | } |
@@ -117,8 +114,8 @@ if (!__traits(isScalar, T1) && !__traits(isScalar, T2)) | |||
117 | } | 114 | } |
118 | else static if (__traits(compiles, at(s1, u) < at(s2, u))) | 115 | else static if (__traits(compiles, at(s1, u) < at(s2, u))) |
119 | { | 116 | { |
120 | if (at(s1, u) != at(s2, u)) | 117 | if (int result = (at(s1, u) > at(s2, u)) - (at(s1, u) < at(s2, u))) |
121 | return at(s1, u) < at(s2, u) ? -1 : 1; | 118 | return result; |
122 | } | 119 | } |
123 | else | 120 | else |
124 | { | 121 | { |
diff --git a/libphobos/libdruntime/core/internal/convert.d b/libphobos/libdruntime/core/internal/convert.d index a876fcc537f..92eb243ec1a 100644 --- a/libphobos/libdruntime/core/internal/convert.d +++ b/libphobos/libdruntime/core/internal/convert.d | |||
@@ -741,28 +741,6 @@ const(ubyte)[] toUbyte(T)(const ref scope T val) if (is(T == __vector)) | |||
741 | } | 741 | } |
742 | } | 742 | } |
743 | 743 | ||
744 | // @@@DEPRECATED_2022-02@@@ | ||
745 | deprecated | ||
746 | @trusted pure nothrow @nogc | ||
747 | const(ubyte)[] toUbyte(T)(const ref return scope T val) if (__traits(isFloating, T) && is(T : creal)) | ||
748 | { | ||
749 | if (__ctfe) | ||
750 | { | ||
751 | auto re = val.re; | ||
752 | auto im = val.im; | ||
753 | auto a = re.toUbyte(); | ||
754 | auto b = im.toUbyte(); | ||
755 | ubyte[] result = ctfe_alloc(a.length + b.length); | ||
756 | result[0 .. a.length] = a[0 .. a.length]; | ||
757 | result[a.length .. $] = b[0 .. b.length]; | ||
758 | return result; | ||
759 | } | ||
760 | else | ||
761 | { | ||
762 | return (cast(const(ubyte)*)&val)[0 .. T.sizeof]; | ||
763 | } | ||
764 | } | ||
765 | |||
766 | @trusted pure nothrow @nogc | 744 | @trusted pure nothrow @nogc |
767 | const(ubyte)[] toUbyte(T)(const ref return scope T val) if (is(T == enum)) | 745 | const(ubyte)[] toUbyte(T)(const ref return scope T val) if (is(T == enum)) |
768 | { | 746 | { |
diff --git a/libphobos/libdruntime/core/lifetime.d b/libphobos/libdruntime/core/lifetime.d index 091269ac9a1..3a7c8e02b8a 100644 --- a/libphobos/libdruntime/core/lifetime.d +++ b/libphobos/libdruntime/core/lifetime.d | |||
@@ -2646,9 +2646,9 @@ T _d_newThrowable(T, Args...)(auto ref Args args) @trusted | |||
2646 | { | 2646 | { |
2647 | debug(PRINTF) printf("_d_newThrowable(%s)\n", cast(char*) T.stringof); | 2647 | debug(PRINTF) printf("_d_newThrowable(%s)\n", cast(char*) T.stringof); |
2648 | 2648 | ||
2649 | import core.stdc.stdlib : malloc; | 2649 | import core.memory : pureMalloc; |
2650 | auto init = __traits(initSymbol, T); | 2650 | auto init = __traits(initSymbol, T); |
2651 | void* p = malloc(init.length); | 2651 | void* p = pureMalloc(init.length); |
2652 | if (!p) | 2652 | if (!p) |
2653 | { | 2653 | { |
2654 | import core.exception : onOutOfMemoryError; | 2654 | import core.exception : onOutOfMemoryError; |
diff --git a/libphobos/libdruntime/core/math.d b/libphobos/libdruntime/core/math.d index 4d46b67d2a3..30fc1308e4b 100644 --- a/libphobos/libdruntime/core/math.d +++ b/libphobos/libdruntime/core/math.d | |||
@@ -36,6 +36,7 @@ nothrow: | |||
36 | * greater than long.max, the result is | 36 | * greater than long.max, the result is |
37 | * indeterminate. | 37 | * indeterminate. |
38 | */ | 38 | */ |
39 | deprecated("rndtonl is to be removed by 2.100. Please use round instead") | ||
39 | extern (C) real rndtonl(real x); | 40 | extern (C) real rndtonl(real x); |
40 | 41 | ||
41 | pure: | 42 | pure: |
diff --git a/libphobos/libdruntime/core/runtime.d b/libphobos/libdruntime/core/runtime.d index 81d2d261a80..d1378afca91 100644 --- a/libphobos/libdruntime/core/runtime.d +++ b/libphobos/libdruntime/core/runtime.d | |||
@@ -285,7 +285,7 @@ struct Runtime | |||
285 | * an appropriate calling context from which to begin the trace. | 285 | * an appropriate calling context from which to begin the trace. |
286 | * | 286 | * |
287 | * Params: | 287 | * Params: |
288 | * h = The new trace handler. Set to null to use the default handler. | 288 | * h = The new trace handler. Set to null to disable exception backtracing. |
289 | */ | 289 | */ |
290 | extern(C) pragma(mangle, "rt_setTraceHandler") static @property void traceHandler(TraceHandler h); | 290 | extern(C) pragma(mangle, "rt_setTraceHandler") static @property void traceHandler(TraceHandler h); |
291 | 291 | ||
diff --git a/libphobos/libdruntime/core/stdc/stdio.d b/libphobos/libdruntime/core/stdc/stdio.d index c76b922a3eb..0dcdb6efc26 100644 --- a/libphobos/libdruntime/core/stdc/stdio.d +++ b/libphobos/libdruntime/core/stdc/stdio.d | |||
@@ -700,9 +700,8 @@ else version (Solaris) | |||
700 | } | 700 | } |
701 | else version (CRuntime_Bionic) | 701 | else version (CRuntime_Bionic) |
702 | { | 702 | { |
703 | import core.sys.posix.sys.types : off_t; | ||
704 | /// | 703 | /// |
705 | alias off_t fpos_t; | 704 | alias c_long fpos_t; // couldn't use off_t because of static if issue |
706 | 705 | ||
707 | /// | 706 | /// |
708 | struct __sFILE | 707 | struct __sFILE |
@@ -745,12 +744,10 @@ else version (CRuntime_UClibc) | |||
745 | import core.stdc.stddef : wchar_t; | 744 | import core.stdc.stddef : wchar_t; |
746 | import core.sys.posix.sys.types : ssize_t, pthread_mutex_t; | 745 | import core.sys.posix.sys.types : ssize_t, pthread_mutex_t; |
747 | 746 | ||
748 | alias long off_t; | ||
749 | |||
750 | /// | 747 | /// |
751 | struct fpos_t | 748 | struct fpos_t |
752 | { | 749 | { |
753 | off_t __pos; | 750 | long __pos; // couldn't use off_t because of static if issue |
754 | mbstate_t __state; | 751 | mbstate_t __state; |
755 | int __mblen_pending; | 752 | int __mblen_pending; |
756 | } | 753 | } |
@@ -759,7 +756,7 @@ else version (CRuntime_UClibc) | |||
759 | { | 756 | { |
760 | ssize_t function(void* __cookie, char* __buf, size_t __bufsize) read; | 757 | ssize_t function(void* __cookie, char* __buf, size_t __bufsize) read; |
761 | ssize_t function(void* __cookie, const char* __buf, size_t __bufsize) write; | 758 | ssize_t function(void* __cookie, const char* __buf, size_t __bufsize) write; |
762 | int function(void* __cookie, off_t* __pos, int __whence) seek; | 759 | int function(void* __cookie, long* __pos, int __whence) seek; |
763 | int function(void* __cookie) close; | 760 | int function(void* __cookie) close; |
764 | } | 761 | } |
765 | 762 | ||
@@ -900,12 +897,14 @@ else version (CRuntime_Microsoft) | |||
900 | 897 | ||
901 | extern shared void function() _fcloseallp; | 898 | extern shared void function() _fcloseallp; |
902 | 899 | ||
900 | FILE* __acrt_iob_func(int hnd); // VS2015+, reimplemented in msvc.d for VS2013- | ||
901 | |||
903 | /// | 902 | /// |
904 | shared FILE* stdin; // = &__iob_func()[0]; | 903 | FILE* stdin()() { return __acrt_iob_func(0); } |
905 | /// | 904 | /// |
906 | shared FILE* stdout; // = &__iob_func()[1]; | 905 | FILE* stdout()() { return __acrt_iob_func(1); } |
907 | /// | 906 | /// |
908 | shared FILE* stderr; // = &__iob_func()[2]; | 907 | FILE* stderr()() { return __acrt_iob_func(2); } |
909 | } | 908 | } |
910 | else version (CRuntime_Glibc) | 909 | else version (CRuntime_Glibc) |
911 | { | 910 | { |
diff --git a/libphobos/libdruntime/core/sys/linux/config.d b/libphobos/libdruntime/core/sys/linux/config.d index 03d3e17e166..5d38244f858 100644 --- a/libphobos/libdruntime/core/sys/linux/config.d +++ b/libphobos/libdruntime/core/sys/linux/config.d | |||
@@ -24,6 +24,9 @@ deprecated("use _DEFAULT_SOURCE") | |||
24 | enum _SVID_SOURCE = true; | 24 | enum _SVID_SOURCE = true; |
25 | } | 25 | } |
26 | 26 | ||
27 | deprecated("use _DEFAULT_SOURCE") | ||
27 | enum __USE_MISC = _DEFAULT_SOURCE; | 28 | enum __USE_MISC = _DEFAULT_SOURCE; |
29 | deprecated("use _ATFILE_SOURCE") | ||
28 | enum __USE_ATFILE = _ATFILE_SOURCE; | 30 | enum __USE_ATFILE = _ATFILE_SOURCE; |
31 | deprecated("use _GNU_SOURCE") | ||
29 | enum __USE_GNU = _GNU_SOURCE; | 32 | enum __USE_GNU = _GNU_SOURCE; |
diff --git a/libphobos/libdruntime/core/sys/linux/dlfcn.d b/libphobos/libdruntime/core/sys/linux/dlfcn.d index 4a122849471..fbb84627af8 100644 --- a/libphobos/libdruntime/core/sys/linux/dlfcn.d +++ b/libphobos/libdruntime/core/sys/linux/dlfcn.d | |||
@@ -34,7 +34,7 @@ import core.sys.linux.config; | |||
34 | version (X86_Any) | 34 | version (X86_Any) |
35 | { | 35 | { |
36 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h | 36 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h |
37 | static if (__USE_GNU) | 37 | static if (_GNU_SOURCE) |
38 | { | 38 | { |
39 | RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args) | 39 | RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args) |
40 | { | 40 | { |
@@ -48,7 +48,7 @@ version (X86_Any) | |||
48 | else version (HPPA_Any) | 48 | else version (HPPA_Any) |
49 | { | 49 | { |
50 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=ports/sysdeps/hppa/bits/dlfcn.h | 50 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=ports/sysdeps/hppa/bits/dlfcn.h |
51 | static if (__USE_GNU) | 51 | static if (_GNU_SOURCE) |
52 | { | 52 | { |
53 | RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args) | 53 | RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args) |
54 | { | 54 | { |
@@ -62,7 +62,7 @@ else version (HPPA_Any) | |||
62 | else version (MIPS_Any) | 62 | else version (MIPS_Any) |
63 | { | 63 | { |
64 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=ports/sysdeps/mips/bits/dlfcn.h | 64 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=ports/sysdeps/mips/bits/dlfcn.h |
65 | static if (__USE_GNU) | 65 | static if (_GNU_SOURCE) |
66 | { | 66 | { |
67 | RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args) | 67 | RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args) |
68 | { | 68 | { |
@@ -76,7 +76,7 @@ else version (MIPS_Any) | |||
76 | else version (PPC_Any) | 76 | else version (PPC_Any) |
77 | { | 77 | { |
78 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h | 78 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h |
79 | static if (__USE_GNU) | 79 | static if (_GNU_SOURCE) |
80 | { | 80 | { |
81 | RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args) | 81 | RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args) |
82 | { | 82 | { |
@@ -90,7 +90,7 @@ else version (PPC_Any) | |||
90 | else version (ARM_Any) | 90 | else version (ARM_Any) |
91 | { | 91 | { |
92 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h | 92 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h |
93 | static if (__USE_GNU) | 93 | static if (_GNU_SOURCE) |
94 | { | 94 | { |
95 | RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args) | 95 | RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args) |
96 | { | 96 | { |
@@ -104,7 +104,7 @@ else version (ARM_Any) | |||
104 | else version (RISCV_Any) | 104 | else version (RISCV_Any) |
105 | { | 105 | { |
106 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h | 106 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h |
107 | static if (__USE_GNU) | 107 | static if (_GNU_SOURCE) |
108 | { | 108 | { |
109 | RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args) | 109 | RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args) |
110 | { | 110 | { |
@@ -118,7 +118,7 @@ else version (RISCV_Any) | |||
118 | else version (SPARC_Any) | 118 | else version (SPARC_Any) |
119 | { | 119 | { |
120 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h | 120 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h |
121 | static if (__USE_GNU) | 121 | static if (_GNU_SOURCE) |
122 | { | 122 | { |
123 | RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args) | 123 | RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args) |
124 | { | 124 | { |
@@ -132,7 +132,7 @@ else version (SPARC_Any) | |||
132 | else version (IBMZ_Any) | 132 | else version (IBMZ_Any) |
133 | { | 133 | { |
134 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h | 134 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h |
135 | static if (__USE_GNU) | 135 | static if (_GNU_SOURCE) |
136 | { | 136 | { |
137 | RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args) | 137 | RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args) |
138 | { | 138 | { |
@@ -148,7 +148,7 @@ else | |||
148 | 148 | ||
149 | // <bits/dlfcn.h> | 149 | // <bits/dlfcn.h> |
150 | 150 | ||
151 | static if (__USE_GNU) | 151 | static if (_GNU_SOURCE) |
152 | { | 152 | { |
153 | enum RTLD_NEXT = cast(void *)-1L; | 153 | enum RTLD_NEXT = cast(void *)-1L; |
154 | enum RTLD_DEFAULT = cast(void *)0; | 154 | enum RTLD_DEFAULT = cast(void *)0; |
@@ -161,7 +161,7 @@ static if (__USE_GNU) | |||
161 | // int dlclose(void* __handle); // POSIX | 161 | // int dlclose(void* __handle); // POSIX |
162 | // void* dlsym(void* __handle, const scope char* __name); // POSIX | 162 | // void* dlsym(void* __handle, const scope char* __name); // POSIX |
163 | 163 | ||
164 | static if (__USE_GNU) | 164 | static if (_GNU_SOURCE) |
165 | { | 165 | { |
166 | void* dlmopen(Lmid_t __nsid, const scope char* __file, int __mode); | 166 | void* dlmopen(Lmid_t __nsid, const scope char* __file, int __mode); |
167 | void* dlvsym(void* __handle, const scope char* __name, const scope char* __version); | 167 | void* dlvsym(void* __handle, const scope char* __name, const scope char* __version); |
@@ -169,7 +169,7 @@ static if (__USE_GNU) | |||
169 | 169 | ||
170 | // char* dlerror(); // POSIX | 170 | // char* dlerror(); // POSIX |
171 | 171 | ||
172 | static if (__USE_GNU) | 172 | static if (_GNU_SOURCE) |
173 | { | 173 | { |
174 | int dladdr1(void* __address, Dl_info* __info, void** __extra_info, int __flags); | 174 | int dladdr1(void* __address, Dl_info* __info, void** __extra_info, int __flags); |
175 | 175 | ||
diff --git a/libphobos/libdruntime/core/sys/linux/errno.d b/libphobos/libdruntime/core/sys/linux/errno.d index 02ae151427e..d7a39acb932 100644 --- a/libphobos/libdruntime/core/sys/linux/errno.d +++ b/libphobos/libdruntime/core/sys/linux/errno.d | |||
@@ -13,7 +13,7 @@ nothrow: | |||
13 | public import core.stdc.errno; | 13 | public import core.stdc.errno; |
14 | import core.sys.linux.config; | 14 | import core.sys.linux.config; |
15 | 15 | ||
16 | static if (__USE_GNU) | 16 | static if (_GNU_SOURCE) |
17 | { | 17 | { |
18 | extern __gshared char* program_invocation_name, program_invocation_short_name; | 18 | extern __gshared char* program_invocation_name, program_invocation_short_name; |
19 | alias error_t = int; | 19 | alias error_t = int; |
diff --git a/libphobos/libdruntime/core/sys/linux/netinet/in_.d b/libphobos/libdruntime/core/sys/linux/netinet/in_.d index 67bf6545c8f..1b428f5aecc 100644 --- a/libphobos/libdruntime/core/sys/linux/netinet/in_.d +++ b/libphobos/libdruntime/core/sys/linux/netinet/in_.d | |||
@@ -115,7 +115,7 @@ version (linux_libc) | |||
115 | enum IN6ADDR_ANY_INIT = in6_addr.init; | 115 | enum IN6ADDR_ANY_INIT = in6_addr.init; |
116 | enum IN6ADDR_LOOPBACK_INIT = in6_addr([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]); | 116 | enum IN6ADDR_LOOPBACK_INIT = in6_addr([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]); |
117 | 117 | ||
118 | version (gnu_libc) static if (__USE_MISC) | 118 | version (gnu_libc) static if (_DEFAULT_SOURCE) |
119 | { | 119 | { |
120 | struct ip_mreq | 120 | struct ip_mreq |
121 | { | 121 | { |
@@ -174,13 +174,13 @@ version (linux_libc) | |||
174 | 174 | ||
175 | extern(D) bool IN6_ARE_ADDR_EQUAL(in6_addr* a, in6_addr* b) pure @safe { return *a == *b; } | 175 | extern(D) bool IN6_ARE_ADDR_EQUAL(in6_addr* a, in6_addr* b) pure @safe { return *a == *b; } |
176 | 176 | ||
177 | version (gnu_libc) static if (__USE_MISC) | 177 | version (gnu_libc) static if (_DEFAULT_SOURCE) |
178 | { | 178 | { |
179 | int bindresvport(int __sockfd, sockaddr_in* __sock_in); | 179 | int bindresvport(int __sockfd, sockaddr_in* __sock_in); |
180 | int bindresvport6(int __sockfd, sockaddr_in6* _); | 180 | int bindresvport6(int __sockfd, sockaddr_in6* _); |
181 | } | 181 | } |
182 | 182 | ||
183 | version (gnu_libc) static if (__USE_GNU) | 183 | version (gnu_libc) static if (_GNU_SOURCE) |
184 | { | 184 | { |
185 | struct in6_pktinfo | 185 | struct in6_pktinfo |
186 | { | 186 | { |
@@ -254,7 +254,7 @@ version (linux_libc) | |||
254 | enum IP_DROP_SOURCE_MEMBERSHIP = 40; | 254 | enum IP_DROP_SOURCE_MEMBERSHIP = 40; |
255 | enum IP_MSFILTER = 41; | 255 | enum IP_MSFILTER = 41; |
256 | 256 | ||
257 | version (gnu_libc) static if (__USE_MISC) | 257 | version (gnu_libc) static if (_DEFAULT_SOURCE) |
258 | { | 258 | { |
259 | enum MCAST_JOIN_GROUP = 42; | 259 | enum MCAST_JOIN_GROUP = 42; |
260 | enum MCAST_BLOCK_SOURCE = 43; | 260 | enum MCAST_BLOCK_SOURCE = 43; |
@@ -307,7 +307,7 @@ version (linux_libc) | |||
307 | enum IP_DEFAULT_MULTICAST_LOOP = 1; | 307 | enum IP_DEFAULT_MULTICAST_LOOP = 1; |
308 | enum IP_MAX_MEMBERSHIPS = 20; | 308 | enum IP_MAX_MEMBERSHIPS = 20; |
309 | 309 | ||
310 | version (gnu_libc) static if (__USE_MISC) | 310 | version (gnu_libc) static if (_DEFAULT_SOURCE) |
311 | { | 311 | { |
312 | struct ip_opts | 312 | struct ip_opts |
313 | { | 313 | { |
diff --git a/libphobos/libdruntime/core/sys/linux/string.d b/libphobos/libdruntime/core/sys/linux/string.d index e3c94cf6a8a..880faa4d701 100644 --- a/libphobos/libdruntime/core/sys/linux/string.d +++ b/libphobos/libdruntime/core/sys/linux/string.d | |||
@@ -16,7 +16,7 @@ nothrow: | |||
16 | @nogc: | 16 | @nogc: |
17 | @system: | 17 | @system: |
18 | 18 | ||
19 | static if (__USE_GNU) | 19 | static if (_GNU_SOURCE) |
20 | { | 20 | { |
21 | pure void* memmem(return scope const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen); | 21 | pure void* memmem(return scope const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen); |
22 | } | 22 | } |
diff --git a/libphobos/libdruntime/core/sys/linux/sys/mman.d b/libphobos/libdruntime/core/sys/linux/sys/mman.d index a6548a7802c..649e2af848f 100644 --- a/libphobos/libdruntime/core/sys/linux/sys/mman.d +++ b/libphobos/libdruntime/core/sys/linux/sys/mman.d | |||
@@ -37,7 +37,7 @@ version (PPC_Any) | |||
37 | { | 37 | { |
38 | enum PROT_SAO = 0x10; | 38 | enum PROT_SAO = 0x10; |
39 | 39 | ||
40 | static if (__USE_MISC) enum | 40 | static if (_DEFAULT_SOURCE) enum |
41 | { | 41 | { |
42 | MAP_GROWSDOWN = 0x00100, | 42 | MAP_GROWSDOWN = 0x00100, |
43 | MAP_DENYWRITE = 0x00800, | 43 | MAP_DENYWRITE = 0x00800, |
@@ -60,7 +60,7 @@ version (PPC_Any) | |||
60 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/riscv/bits/mman.h | 60 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/riscv/bits/mman.h |
61 | else version (RISCV_Any) | 61 | else version (RISCV_Any) |
62 | { | 62 | { |
63 | static if (__USE_MISC) enum | 63 | static if (_DEFAULT_SOURCE) enum |
64 | { | 64 | { |
65 | MAP_GROWSDOWN = 0x00100, | 65 | MAP_GROWSDOWN = 0x00100, |
66 | MAP_DENYWRITE = 0x00800, | 66 | MAP_DENYWRITE = 0x00800, |
@@ -85,7 +85,7 @@ else version (RISCV_Any) | |||
85 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/s390/bits/mman.h | 85 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/s390/bits/mman.h |
86 | else version (IBMZ_Any) | 86 | else version (IBMZ_Any) |
87 | { | 87 | { |
88 | static if (__USE_MISC) enum | 88 | static if (_DEFAULT_SOURCE) enum |
89 | { | 89 | { |
90 | MAP_GROWSDOWN = 0x00100, | 90 | MAP_GROWSDOWN = 0x00100, |
91 | MAP_DENYWRITE = 0x00800, | 91 | MAP_DENYWRITE = 0x00800, |
@@ -101,7 +101,7 @@ else version (IBMZ_Any) | |||
101 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sh/bits/mman.h | 101 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sh/bits/mman.h |
102 | else version (SH) | 102 | else version (SH) |
103 | { | 103 | { |
104 | static if (__USE_MISC) enum | 104 | static if (_DEFAULT_SOURCE) enum |
105 | { | 105 | { |
106 | MAP_GROWSDOWN = 0x0100, | 106 | MAP_GROWSDOWN = 0x0100, |
107 | MAP_DENYWRITE = 0x0800, | 107 | MAP_DENYWRITE = 0x0800, |
@@ -117,7 +117,7 @@ else version (SH) | |||
117 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sparc/bits/mman.h | 117 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sparc/bits/mman.h |
118 | else version (SPARC_Any) | 118 | else version (SPARC_Any) |
119 | { | 119 | { |
120 | static if (__USE_MISC) enum | 120 | static if (_DEFAULT_SOURCE) enum |
121 | { | 121 | { |
122 | MAP_GROWSDOWN = 0x0200, | 122 | MAP_GROWSDOWN = 0x0200, |
123 | MAP_DENYWRITE = 0x0800, | 123 | MAP_DENYWRITE = 0x0800, |
@@ -141,9 +141,9 @@ else version (SPARC_Any) | |||
141 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/x86/bits/mman.h | 141 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/x86/bits/mman.h |
142 | else version (X86_Any) | 142 | else version (X86_Any) |
143 | { | 143 | { |
144 | static if (__USE_MISC) enum MAP_32BIT = 0x40; | 144 | static if (_DEFAULT_SOURCE) enum MAP_32BIT = 0x40; |
145 | 145 | ||
146 | static if (__USE_MISC) enum | 146 | static if (_DEFAULT_SOURCE) enum |
147 | { | 147 | { |
148 | MAP_GROWSDOWN = 0x00100, | 148 | MAP_GROWSDOWN = 0x00100, |
149 | MAP_DENYWRITE = 0x00800, | 149 | MAP_DENYWRITE = 0x00800, |
@@ -159,7 +159,7 @@ else version (X86_Any) | |||
159 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/aarch64/bits/mman.h | 159 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/aarch64/bits/mman.h |
160 | else version (AArch64) | 160 | else version (AArch64) |
161 | { | 161 | { |
162 | static if (__USE_MISC) enum | 162 | static if (_DEFAULT_SOURCE) enum |
163 | { | 163 | { |
164 | MAP_GROWSDOWN = 0x00100, | 164 | MAP_GROWSDOWN = 0x00100, |
165 | MAP_DENYWRITE = 0x00800, | 165 | MAP_DENYWRITE = 0x00800, |
@@ -187,11 +187,11 @@ else version (Alpha) | |||
187 | 187 | ||
188 | enum MAP_SHARED = 0x01; | 188 | enum MAP_SHARED = 0x01; |
189 | enum MAP_PRIVATE = 0x02; | 189 | enum MAP_PRIVATE = 0x02; |
190 | static if (__USE_MISC) | 190 | static if (_DEFAULT_SOURCE) |
191 | enum MAP_TYPE = 0x0f; | 191 | enum MAP_TYPE = 0x0f; |
192 | 192 | ||
193 | enum MAP_FIXED = 0x10; | 193 | enum MAP_FIXED = 0x10; |
194 | static if (__USE_MISC) enum | 194 | static if (_DEFAULT_SOURCE) enum |
195 | { | 195 | { |
196 | MAP_FILE = 0, | 196 | MAP_FILE = 0, |
197 | MAP_ANONYMOUS = MAP_ANON, | 197 | MAP_ANONYMOUS = MAP_ANON, |
@@ -201,7 +201,7 @@ else version (Alpha) | |||
201 | MAP_HUGE_MASK = 0x3f, | 201 | MAP_HUGE_MASK = 0x3f, |
202 | } | 202 | } |
203 | 203 | ||
204 | static if (__USE_MISC) enum | 204 | static if (_DEFAULT_SOURCE) enum |
205 | { | 205 | { |
206 | MAP_GROWSDOWN = 0x01000, | 206 | MAP_GROWSDOWN = 0x01000, |
207 | MAP_DENYWRITE = 0x02000, | 207 | MAP_DENYWRITE = 0x02000, |
@@ -229,13 +229,13 @@ else version (Alpha) | |||
229 | // MCL_FUTURE = 16384, | 229 | // MCL_FUTURE = 16384, |
230 | // } | 230 | // } |
231 | 231 | ||
232 | static if (__USE_GNU) enum | 232 | static if (_GNU_SOURCE) enum |
233 | { | 233 | { |
234 | MREMAP_MAYMOVE = 1, | 234 | MREMAP_MAYMOVE = 1, |
235 | MREMAP_FIXED = 2, | 235 | MREMAP_FIXED = 2, |
236 | } | 236 | } |
237 | 237 | ||
238 | static if (__USE_MISC) enum | 238 | static if (_DEFAULT_SOURCE) enum |
239 | { | 239 | { |
240 | MADV_NORMAL = 0, | 240 | MADV_NORMAL = 0, |
241 | MADV_RANDOM = 1, | 241 | MADV_RANDOM = 1, |
@@ -255,7 +255,7 @@ else version (Alpha) | |||
255 | } | 255 | } |
256 | 256 | ||
257 | // in core.sys.posix.sys.mman | 257 | // in core.sys.posix.sys.mman |
258 | // static if (__USE_XOPEN2K) enum | 258 | // static if (_XOPEN_SOURCE >= 600) enum |
259 | // { | 259 | // { |
260 | // POSIX_MADV_NORMAL = 0, | 260 | // POSIX_MADV_NORMAL = 0, |
261 | // POSIX_MADV_RANDOM = 1, | 261 | // POSIX_MADV_RANDOM = 1, |
@@ -267,7 +267,7 @@ else version (Alpha) | |||
267 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/arm/bits/mman.h | 267 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/arm/bits/mman.h |
268 | else version (ARM) | 268 | else version (ARM) |
269 | { | 269 | { |
270 | static if (__USE_MISC) enum | 270 | static if (_DEFAULT_SOURCE) enum |
271 | { | 271 | { |
272 | MAP_GROWSDOWN = 0x00100, | 272 | MAP_GROWSDOWN = 0x00100, |
273 | MAP_DENYWRITE = 0x00800, | 273 | MAP_DENYWRITE = 0x00800, |
@@ -295,11 +295,11 @@ else version (HPPA_Any) | |||
295 | 295 | ||
296 | enum MAP_SHARED = 0x01; | 296 | enum MAP_SHARED = 0x01; |
297 | enum MAP_PRIVATE = 0x02; | 297 | enum MAP_PRIVATE = 0x02; |
298 | static if (__USE_MISC) | 298 | static if (_DEFAULT_SOURCE) |
299 | enum MAP_TYPE = 0x0f; | 299 | enum MAP_TYPE = 0x0f; |
300 | 300 | ||
301 | enum MAP_FIXED = 0x04; | 301 | enum MAP_FIXED = 0x04; |
302 | static if (__USE_MISC) enum | 302 | static if (_DEFAULT_SOURCE) enum |
303 | { | 303 | { |
304 | MAP_FILE = 0, | 304 | MAP_FILE = 0, |
305 | MAP_ANONYMOUS = MAP_ANON, | 305 | MAP_ANONYMOUS = MAP_ANON, |
@@ -310,7 +310,7 @@ else version (HPPA_Any) | |||
310 | MAP_HUGE_MASK = 0x3f, | 310 | MAP_HUGE_MASK = 0x3f, |
311 | } | 311 | } |
312 | 312 | ||
313 | static if (__USE_MISC) enum | 313 | static if (_DEFAULT_SOURCE) enum |
314 | { | 314 | { |
315 | MAP_DENYWRITE = 0x0800, | 315 | MAP_DENYWRITE = 0x0800, |
316 | MAP_EXECUTABLE = 0x1000, | 316 | MAP_EXECUTABLE = 0x1000, |
@@ -336,13 +336,13 @@ else version (HPPA_Any) | |||
336 | // MCL_FUTURE = 2, | 336 | // MCL_FUTURE = 2, |
337 | // } | 337 | // } |
338 | 338 | ||
339 | static if (__USE_GNU) enum | 339 | static if (_GNU_SOURCE) enum |
340 | { | 340 | { |
341 | MREMAP_MAYMOVE = 1, | 341 | MREMAP_MAYMOVE = 1, |
342 | MREMAP_FIXED = 2, | 342 | MREMAP_FIXED = 2, |
343 | } | 343 | } |
344 | 344 | ||
345 | static if (__USE_MISC) enum | 345 | static if (_DEFAULT_SOURCE) enum |
346 | { | 346 | { |
347 | MADV_NORMAL = 0, | 347 | MADV_NORMAL = 0, |
348 | MADV_RANDOM = 1, | 348 | MADV_RANDOM = 1, |
@@ -375,7 +375,7 @@ else version (HPPA_Any) | |||
375 | } | 375 | } |
376 | 376 | ||
377 | // in core.sys.posix.sys.mman | 377 | // in core.sys.posix.sys.mman |
378 | // static if (__USE_XOPEN2K) enum | 378 | // static if (_XOPEN_SOURCE >= 600) enum |
379 | // { | 379 | // { |
380 | // POSIX_MADV_NORMAL = 0, | 380 | // POSIX_MADV_NORMAL = 0, |
381 | // POSIX_MADV_RANDOM = 1, | 381 | // POSIX_MADV_RANDOM = 1, |
@@ -387,7 +387,7 @@ else version (HPPA_Any) | |||
387 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/ia64/bits/mman.h | 387 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/ia64/bits/mman.h |
388 | else version (IA64) | 388 | else version (IA64) |
389 | { | 389 | { |
390 | static if (__USE_MISC) enum | 390 | static if (_DEFAULT_SOURCE) enum |
391 | { | 391 | { |
392 | MAP_GROWSDOWN = 0x00100, | 392 | MAP_GROWSDOWN = 0x00100, |
393 | MAP_GROWSUP = 0x00200, | 393 | MAP_GROWSUP = 0x00200, |
@@ -404,7 +404,7 @@ else version (IA64) | |||
404 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/m68k/bits/mman.h | 404 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/m68k/bits/mman.h |
405 | else version (M68K) | 405 | else version (M68K) |
406 | { | 406 | { |
407 | static if (__USE_MISC) enum | 407 | static if (_DEFAULT_SOURCE) enum |
408 | { | 408 | { |
409 | MAP_GROWSDOWN = 0x00100, | 409 | MAP_GROWSDOWN = 0x00100, |
410 | MAP_DENYWRITE = 0x00800, | 410 | MAP_DENYWRITE = 0x00800, |
@@ -420,7 +420,7 @@ else version (M68K) | |||
420 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/mips/bits/mman.h | 420 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/mips/bits/mman.h |
421 | else version (MIPS_Any) | 421 | else version (MIPS_Any) |
422 | { | 422 | { |
423 | static if (__USE_MISC) enum | 423 | static if (_DEFAULT_SOURCE) enum |
424 | { | 424 | { |
425 | MAP_NORESERVE = 0x0400, | 425 | MAP_NORESERVE = 0x0400, |
426 | MAP_GROWSDOWN = 0x1000, | 426 | MAP_GROWSDOWN = 0x1000, |
@@ -460,11 +460,11 @@ else | |||
460 | 460 | ||
461 | enum MAP_SHARED = 0x01; | 461 | enum MAP_SHARED = 0x01; |
462 | enum MAP_PRIVATE = 0x02; | 462 | enum MAP_PRIVATE = 0x02; |
463 | static if (__USE_MISC) | 463 | static if (_DEFAULT_SOURCE) |
464 | enum MAP_TYPE = 0x0f; | 464 | enum MAP_TYPE = 0x0f; |
465 | 465 | ||
466 | enum MAP_FIXED = 0x10; | 466 | enum MAP_FIXED = 0x10; |
467 | static if (__USE_MISC) enum | 467 | static if (_DEFAULT_SOURCE) enum |
468 | { | 468 | { |
469 | MAP_FILE = 0, | 469 | MAP_FILE = 0, |
470 | MAP_ANONYMOUS = MAP_ANON, | 470 | MAP_ANONYMOUS = MAP_ANON, |
@@ -482,13 +482,13 @@ else | |||
482 | // MS_INVALIDATE = 2, | 482 | // MS_INVALIDATE = 2, |
483 | // } | 483 | // } |
484 | 484 | ||
485 | static if (__USE_GNU) enum | 485 | static if (_GNU_SOURCE) enum |
486 | { | 486 | { |
487 | MREMAP_MAYMOVE = 1, | 487 | MREMAP_MAYMOVE = 1, |
488 | MREMAP_FIXED = 2, | 488 | MREMAP_FIXED = 2, |
489 | } | 489 | } |
490 | 490 | ||
491 | static if (__USE_MISC) enum | 491 | static if (_DEFAULT_SOURCE) enum |
492 | { | 492 | { |
493 | MADV_NORMAL = 0, | 493 | MADV_NORMAL = 0, |
494 | MADV_RANDOM = 1, | 494 | MADV_RANDOM = 1, |
@@ -508,7 +508,7 @@ else | |||
508 | } | 508 | } |
509 | 509 | ||
510 | // in core.sys.posix.sys.mman | 510 | // in core.sys.posix.sys.mman |
511 | // static if (__USE_XOPEN2K) enum | 511 | // static if (_XOPEN_SOURCE >= 600) enum |
512 | // { | 512 | // { |
513 | // POSIX_MADV_NORMAL = 0, | 513 | // POSIX_MADV_NORMAL = 0, |
514 | // POSIX_MADV_RANDOM = 1, | 514 | // POSIX_MADV_RANDOM = 1, |
@@ -530,12 +530,12 @@ else | |||
530 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sparc/bits/mman.h | 530 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sparc/bits/mman.h |
531 | version (SPARC_Any) | 531 | version (SPARC_Any) |
532 | { | 532 | { |
533 | static if (__USE_MISC) enum MAP_RENAME = MAP_ANONYMOUS; | 533 | static if (_DEFAULT_SOURCE) enum MAP_RENAME = MAP_ANONYMOUS; |
534 | } | 534 | } |
535 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/mips/bits/mman.h | 535 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/mips/bits/mman.h |
536 | else version (MIPS_Any) | 536 | else version (MIPS_Any) |
537 | { | 537 | { |
538 | static if (__USE_MISC) enum MAP_RENAME = MAP_ANONYMOUS; | 538 | static if (_DEFAULT_SOURCE) enum MAP_RENAME = MAP_ANONYMOUS; |
539 | } | 539 | } |
540 | 540 | ||
541 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=misc/sys/mman.h | 541 | // http://sourceware.org/git/?p=glibc.git;a=blob;f=misc/sys/mman.h |
@@ -548,14 +548,14 @@ else version (MIPS_Any) | |||
548 | // int munmap(void*, size_t); | 548 | // int munmap(void*, size_t); |
549 | // int mprotect(void *__addr, size_t __len, int __prot); | 549 | // int mprotect(void *__addr, size_t __len, int __prot); |
550 | // int msync(void *__addr, size_t __len, int __flags); | 550 | // int msync(void *__addr, size_t __len, int __flags); |
551 | static if (__USE_MISC) int madvise(void *__addr, size_t __len, int __advice); | 551 | static if (_DEFAULT_SOURCE) int madvise(void *__addr, size_t __len, int __advice); |
552 | // static if (__USE_XOPEN2K) int posix_madvise(void *__addr, size_t __len, int __advice); | 552 | // static if (_XOPEN_SOURCE >= 600) int posix_madvise(void *__addr, size_t __len, int __advice); |
553 | // int mlock(const(void) *__addr, size_t __len); | 553 | // int mlock(const(void) *__addr, size_t __len); |
554 | // int munlock(const(void) *__addr, size_t __len); | 554 | // int munlock(const(void) *__addr, size_t __len); |
555 | // int mlockall(int __flags); | 555 | // int mlockall(int __flags); |
556 | // int munlockall(); | 556 | // int munlockall(); |
557 | static if (__USE_MISC) int mincore(void *__start, size_t __len, ubyte *__vec); | 557 | static if (_DEFAULT_SOURCE) int mincore(void *__start, size_t __len, ubyte *__vec); |
558 | static if (__USE_GNU) void *mremap(void *__addr, size_t __old_len, size_t __new_len, int __flags, ...); | 558 | static if (_GNU_SOURCE) void *mremap(void *__addr, size_t __old_len, size_t __new_len, int __flags, ...); |
559 | static if (__USE_GNU) int remap_file_pages(void *__start, size_t __size, int __prot, size_t __pgoff, int __flags); | 559 | static if (_GNU_SOURCE) int remap_file_pages(void *__start, size_t __size, int __prot, size_t __pgoff, int __flags); |
560 | // int shm_open(in char *__name, int __oflag, mode_t __mode); | 560 | // int shm_open(in char *__name, int __oflag, mode_t __mode); |
561 | // int shm_unlink(in char *__name); | 561 | // int shm_unlink(in char *__name); |
diff --git a/libphobos/libdruntime/core/sys/posix/aio.d b/libphobos/libdruntime/core/sys/posix/aio.d index f4e0f122d30..a76846e91df 100644 --- a/libphobos/libdruntime/core/sys/posix/aio.d +++ b/libphobos/libdruntime/core/sys/posix/aio.d | |||
@@ -99,57 +99,7 @@ else version (CRuntime_Musl) | |||
99 | } | 99 | } |
100 | else version (CRuntime_UClibc) | 100 | else version (CRuntime_UClibc) |
101 | { | 101 | { |
102 | import core.sys.posix.config; | 102 | // UClibc does not implement aiocb. |
103 | import core.sys.posix.sys.types; | ||
104 | |||
105 | struct aiocb | ||
106 | { | ||
107 | int aio_fildes; | ||
108 | int aio_lio_opcode; | ||
109 | int aio_reqprio; | ||
110 | void* aio_buf; //volatile | ||
111 | size_t aio_nbytes; | ||
112 | sigevent aio_sigevent; | ||
113 | |||
114 | aiocb* __next_prio; | ||
115 | int __abs_prio; | ||
116 | int __policy; | ||
117 | int __error_code; | ||
118 | ssize_t __return_value; | ||
119 | |||
120 | static if (__USE_LARGEFILE64) | ||
121 | { | ||
122 | off_t aio_offset; | ||
123 | ubyte[off64_t.sizeof - off_t.sizeof] __pad; | ||
124 | } | ||
125 | else | ||
126 | { | ||
127 | off64_t aio_offset; | ||
128 | } | ||
129 | ubyte[32] __unused; | ||
130 | } | ||
131 | |||
132 | static if (__USE_LARGEFILE64) | ||
133 | { | ||
134 | struct aiocb64 | ||
135 | { | ||
136 | int aio_fildes; | ||
137 | int aio_lio_opcode; | ||
138 | int aio_reqprio; | ||
139 | void* aio_buf; //volatile | ||
140 | size_t aio_nbytes; | ||
141 | sigevent aio_sigevent; | ||
142 | |||
143 | aiocb* __next_prio; | ||
144 | int __abs_prio; | ||
145 | int __policy; | ||
146 | int __error_code; | ||
147 | ssize_t __return_value; | ||
148 | |||
149 | off64_t aio_offset; | ||
150 | ubyte[32] __unused; | ||
151 | } | ||
152 | } | ||
153 | } | 103 | } |
154 | else version (Darwin) | 104 | else version (Darwin) |
155 | { | 105 | { |
@@ -272,15 +222,6 @@ else version (CRuntime_Musl) | |||
272 | AIO_ALLDONE | 222 | AIO_ALLDONE |
273 | } | 223 | } |
274 | } | 224 | } |
275 | else version (CRuntime_UClibc) | ||
276 | { | ||
277 | enum | ||
278 | { | ||
279 | AIO_CANCELED, | ||
280 | AIO_NOTCANCELED, | ||
281 | AIO_ALLDONE | ||
282 | } | ||
283 | } | ||
284 | else version (Darwin) | 225 | else version (Darwin) |
285 | { | 226 | { |
286 | enum | 227 | enum |
@@ -328,15 +269,6 @@ else version (CRuntime_Musl) | |||
328 | LIO_NOP | 269 | LIO_NOP |
329 | } | 270 | } |
330 | } | 271 | } |
331 | else version (CRuntime_UClibc) | ||
332 | { | ||
333 | enum | ||
334 | { | ||
335 | LIO_READ, | ||
336 | LIO_WRITE, | ||
337 | LIO_NOP | ||
338 | } | ||
339 | } | ||
340 | else version (Darwin) | 272 | else version (Darwin) |
341 | { | 273 | { |
342 | enum | 274 | enum |
@@ -382,14 +314,6 @@ else version (CRuntime_Musl) | |||
382 | LIO_NOWAIT | 314 | LIO_NOWAIT |
383 | } | 315 | } |
384 | } | 316 | } |
385 | else version (CRuntime_UClibc) | ||
386 | { | ||
387 | enum | ||
388 | { | ||
389 | LIO_WAIT, | ||
390 | LIO_NOWAIT | ||
391 | } | ||
392 | } | ||
393 | else version (Darwin) | 317 | else version (Darwin) |
394 | { | 318 | { |
395 | enum | 319 | enum |
@@ -456,37 +380,7 @@ else version (CRuntime_Bionic) | |||
456 | } | 380 | } |
457 | else version (CRuntime_UClibc) | 381 | else version (CRuntime_UClibc) |
458 | { | 382 | { |
459 | static if (__USE_LARGEFILE64) | 383 | // UClibc does not implement aio.h |
460 | { | ||
461 | int aio_read64(aiocb64* aiocbp); | ||
462 | int aio_write64(aiocb64* aiocbp); | ||
463 | int aio_fsync64(int op, aiocb64* aiocbp); | ||
464 | int aio_error64(const(aiocb64)* aiocbp); | ||
465 | ssize_t aio_return64(aiocb64* aiocbp); | ||
466 | int aio_suspend64(const(aiocb64*)* aiocb_list, int nitems, const(timespec)* timeout); | ||
467 | int aio_cancel64(int fd, aiocb64* aiocbp); | ||
468 | int lio_listio64(int mode, const(aiocb64*)* aiocb_list, int nitems, sigevent* sevp); | ||
469 | |||
470 | alias aio_read = aio_read64; | ||
471 | alias aio_write = aio_write64; | ||
472 | alias aio_fsync = aio_fsync64; | ||
473 | alias aio_error = aio_error64; | ||
474 | alias aio_return = aio_return64; | ||
475 | alias aio_suspend = aio_suspend64; | ||
476 | alias aio_cancel = aio_cancel64; | ||
477 | alias lio_listio = lio_listio64; | ||
478 | } | ||
479 | else | ||
480 | { | ||
481 | int aio_read(aiocb* aiocbp); | ||
482 | int aio_write(aiocb* aiocbp); | ||
483 | int aio_fsync(int op, aiocb* aiocbp); | ||
484 | int aio_error(const(aiocb)* aiocbp); | ||
485 | ssize_t aio_return(aiocb* aiocbp); | ||
486 | int aio_suspend(const(aiocb*)* aiocb_list, int nitems, const(timespec)* timeout); | ||
487 | int aio_cancel(int fd, aiocb* aiocbp); | ||
488 | int lio_listio(int mode, const(aiocb*)* aiocb_list, int nitems, sigevent* sevp); | ||
489 | } | ||
490 | } | 384 | } |
491 | else version (OpenBSD) | 385 | else version (OpenBSD) |
492 | { | 386 | { |
@@ -507,27 +401,7 @@ else | |||
507 | /* Functions outside/extending POSIX requirement. */ | 401 | /* Functions outside/extending POSIX requirement. */ |
508 | version (CRuntime_Glibc) | 402 | version (CRuntime_Glibc) |
509 | { | 403 | { |
510 | static if (__USE_GNU) | 404 | static if (_GNU_SOURCE) |
511 | { | ||
512 | /* To customize the implementation one can use the following struct. */ | ||
513 | struct aioinit | ||
514 | { | ||
515 | int aio_threads; | ||
516 | int aio_num; | ||
517 | int aio_locks; | ||
518 | int aio_usedba; | ||
519 | int aio_debug; | ||
520 | int aio_numusers; | ||
521 | int aio_idle_time; | ||
522 | int aio_reserved; | ||
523 | } | ||
524 | |||
525 | void aio_init(const(aioinit)* init); | ||
526 | } | ||
527 | } | ||
528 | else version (CRuntime_UClibc) | ||
529 | { | ||
530 | static if (__USE_GNU) | ||
531 | { | 405 | { |
532 | /* To customize the implementation one can use the following struct. */ | 406 | /* To customize the implementation one can use the following struct. */ |
533 | struct aioinit | 407 | struct aioinit |
diff --git a/libphobos/libdruntime/core/sys/posix/config.d b/libphobos/libdruntime/core/sys/posix/config.d index 3b575fa5b48..7bd07229ea5 100644 --- a/libphobos/libdruntime/core/sys/posix/config.d +++ b/libphobos/libdruntime/core/sys/posix/config.d | |||
@@ -51,14 +51,24 @@ version (CRuntime_Glibc) | |||
51 | enum __USE_LARGEFILE = __USE_FILE_OFFSET64 && !__REDIRECT; | 51 | enum __USE_LARGEFILE = __USE_FILE_OFFSET64 && !__REDIRECT; |
52 | enum __USE_LARGEFILE64 = __USE_FILE_OFFSET64 && !__REDIRECT; | 52 | enum __USE_LARGEFILE64 = __USE_FILE_OFFSET64 && !__REDIRECT; |
53 | 53 | ||
54 | enum __USE_XOPEN2K = _XOPEN_SOURCE >= 600; | 54 | deprecated("use _XOPEN_SOURCE >= 600") |
55 | enum __USE_XOPEN2KXSI = _XOPEN_SOURCE >= 600; | 55 | { |
56 | enum __USE_XOPEN2K8 = _XOPEN_SOURCE >= 700; | 56 | enum __USE_XOPEN2K = _XOPEN_SOURCE >= 600; |
57 | enum __USE_XOPEN2K8XSI = _XOPEN_SOURCE >= 700; | 57 | enum __USE_XOPEN2KXSI = _XOPEN_SOURCE >= 600; |
58 | } | ||
59 | deprecated("use _XOPEN_SOURCE >= 700") | ||
60 | { | ||
61 | enum __USE_XOPEN2K8 = _XOPEN_SOURCE >= 700; | ||
62 | enum __USE_XOPEN2K8XSI = _XOPEN_SOURCE >= 700; | ||
63 | } | ||
58 | 64 | ||
65 | deprecated("use _DEFAULT_SOURCE") | ||
59 | enum __USE_MISC = _DEFAULT_SOURCE; | 66 | enum __USE_MISC = _DEFAULT_SOURCE; |
67 | deprecated("use _ATFILE_SOURCE") | ||
60 | enum __USE_ATFILE = _ATFILE_SOURCE; | 68 | enum __USE_ATFILE = _ATFILE_SOURCE; |
69 | deprecated("use _GNU_SOURCE") | ||
61 | enum __USE_GNU = _GNU_SOURCE; | 70 | enum __USE_GNU = _GNU_SOURCE; |
71 | deprecated("use _REENTRANT") | ||
62 | enum __USE_REENTRANT = _REENTRANT; | 72 | enum __USE_REENTRANT = _REENTRANT; |
63 | 73 | ||
64 | version (D_LP64) | 74 | version (D_LP64) |
@@ -68,6 +78,10 @@ version (CRuntime_Glibc) | |||
68 | } | 78 | } |
69 | else version (CRuntime_Musl) | 79 | else version (CRuntime_Musl) |
70 | { | 80 | { |
81 | enum _GNU_SOURCE = false; | ||
82 | enum _DEFAULT_SOURCE = false; | ||
83 | enum _ATFILE_SOURCE = false; | ||
84 | |||
71 | // off_t is always 64 bits on Musl | 85 | // off_t is always 64 bits on Musl |
72 | enum _FILE_OFFSET_BITS = 64; | 86 | enum _FILE_OFFSET_BITS = 64; |
73 | 87 | ||
@@ -99,14 +113,24 @@ else version (CRuntime_UClibc) | |||
99 | enum __USE_LARGEFILE = __USE_FILE_OFFSET64 && !__REDIRECT; | 113 | enum __USE_LARGEFILE = __USE_FILE_OFFSET64 && !__REDIRECT; |
100 | enum __USE_LARGEFILE64 = __USE_FILE_OFFSET64 && !__REDIRECT; | 114 | enum __USE_LARGEFILE64 = __USE_FILE_OFFSET64 && !__REDIRECT; |
101 | 115 | ||
102 | enum __USE_XOPEN2K = _XOPEN_SOURCE >= 600; | 116 | deprecated("use _XOPEN_SOURCE >= 600") |
103 | enum __USE_XOPEN2KXSI = _XOPEN_SOURCE >= 600; | 117 | { |
104 | enum __USE_XOPEN2K8 = _XOPEN_SOURCE >= 700; | 118 | enum __USE_XOPEN2K = _XOPEN_SOURCE >= 600; |
105 | enum __USE_XOPEN2K8XSI = _XOPEN_SOURCE >= 700; | 119 | enum __USE_XOPEN2KXSI = _XOPEN_SOURCE >= 600; |
120 | } | ||
121 | deprecated("use _XOPEN_SOURCE >= 700") | ||
122 | { | ||
123 | enum __USE_XOPEN2K8 = _XOPEN_SOURCE >= 700; | ||
124 | enum __USE_XOPEN2K8XSI = _XOPEN_SOURCE >= 700; | ||
125 | } | ||
106 | 126 | ||
127 | deprecated("use _DEFAULT_SOURCE") | ||
107 | enum __USE_MISC = _DEFAULT_SOURCE; | 128 | enum __USE_MISC = _DEFAULT_SOURCE; |
129 | deprecated("use _ATFILE_SOURCE") | ||
108 | enum __USE_ATFILE = _ATFILE_SOURCE; | 130 | enum __USE_ATFILE = _ATFILE_SOURCE; |
131 | deprecated("use _GNU_SOURCE") | ||
109 | enum __USE_GNU = _GNU_SOURCE; | 132 | enum __USE_GNU = _GNU_SOURCE; |
133 | deprecated("use _REENTRANT") | ||
110 | enum __USE_REENTRANT = _REENTRANT; | 134 | enum __USE_REENTRANT = _REENTRANT; |
111 | 135 | ||
112 | version (D_LP64) | 136 | version (D_LP64) |
@@ -117,7 +141,11 @@ else version (CRuntime_UClibc) | |||
117 | else version (CRuntime_Bionic) | 141 | else version (CRuntime_Bionic) |
118 | { | 142 | { |
119 | enum _GNU_SOURCE = false; | 143 | enum _GNU_SOURCE = false; |
144 | enum _DEFAULT_SOURCE = false; | ||
145 | enum _ATFILE_SOURCE = false; | ||
146 | |||
120 | enum __USE_FILE_OFFSET64 = false; // see https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md | 147 | enum __USE_FILE_OFFSET64 = false; // see https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md |
148 | deprecated("use _GNU_SOURCE") | ||
121 | enum __USE_GNU = _GNU_SOURCE; | 149 | enum __USE_GNU = _GNU_SOURCE; |
122 | 150 | ||
123 | version (D_LP64) | 151 | version (D_LP64) |
@@ -187,10 +215,16 @@ else version (Solaris) | |||
187 | enum __USE_LARGEFILE = __USE_FILE_OFFSET64 && !__REDIRECT; | 215 | enum __USE_LARGEFILE = __USE_FILE_OFFSET64 && !__REDIRECT; |
188 | enum __USE_LARGEFILE64 = __USE_FILE_OFFSET64 && !__REDIRECT; | 216 | enum __USE_LARGEFILE64 = __USE_FILE_OFFSET64 && !__REDIRECT; |
189 | 217 | ||
190 | enum __USE_XOPEN2K = _XOPEN_SOURCE >= 600; | 218 | deprecated("use _XOPEN_SOURCE >= 600") |
191 | enum __USE_XOPEN2KXSI = _XOPEN_SOURCE >= 600; | 219 | { |
192 | enum __USE_XOPEN2K8 = _XOPEN_SOURCE >= 700; | 220 | enum __USE_XOPEN2K = _XOPEN_SOURCE >= 600; |
193 | enum __USE_XOPEN2K8XSI = _XOPEN_SOURCE >= 700; | 221 | enum __USE_XOPEN2KXSI = _XOPEN_SOURCE >= 600; |
222 | } | ||
223 | deprecated("use _XOPEN_SOURCE >= 700") | ||
224 | { | ||
225 | enum __USE_XOPEN2K8 = _XOPEN_SOURCE >= 700; | ||
226 | enum __USE_XOPEN2K8XSI = _XOPEN_SOURCE >= 700; | ||
227 | } | ||
194 | 228 | ||
195 | version (D_LP64) | 229 | version (D_LP64) |
196 | enum __WORDSIZE = 64; | 230 | enum __WORDSIZE = 64; |
diff --git a/libphobos/libdruntime/core/sys/posix/spawn.d b/libphobos/libdruntime/core/sys/posix/spawn.d index 86b17517335..cfa3a40057c 100644 --- a/libphobos/libdruntime/core/sys/posix/spawn.d +++ b/libphobos/libdruntime/core/sys/posix/spawn.d | |||
@@ -100,8 +100,8 @@ version (linux) | |||
100 | POSIX_SPAWN_SETSCHEDPARAM = 0x10, | 100 | POSIX_SPAWN_SETSCHEDPARAM = 0x10, |
101 | POSIX_SPAWN_SETSCHEDULER = 0x20 | 101 | POSIX_SPAWN_SETSCHEDULER = 0x20 |
102 | } | 102 | } |
103 | import core.sys.posix.config : __USE_GNU; | 103 | import core.sys.posix.config : _GNU_SOURCE; |
104 | static if (__USE_GNU) | 104 | static if (_GNU_SOURCE) |
105 | { | 105 | { |
106 | enum | 106 | enum |
107 | { | 107 | { |
@@ -140,8 +140,8 @@ version (linux) | |||
140 | POSIX_SPAWN_SETSCHEDPARAM = 16, | 140 | POSIX_SPAWN_SETSCHEDPARAM = 16, |
141 | POSIX_SPAWN_SETSCHEDULER = 32 | 141 | POSIX_SPAWN_SETSCHEDULER = 32 |
142 | } | 142 | } |
143 | import core.sys.posix.config : __USE_GNU; | 143 | import core.sys.posix.config : _GNU_SOURCE; |
144 | static if (__USE_GNU) | 144 | static if (_GNU_SOURCE) |
145 | { | 145 | { |
146 | enum | 146 | enum |
147 | { | 147 | { |
@@ -196,8 +196,8 @@ version (linux) | |||
196 | POSIX_SPAWN_SETSCHEDPARAM = 0x10, | 196 | POSIX_SPAWN_SETSCHEDPARAM = 0x10, |
197 | POSIX_SPAWN_SETSCHEDULER = 0x20 | 197 | POSIX_SPAWN_SETSCHEDULER = 0x20 |
198 | } | 198 | } |
199 | import core.sys.posix.config : __USE_GNU; | 199 | import core.sys.posix.config : _GNU_SOURCE; |
200 | static if (__USE_GNU) | 200 | static if (_GNU_SOURCE) |
201 | { | 201 | { |
202 | enum | 202 | enum |
203 | { | 203 | { |
diff --git a/libphobos/libdruntime/core/sys/posix/sys/ipc.d b/libphobos/libdruntime/core/sys/posix/sys/ipc.d index 18a6cbd4d53..17182438e7a 100644 --- a/libphobos/libdruntime/core/sys/posix/sys/ipc.d +++ b/libphobos/libdruntime/core/sys/posix/sys/ipc.d | |||
@@ -83,7 +83,26 @@ version (linux) | |||
83 | } | 83 | } |
84 | else version (Darwin) | 84 | else version (Darwin) |
85 | { | 85 | { |
86 | align(4) struct ipc_perm | ||
87 | { | ||
88 | uid_t uid; | ||
89 | gid_t gid; | ||
90 | uid_t cuid; | ||
91 | gid_t cgid; | ||
92 | mode_t mode; | ||
93 | ushort _seq; | ||
94 | key_t _key; | ||
95 | } | ||
96 | |||
97 | enum IPC_CREAT = 0x0200; // 01000 | ||
98 | enum IPC_EXCL = 0x0400; // 02000 | ||
99 | enum IPC_NOWAIT = 0x0800; // 04000 | ||
100 | |||
101 | enum key_t IPC_PRIVATE = 0; | ||
86 | 102 | ||
103 | enum IPC_RMID = 0; | ||
104 | enum IPC_SET = 1; | ||
105 | enum IPC_STAT = 2; | ||
87 | } | 106 | } |
88 | else version (FreeBSD) | 107 | else version (FreeBSD) |
89 | { | 108 | { |
@@ -188,6 +207,46 @@ else version (DragonFlyBSD) | |||
188 | enum IPC_SET = 1; | 207 | enum IPC_SET = 1; |
189 | enum IPC_STAT = 2; | 208 | enum IPC_STAT = 2; |
190 | } | 209 | } |
210 | else version (Solaris) | ||
211 | { | ||
212 | version (D_LP64) | ||
213 | { | ||
214 | struct ipc_perm | ||
215 | { | ||
216 | uid_t uid; | ||
217 | gid_t gid; | ||
218 | uid_t cuid; | ||
219 | gid_t cgid; | ||
220 | mode_t mode; | ||
221 | uint seq; | ||
222 | key_t key; | ||
223 | } | ||
224 | } | ||
225 | else | ||
226 | { | ||
227 | struct ipc_perm | ||
228 | { | ||
229 | uid_t uid; | ||
230 | gid_t gid; | ||
231 | uid_t cuid; | ||
232 | gid_t cgid; | ||
233 | mode_t mode; | ||
234 | uint seq; | ||
235 | key_t key; | ||
236 | int[4] pad; | ||
237 | } | ||
238 | } | ||
239 | |||
240 | enum IPC_CREAT = 0x200; | ||
241 | enum IPC_EXCL = 0x400; | ||
242 | enum IPC_NOWAIT = 0x800; | ||
243 | |||
244 | enum key_t IPC_PRIVATE = 0; | ||
245 | |||
246 | enum IPC_RMID = 10; | ||
247 | enum IPC_SET = 11; | ||
248 | enum IPC_STAT = 12; | ||
249 | } | ||
191 | else | 250 | else |
192 | { | 251 | { |
193 | static assert(false, "Unsupported platform"); | 252 | static assert(false, "Unsupported platform"); |
@@ -203,7 +262,7 @@ version (CRuntime_Glibc) | |||
203 | } | 262 | } |
204 | else version (Darwin) | 263 | else version (Darwin) |
205 | { | 264 | { |
206 | 265 | key_t ftok(const scope char*, int); | |
207 | } | 266 | } |
208 | else version (FreeBSD) | 267 | else version (FreeBSD) |
209 | { | 268 | { |
@@ -221,6 +280,10 @@ else version (DragonFlyBSD) | |||
221 | { | 280 | { |
222 | key_t ftok(const scope char*, int); | 281 | key_t ftok(const scope char*, int); |
223 | } | 282 | } |
283 | else version (Solaris) | ||
284 | { | ||
285 | key_t ftok(const scope char*, int); | ||
286 | } | ||
224 | else version (CRuntime_Bionic) | 287 | else version (CRuntime_Bionic) |
225 | { | 288 | { |
226 | key_t ftok(const scope char*, int); | 289 | key_t ftok(const scope char*, int); |
diff --git a/libphobos/libdruntime/core/sys/posix/sys/mman.d b/libphobos/libdruntime/core/sys/posix/sys/mman.d index 33ce88feb4e..430f21571ec 100644 --- a/libphobos/libdruntime/core/sys/posix/sys/mman.d +++ b/libphobos/libdruntime/core/sys/posix/sys/mman.d | |||
@@ -56,7 +56,7 @@ int posix_madvise(void*, size_t, int); | |||
56 | 56 | ||
57 | version (CRuntime_Glibc) | 57 | version (CRuntime_Glibc) |
58 | { | 58 | { |
59 | static if (__USE_XOPEN2K) | 59 | static if (_XOPEN_SOURCE >= 600) |
60 | { | 60 | { |
61 | int posix_madvise(void *__addr, size_t __len, int __advice); | 61 | int posix_madvise(void *__addr, size_t __len, int __advice); |
62 | } | 62 | } |
@@ -303,7 +303,7 @@ else version (CRuntime_Musl) | |||
303 | } | 303 | } |
304 | else version (CRuntime_UClibc) | 304 | else version (CRuntime_UClibc) |
305 | { | 305 | { |
306 | static if (__USE_LARGEFILE64) void* mmap64(void*, size_t, int, int, int, off64_t); | 306 | static if (__USE_LARGEFILE64) void* mmap64(void*, size_t, int, int, int, off_t); |
307 | static if (__USE_FILE_OFFSET64) | 307 | static if (__USE_FILE_OFFSET64) |
308 | alias mmap = mmap64; | 308 | alias mmap = mmap64; |
309 | else | 309 | else |
diff --git a/libphobos/libdruntime/core/sys/posix/sys/shm.d b/libphobos/libdruntime/core/sys/posix/sys/shm.d index ce341418f36..d04e7926913 100644 --- a/libphobos/libdruntime/core/sys/posix/sys/shm.d +++ b/libphobos/libdruntime/core/sys/posix/sys/shm.d | |||
@@ -259,6 +259,18 @@ else version (CRuntime_Musl) | |||
259 | int shmdt(const scope void*); | 259 | int shmdt(const scope void*); |
260 | int shmget(key_t, size_t, int); | 260 | int shmget(key_t, size_t, int); |
261 | } | 261 | } |
262 | else version (CRuntime_Bionic) | ||
263 | { | ||
264 | enum SHMLBA = 4096; | ||
265 | |||
266 | deprecated("Not useful on Android because it's disallowed by SELinux") | ||
267 | { | ||
268 | void* shmat(int, const scope void*, int); | ||
269 | int shmctl(int, int, shmid_ds*); | ||
270 | int shmdt(const scope void*); | ||
271 | int shmget(key_t, size_t, int); | ||
272 | } | ||
273 | } | ||
262 | else version (CRuntime_UClibc) | 274 | else version (CRuntime_UClibc) |
263 | { | 275 | { |
264 | int __getpagesize(); | 276 | int __getpagesize(); |
diff --git a/libphobos/libdruntime/core/sys/posix/sys/socket.d b/libphobos/libdruntime/core/sys/posix/sys/socket.d index 670ead73c64..c1309a68c9c 100644 --- a/libphobos/libdruntime/core/sys/posix/sys/socket.d +++ b/libphobos/libdruntime/core/sys/posix/sys/socket.d | |||
@@ -1038,9 +1038,9 @@ else version (OpenBSD) | |||
1038 | { | 1038 | { |
1039 | ubyte ss_len; | 1039 | ubyte ss_len; |
1040 | sa_family_t ss_family; | 1040 | sa_family_t ss_family; |
1041 | byte[6] __ss_pad1; | 1041 | ubyte[6] __ss_pad1; |
1042 | long __ss_align; | 1042 | long __ss_align; |
1043 | byte[240] __ss_pad2; | 1043 | ubyte[240] __ss_pad2; |
1044 | } | 1044 | } |
1045 | 1045 | ||
1046 | struct msghdr | 1046 | struct msghdr |
@@ -1063,20 +1063,25 @@ else version (OpenBSD) | |||
1063 | 1063 | ||
1064 | enum : uint | 1064 | enum : uint |
1065 | { | 1065 | { |
1066 | SCM_RIGHTS = 0x01 | 1066 | SCM_RIGHTS = 0x01, |
1067 | SCM_TIMESTAMP = 0x04 | ||
1067 | } | 1068 | } |
1068 | 1069 | ||
1069 | private // <sys/_types.h> | 1070 | private // <sys/_types.h> |
1070 | { | 1071 | { |
1071 | extern (D) size_t _ALIGN(size_t p) { return (p + _ALIGNBYTES) & ~_ALIGNBYTES; } | 1072 | enum _ALIGNBYTES = c_long.sizeof - 1; |
1073 | extern (D) size_t _ALIGN(size_t p) pure nothrow @nogc | ||
1074 | { | ||
1075 | return (p + _ALIGNBYTES) & ~_ALIGNBYTES; | ||
1076 | } | ||
1072 | } | 1077 | } |
1073 | 1078 | ||
1074 | extern (D) ubyte* CMSG_DATA(cmsghdr* cmsg) | 1079 | extern (D) ubyte* CMSG_DATA(cmsghdr* cmsg) pure nothrow @nogc |
1075 | { | 1080 | { |
1076 | return cast(ubyte*) cmsg + _ALIGN(cmsghdr.sizeof); | 1081 | return cast(ubyte*) cmsg + _ALIGN(cmsghdr.sizeof); |
1077 | } | 1082 | } |
1078 | 1083 | ||
1079 | extern (D) cmsghdr* CMSG_NXTHDR(msghdr* mhdr, cmsghdr* cmsg) | 1084 | extern (D) cmsghdr* CMSG_NXTHDR(msghdr* mhdr, cmsghdr* cmsg) pure nothrow @nogc |
1080 | { | 1085 | { |
1081 | if (cast(ubyte*) cmsg + _ALIGN(cmsg.cmsg_len) + _ALIGN(cmsghdr.sizeof) > | 1086 | if (cast(ubyte*) cmsg + _ALIGN(cmsg.cmsg_len) + _ALIGN(cmsghdr.sizeof) > |
1082 | cast(ubyte*) mhdr.msg_control + mhdr.msg_controllen) | 1087 | cast(ubyte*) mhdr.msg_control + mhdr.msg_controllen) |
@@ -1085,11 +1090,24 @@ else version (OpenBSD) | |||
1085 | return cast(cmsghdr*) (cast(ubyte*) cmsg + _ALIGN(cmsg.cmsg_len)); | 1090 | return cast(cmsghdr*) (cast(ubyte*) cmsg + _ALIGN(cmsg.cmsg_len)); |
1086 | } | 1091 | } |
1087 | 1092 | ||
1088 | extern (D) cmsghdr* CMSG_FIRSTHDR(msghdr* mhdr) | 1093 | extern (D) cmsghdr* CMSG_FIRSTHDR(msghdr* mhdr) pure nothrow @nogc |
1089 | { | 1094 | { |
1090 | return mhdr.msg_controllen >= cmsghdr.sizeof ? cast(cmsghdr*) mhdr.msg_control : null; | 1095 | return mhdr.msg_controllen >= cmsghdr.sizeof ? cast(cmsghdr*) mhdr.msg_control : null; |
1091 | } | 1096 | } |
1092 | 1097 | ||
1098 | extern (D) | ||
1099 | { | ||
1100 | size_t CMSG_LEN(size_t len) pure nothrow @nogc | ||
1101 | { | ||
1102 | return _ALIGN(cmsghdr.sizeof) + len; | ||
1103 | } | ||
1104 | } | ||
1105 | |||
1106 | extern (D) size_t CMSG_SPACE(size_t len) pure nothrow @nogc | ||
1107 | { | ||
1108 | return _ALIGN(cmsghdr.sizeof) + _ALIGN(len); | ||
1109 | } | ||
1110 | |||
1093 | struct linger | 1111 | struct linger |
1094 | { | 1112 | { |
1095 | int l_onoff; | 1113 | int l_onoff; |
diff --git a/libphobos/libdruntime/core/sys/posix/sys/stat.d b/libphobos/libdruntime/core/sys/posix/sys/stat.d index 51455a98e6f..22f4df66455 100644 --- a/libphobos/libdruntime/core/sys/posix/sys/stat.d +++ b/libphobos/libdruntime/core/sys/posix/sys/stat.d | |||
@@ -89,7 +89,7 @@ version (linux) | |||
89 | off_t st_size; | 89 | off_t st_size; |
90 | blksize_t st_blksize; | 90 | blksize_t st_blksize; |
91 | blkcnt_t st_blocks; | 91 | blkcnt_t st_blocks; |
92 | static if (__USE_MISC || __USE_XOPEN2K8) | 92 | static if (_DEFAULT_SOURCE || _XOPEN_SOURCE >= 700) |
93 | { | 93 | { |
94 | timespec st_atim; | 94 | timespec st_atim; |
95 | timespec st_mtim; | 95 | timespec st_mtim; |
@@ -136,7 +136,7 @@ version (linux) | |||
136 | off_t st_size; | 136 | off_t st_size; |
137 | blksize_t st_blksize; | 137 | blksize_t st_blksize; |
138 | blkcnt_t st_blocks; | 138 | blkcnt_t st_blocks; |
139 | static if (__USE_MISC || __USE_XOPEN2K8) | 139 | static if (_DEFAULT_SOURCE || _XOPEN_SOURCE >= 700) |
140 | { | 140 | { |
141 | timespec st_atim; | 141 | timespec st_atim; |
142 | timespec st_mtim; | 142 | timespec st_mtim; |
@@ -218,7 +218,7 @@ version (linux) | |||
218 | __blkcnt64_t st_blocks; | 218 | __blkcnt64_t st_blocks; |
219 | } | 219 | } |
220 | 220 | ||
221 | static if ( __USE_MISC || __USE_XOPEN2K8) | 221 | static if ( _DEFAULT_SOURCE || _XOPEN_SOURCE >= 700) |
222 | { | 222 | { |
223 | __timespec st_atim; | 223 | __timespec st_atim; |
224 | __timespec st_mtim; | 224 | __timespec st_mtim; |
@@ -278,7 +278,7 @@ version (linux) | |||
278 | c_long[3] st_pad2; | 278 | c_long[3] st_pad2; |
279 | off_t st_size; | 279 | off_t st_size; |
280 | } | 280 | } |
281 | static if (__USE_MISC || __USE_XOPEN2K8) | 281 | static if (_DEFAULT_SOURCE || _XOPEN_SOURCE >= 700) |
282 | { | 282 | { |
283 | timespec st_atim; | 283 | timespec st_atim; |
284 | timespec st_mtim; | 284 | timespec st_mtim; |
@@ -339,7 +339,7 @@ version (linux) | |||
339 | uint[3] st_pad2; | 339 | uint[3] st_pad2; |
340 | off_t st_size; | 340 | off_t st_size; |
341 | } | 341 | } |
342 | static if (__USE_MISC || __USE_XOPEN2K8) | 342 | static if (_DEFAULT_SOURCE || _XOPEN_SOURCE >= 700) |
343 | { | 343 | { |
344 | timespec st_atim; | 344 | timespec st_atim; |
345 | timespec st_mtim; | 345 | timespec st_mtim; |
@@ -491,7 +491,7 @@ version (linux) | |||
491 | __blkcnt_t st_blocks; | 491 | __blkcnt_t st_blocks; |
492 | } | 492 | } |
493 | 493 | ||
494 | static if (__USE_MISC) | 494 | static if (_DEFAULT_SOURCE) |
495 | { | 495 | { |
496 | __timespec st_atim; | 496 | __timespec st_atim; |
497 | __timespec st_mtim; | 497 | __timespec st_mtim; |
@@ -573,7 +573,7 @@ version (linux) | |||
573 | __blkcnt64_t st_blocks; | 573 | __blkcnt64_t st_blocks; |
574 | } | 574 | } |
575 | 575 | ||
576 | static if ( __USE_MISC || __USE_XOPEN2K8) | 576 | static if ( _DEFAULT_SOURCE || _XOPEN_SOURCE >= 700) |
577 | { | 577 | { |
578 | __timespec st_atim; | 578 | __timespec st_atim; |
579 | __timespec st_mtim; | 579 | __timespec st_mtim; |
@@ -668,7 +668,7 @@ version (linux) | |||
668 | __blkcnt64_t st_blocks; | 668 | __blkcnt64_t st_blocks; |
669 | } | 669 | } |
670 | 670 | ||
671 | static if (__USE_MISC) | 671 | static if (_DEFAULT_SOURCE) |
672 | { | 672 | { |
673 | __timespec st_atim; | 673 | __timespec st_atim; |
674 | __timespec st_mtim; | 674 | __timespec st_mtim; |
@@ -753,7 +753,7 @@ version (linux) | |||
753 | __blkcnt64_t st_blocks; | 753 | __blkcnt64_t st_blocks; |
754 | } | 754 | } |
755 | 755 | ||
756 | static if (__USE_XOPEN2K8) | 756 | static if (_XOPEN_SOURCE >= 700) |
757 | { | 757 | { |
758 | __timespec st_atim; | 758 | __timespec st_atim; |
759 | __timespec st_mtim; | 759 | __timespec st_mtim; |
@@ -830,7 +830,7 @@ version (linux) | |||
830 | __blkcnt_t st_blocks; | 830 | __blkcnt_t st_blocks; |
831 | else | 831 | else |
832 | __blkcnt64_t st_blocks; | 832 | __blkcnt64_t st_blocks; |
833 | static if (__USE_XOPEN2K8) | 833 | static if (_XOPEN_SOURCE >= 700) |
834 | { | 834 | { |
835 | __timespec st_atim; | 835 | __timespec st_atim; |
836 | __timespec st_mtim; | 836 | __timespec st_mtim; |
@@ -894,7 +894,7 @@ version (linux) | |||
894 | int __glibc_reserved0; | 894 | int __glibc_reserved0; |
895 | __dev_t st_rdev; | 895 | __dev_t st_rdev; |
896 | __off_t st_size; | 896 | __off_t st_size; |
897 | static if (__USE_XOPEN2K8) | 897 | static if (_XOPEN_SOURCE >= 700) |
898 | { | 898 | { |
899 | __timespec st_atim; | 899 | __timespec st_atim; |
900 | __timespec st_mtim; | 900 | __timespec st_mtim; |
@@ -919,7 +919,7 @@ version (linux) | |||
919 | __blkcnt_t st_blocks; | 919 | __blkcnt_t st_blocks; |
920 | c_long[3] __glibc_reserved; | 920 | c_long[3] __glibc_reserved; |
921 | } | 921 | } |
922 | static if (__USE_XOPEN2K8) | 922 | static if (_XOPEN_SOURCE >= 700) |
923 | static assert(stat_t.sizeof == 144); | 923 | static assert(stat_t.sizeof == 144); |
924 | else | 924 | else |
925 | static assert(stat_t.sizeof == 144); | 925 | static assert(stat_t.sizeof == 144); |
diff --git a/libphobos/libdruntime/core/sys/posix/sys/statvfs.d b/libphobos/libdruntime/core/sys/posix/sys/statvfs.d index 49c84508b9a..df9030d6e5b 100644 --- a/libphobos/libdruntime/core/sys/posix/sys/statvfs.d +++ b/libphobos/libdruntime/core/sys/posix/sys/statvfs.d | |||
@@ -44,7 +44,7 @@ version (CRuntime_Glibc) { | |||
44 | } | 44 | } |
45 | /* Definitions for the flag in `f_flag'. These definitions should be | 45 | /* Definitions for the flag in `f_flag'. These definitions should be |
46 | kept in sync with the definitions in <sys/mount.h>. */ | 46 | kept in sync with the definitions in <sys/mount.h>. */ |
47 | static if (__USE_GNU) | 47 | static if (_GNU_SOURCE) |
48 | { | 48 | { |
49 | enum FFlag | 49 | enum FFlag |
50 | { | 50 | { |
diff --git a/libphobos/libdruntime/core/sys/posix/sys/types.d b/libphobos/libdruntime/core/sys/posix/sys/types.d index 02cf799ff27..ec229dd3b2b 100644 --- a/libphobos/libdruntime/core/sys/posix/sys/types.d +++ b/libphobos/libdruntime/core/sys/posix/sys/types.d | |||
@@ -322,7 +322,7 @@ else version (Darwin) | |||
322 | alias uint fsfilcnt_t; | 322 | alias uint fsfilcnt_t; |
323 | alias c_long clock_t; | 323 | alias c_long clock_t; |
324 | alias uint id_t; | 324 | alias uint id_t; |
325 | // key_t | 325 | alias int key_t; |
326 | alias int suseconds_t; | 326 | alias int suseconds_t; |
327 | alias uint useconds_t; | 327 | alias uint useconds_t; |
328 | } | 328 | } |
diff --git a/libphobos/libdruntime/object.d b/libphobos/libdruntime/object.d index 7bb6bec7ed9..cf7cf967aa6 100644 --- a/libphobos/libdruntime/object.d +++ b/libphobos/libdruntime/object.d | |||
@@ -1885,8 +1885,8 @@ class TypeInfo_Struct : TypeInfo | |||
1885 | return false; | 1885 | return false; |
1886 | else if (xopEquals) | 1886 | else if (xopEquals) |
1887 | { | 1887 | { |
1888 | const dg = _memberFunc(p2, xopEquals); | 1888 | const dg = _memberFunc(p1, xopEquals); |
1889 | return dg.xopEquals(p1); | 1889 | return dg.xopEquals(p2); |
1890 | } | 1890 | } |
1891 | else if (p1 == p2) | 1891 | else if (p1 == p2) |
1892 | return true; | 1892 | return true; |
diff --git a/libphobos/libdruntime/rt/util/typeinfo.d b/libphobos/libdruntime/rt/util/typeinfo.d index 26c24c4c8f0..7b55693a720 100644 --- a/libphobos/libdruntime/rt/util/typeinfo.d +++ b/libphobos/libdruntime/rt/util/typeinfo.d | |||
@@ -1,8 +1,8 @@ | |||
1 | /** | 1 | /** |
2 | * This module contains utilities for TypeInfo implementation. | 2 | * A few predefined implementations for primitive types and arrays thereof. Also a couple of helpers. |
3 | * | 3 | * |
4 | * Copyright: Copyright Kenji Hara 2014-. | 4 | * Copyright: Copyright Kenji Hara 2014-. |
5 | * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. | 5 | * License: <a href="https://boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. |
6 | * Authors: Kenji Hara | 6 | * Authors: Kenji Hara |
7 | * Source: $(DRUNTIMESRC rt/util/_typeinfo.d) | 7 | * Source: $(DRUNTIMESRC rt/util/_typeinfo.d) |
8 | */ | 8 | */ |
@@ -10,100 +10,74 @@ module rt.util.typeinfo; | |||
10 | import rt.util.utility : d_cfloat, d_cdouble, d_creal, isComplex; | 10 | import rt.util.utility : d_cfloat, d_cdouble, d_creal, isComplex; |
11 | static import core.internal.hash; | 11 | static import core.internal.hash; |
12 | 12 | ||
13 | template Floating(T) | 13 | // Three-way compare for integrals: negative if `lhs < rhs`, positive if `lhs > rhs`, 0 otherwise. |
14 | if (is(T == float) || is(T == double) || is(T == real)) | 14 | pragma(inline, true) |
15 | private int cmp3(T)(const T lhs, const T rhs) | ||
16 | if (__traits(isIntegral, T)) | ||
15 | { | 17 | { |
16 | pure nothrow @safe: | 18 | static if (T.sizeof < int.sizeof) |
17 | 19 | // Taking the difference will always fit in an int. | |
18 | bool equals(T f1, T f2) | 20 | return int(lhs) - int(rhs); |
19 | { | 21 | else |
20 | return f1 == f2; | 22 | return (lhs > rhs) - (lhs < rhs); |
21 | } | 23 | } |
22 | |||
23 | int compare(T d1, T d2) | ||
24 | { | ||
25 | if (d1 != d1 || d2 != d2) // if either are NaN | ||
26 | { | ||
27 | if (d1 != d1) | ||
28 | { | ||
29 | if (d2 != d2) | ||
30 | return 0; | ||
31 | return -1; | ||
32 | } | ||
33 | return 1; | ||
34 | } | ||
35 | return (d1 == d2) ? 0 : ((d1 < d2) ? -1 : 1); | ||
36 | } | ||
37 | 24 | ||
38 | public alias hashOf = core.internal.hash.hashOf; | 25 | // Three-way compare for real fp types. NaN is smaller than all valid numbers. |
26 | // Code is small and fast, see https://godbolt.org/z/fzb877 | ||
27 | pragma(inline, true) | ||
28 | private int cmp3(T)(const T d1, const T d2) | ||
29 | if (is(T == float) || is(T == double) || is(T == real)) | ||
30 | { | ||
31 | if (d2 != d2) | ||
32 | return d1 == d1; // 0 if both ar NaN, 1 if d1 is valid and d2 is NaN. | ||
33 | // If d1 is NaN, both comparisons are false so we get -1, as needed. | ||
34 | return (d1 > d2) - !(d1 >= d2); | ||
39 | } | 35 | } |
40 | 36 | ||
41 | // @@@DEPRECATED_2.105@@@ | 37 | // Three-way compare for complex types. |
42 | template Floating(T) | 38 | pragma(inline, true) |
39 | private int cmp3(T)(const T f1, const T f2) | ||
43 | if (isComplex!T) | 40 | if (isComplex!T) |
44 | { | 41 | { |
45 | pure nothrow @safe: | 42 | if (int result = cmp3(f1.re, f2.re)) |
46 | |||
47 | bool equals(T f1, T f2) | ||
48 | { | ||
49 | return f1.re == f2.re && f1.im == f2.im; | ||
50 | } | ||
51 | |||
52 | int compare(T f1, T f2) | ||
53 | { | ||
54 | int result; | ||
55 | |||
56 | if (f1.re < f2.re) | ||
57 | result = -1; | ||
58 | else if (f1.re > f2.re) | ||
59 | result = 1; | ||
60 | else if (f1.im < f2.im) | ||
61 | result = -1; | ||
62 | else if (f1.im > f2.im) | ||
63 | result = 1; | ||
64 | else | ||
65 | result = 0; | ||
66 | return result; | 43 | return result; |
67 | } | 44 | return cmp3(f1.im, f2.im); |
68 | |||
69 | size_t hashOf(scope const T val) | ||
70 | { | ||
71 | return core.internal.hash.hashOf(val.re, core.internal.hash.hashOf(val.im)); | ||
72 | } | ||
73 | } | 45 | } |
74 | 46 | ||
75 | template Array(T) | 47 | unittest |
76 | if (is(T == float) || is(T == double) || is(T == real)) | ||
77 | { | 48 | { |
78 | pure nothrow @safe: | 49 | assert(cmp3(short.max, short.min) > 0); |
79 | 50 | assert(cmp3(42, 42) == 0); | |
80 | bool equals(T[] s1, T[] s2) | 51 | assert(cmp3(int.max, int.min) > 0); |
81 | { | 52 | |
82 | size_t len = s1.length; | 53 | double x, y; |
83 | if (len != s2.length) | 54 | assert(cmp3(x, y) == 0); |
84 | return false; | 55 | assert(cmp3(y, x) == 0); |
85 | for (size_t u = 0; u < len; u++) | 56 | x = 42; |
86 | { | 57 | assert(cmp3(x, y) > 0); |
87 | if (!Floating!T.equals(s1[u], s2[u])) | 58 | assert(cmp3(y, x) < 0); |
88 | return false; | 59 | y = 43; |
89 | } | 60 | assert(cmp3(x, y) < 0); |
90 | return true; | 61 | assert(cmp3(y, x) > 0); |
91 | } | 62 | y = 42; |
92 | 63 | assert(cmp3(x, y) == 0); | |
93 | int compare(T[] s1, T[] s2) | 64 | assert(cmp3(y, x) == 0); |
94 | { | 65 | |
95 | size_t len = s1.length; | 66 | d_cdouble u, v; |
96 | if (s2.length < len) | 67 | assert(cmp3(u, v) == 0); |
97 | len = s2.length; | 68 | assert(cmp3(v, u) == 0); |
98 | for (size_t u = 0; u < len; u++) | 69 | u = d_cdouble(42, 42); |
99 | { | 70 | assert(cmp3(u, v) > 0); |
100 | if (int c = Floating!T.compare(s1[u], s2[u])) | 71 | assert(cmp3(v, u) < 0); |
101 | return c; | 72 | v = d_cdouble(43, 42); |
102 | } | 73 | assert(cmp3(u, v) < 0); |
103 | return (s1.length > s2.length) - (s1.length < s2.length); | 74 | assert(cmp3(v, u) > 0); |
104 | } | 75 | v = d_cdouble(42, 43); |
105 | 76 | assert(cmp3(u, v) < 0); | |
106 | public alias hashOf = core.internal.hash.hashOf; | 77 | assert(cmp3(v, u) > 0); |
78 | v = d_cdouble(42, 42); | ||
79 | assert(cmp3(u, v) == 0); | ||
80 | assert(cmp3(v, u) == 0); | ||
107 | } | 81 | } |
108 | 82 | ||
109 | // @@@DEPRECATED_2.105@@@ | 83 | // @@@DEPRECATED_2.105@@@ |
@@ -209,7 +183,7 @@ unittest | |||
209 | }(); | 183 | }(); |
210 | } | 184 | } |
211 | 185 | ||
212 | // Reduces to `T` if `cond` is `true` or `U` otherwise. | 186 | // Reduces to `T` if `cond` is `true` or `U` otherwise. Consider moving elsewhere if useful. |
213 | private template Select(bool cond, T, U) | 187 | private template Select(bool cond, T, U) |
214 | { | 188 | { |
215 | static if (cond) alias Select = T; | 189 | static if (cond) alias Select = T; |
@@ -238,57 +212,38 @@ if (T.sizeof == Base.sizeof && T.alignof == Base.alignof) | |||
238 | static if (is(T == Base)) | 212 | static if (is(T == Base)) |
239 | override size_t getHash(scope const void* p) | 213 | override size_t getHash(scope const void* p) |
240 | { | 214 | { |
241 | static if (__traits(isFloating, T) || isComplex!T) | 215 | return hashOf(*cast(const T *)p); |
242 | return Floating!T.hashOf(*cast(T*)p); | ||
243 | else | ||
244 | return hashOf(*cast(const T *)p); | ||
245 | } | 216 | } |
246 | 217 | ||
247 | // `equals` is the same for `Base` and `T`, introduce it just once. | 218 | // `equals` is the same for `Base` and `T`, introduce it just once. |
248 | static if (is(T == Base)) | 219 | static if (is(T == Base)) |
249 | override bool equals(in void* p1, in void* p2) | 220 | override bool equals(in void* p1, in void* p2) |
250 | { | 221 | { |
251 | static if (__traits(isFloating, T) || isComplex!T) | 222 | return *cast(const T *)p1 == *cast(const T *)p2; |
252 | return Floating!T.equals(*cast(T*)p1, *cast(T*)p2); | ||
253 | else | ||
254 | return *cast(T *)p1 == *cast(T *)p2; | ||
255 | } | 223 | } |
256 | 224 | ||
257 | // `T` and `Base` may have different signedness, so this function is introduced conditionally. | 225 | // `T` and `Base` may have different signedness, so this function is introduced conditionally. |
258 | static if (is(T == Base) || (__traits(isIntegral, T) && T.max != Base.max)) | 226 | static if (is(T == Base) || (__traits(isIntegral, T) && T.max != Base.max)) |
259 | override int compare(in void* p1, in void* p2) | 227 | override int compare(in void* p1, in void* p2) |
260 | { | 228 | { |
261 | static if (__traits(isFloating, T) || isComplex!T) | 229 | return cmp3(*cast(const T*) p1, *cast(const T*) p2); |
262 | { | ||
263 | return Floating!T.compare(*cast(T*)p1, *cast(T*)p2); | ||
264 | } | ||
265 | else static if (T.sizeof < int.sizeof) | ||
266 | { | ||
267 | // Taking the difference will always fit in an int. | ||
268 | return int(*cast(T *) p1) - int(*cast(T *) p2); | ||
269 | } | ||
270 | else | ||
271 | { | ||
272 | auto lhs = *cast(T *) p1, rhs = *cast(T *) p2; | ||
273 | return (lhs > rhs) - (lhs < rhs); | ||
274 | } | ||
275 | } | 230 | } |
276 | 231 | ||
277 | static if (is(T == Base)) | 232 | static if (is(T == Base)) |
278 | override @property size_t tsize() nothrow pure | 233 | override @property size_t tsize() |
279 | { | 234 | { |
280 | return T.sizeof; | 235 | return T.sizeof; |
281 | } | 236 | } |
282 | 237 | ||
283 | static if (is(T == Base)) | 238 | static if (is(T == Base)) |
284 | override @property size_t talign() nothrow pure | 239 | override @property size_t talign() |
285 | { | 240 | { |
286 | return T.alignof; | 241 | return T.alignof; |
287 | } | 242 | } |
288 | 243 | ||
289 | // Override initializer only if necessary. | 244 | // Override initializer only if necessary. |
290 | static if (is(T == Base) || T.init != Base.init) | 245 | static if (is(T == Base) || T.init != Base.init) |
291 | override const(void)[] initializer() @trusted | 246 | override const(void)[] initializer() |
292 | { | 247 | { |
293 | static if (__traits(isZeroInit, T)) | 248 | static if (__traits(isZeroInit, T)) |
294 | { | 249 | { |
@@ -311,7 +266,7 @@ if (T.sizeof == Base.sizeof && T.alignof == Base.alignof) | |||
311 | } | 266 | } |
312 | 267 | ||
313 | static if (is(T == Base) || RTInfo!T != RTInfo!Base) | 268 | static if (is(T == Base) || RTInfo!T != RTInfo!Base) |
314 | override @property immutable(void)* rtInfo() nothrow pure const @safe | 269 | override @property immutable(void)* rtInfo() |
315 | { | 270 | { |
316 | return RTInfo!T; | 271 | return RTInfo!T; |
317 | } | 272 | } |
@@ -377,52 +332,33 @@ private class TypeInfoArrayGeneric(T, Base = T) : Select!(is(T == Base), TypeInf | |||
377 | static if (is(T == Base)) | 332 | static if (is(T == Base)) |
378 | override size_t getHash(scope const void* p) @trusted const | 333 | override size_t getHash(scope const void* p) @trusted const |
379 | { | 334 | { |
380 | static if (__traits(isFloating, T) || isComplex!T) | 335 | return hashOf(*cast(const T[]*) p); |
381 | return Array!T.hashOf(*cast(T[]*)p); | ||
382 | else | ||
383 | return hashOf(*cast(const T[]*) p); | ||
384 | } | 336 | } |
385 | 337 | ||
386 | static if (is(T == Base)) | 338 | static if (is(T == Base)) |
387 | override bool equals(in void* p1, in void* p2) const | 339 | override bool equals(in void* p1, in void* p2) const |
388 | { | 340 | { |
389 | static if (__traits(isFloating, T) || isComplex!T) | 341 | // Just reuse the builtin. |
390 | { | 342 | return *cast(const(T)[]*) p1 == *cast(const(T)[]*) p2; |
391 | return Array!T.equals(*cast(T[]*)p1, *cast(T[]*)p2); | ||
392 | } | ||
393 | else | ||
394 | { | ||
395 | import core.stdc.string; | ||
396 | auto s1 = *cast(T[]*)p1; | ||
397 | auto s2 = *cast(T[]*)p2; | ||
398 | return s1.length == s2.length && | ||
399 | memcmp(s1.ptr, s2.ptr, s1.length) == 0; | ||
400 | } | ||
401 | } | 343 | } |
402 | 344 | ||
403 | static if (is(T == Base) || (__traits(isIntegral, T) && T.max != Base.max)) | 345 | static if (is(T == Base) || (__traits(isIntegral, T) && T.max != Base.max)) |
404 | override int compare(in void* p1, in void* p2) const | 346 | override int compare(in void* p1, in void* p2) const |
405 | { | 347 | { |
406 | static if (__traits(isFloating, T) || isComplex!T) | 348 | // Can't reuse __cmp in object.d because that handles NaN differently. |
407 | { | 349 | // (Q: would it make sense to unify behaviors?) |
408 | return Array!T.compare(*cast(T[]*)p1, *cast(T[]*)p2); | 350 | // return __cmp(*cast(const T[]*) p1, *cast(const T[]*) p2); |
409 | } | 351 | auto lhs = *cast(const T[]*) p1; |
410 | else | 352 | auto rhs = *cast(const T[]*) p2; |
353 | size_t len = lhs.length; | ||
354 | if (rhs.length < len) | ||
355 | len = rhs.length; | ||
356 | for (size_t u = 0; u < len; u++) | ||
411 | { | 357 | { |
412 | auto s1 = *cast(T[]*)p1; | 358 | if (int result = cmp3(lhs.ptr[u], rhs.ptr[u])) |
413 | auto s2 = *cast(T[]*)p2; | 359 | return result; |
414 | auto len = s1.length; | ||
415 | |||
416 | if (s2.length < len) | ||
417 | len = s2.length; | ||
418 | for (size_t u = 0; u < len; u++) | ||
419 | { | ||
420 | if (int result = (s1[u] > s2[u]) - (s1[u] < s2[u])) | ||
421 | return result; | ||
422 | } | ||
423 | return (s1.length > s2.length) - (s1.length < s2.length); | ||
424 | } | 360 | } |
425 | } | 361 | return cmp3(lhs.length, rhs.length); } |
426 | 362 | ||
427 | override @property inout(TypeInfo) next() inout | 363 | override @property inout(TypeInfo) next() inout |
428 | { | 364 | { |
@@ -692,52 +628,37 @@ unittest | |||
692 | // typeof(null) | 628 | // typeof(null) |
693 | class TypeInfo_n : TypeInfo | 629 | class TypeInfo_n : TypeInfo |
694 | { | 630 | { |
695 | override string toString() const @safe { return "typeof(null)"; } | 631 | const: pure: @nogc: nothrow: @safe: |
696 | 632 | ||
697 | override size_t getHash(scope const void* p) const | 633 | override string toString() { return "typeof(null)"; } |
698 | { | ||
699 | return 0; | ||
700 | } | ||
701 | 634 | ||
702 | override bool equals(in void* p1, in void* p2) const @trusted | 635 | override size_t getHash(scope const void*) { return 0; } |
703 | { | ||
704 | return true; | ||
705 | } | ||
706 | 636 | ||
707 | override int compare(in void* p1, in void* p2) const @trusted | 637 | override bool equals(in void*, in void*) { return true; } |
708 | { | ||
709 | return 0; | ||
710 | } | ||
711 | 638 | ||
712 | override @property size_t tsize() const | 639 | override int compare(in void*, in void*) { return 0; } |
713 | { | ||
714 | return typeof(null).sizeof; | ||
715 | } | ||
716 | 640 | ||
717 | override const(void)[] initializer() const @trusted | 641 | override @property size_t tsize() { return typeof(null).sizeof; } |
718 | { | ||
719 | __gshared immutable void[typeof(null).sizeof] init; | ||
720 | return init; | ||
721 | } | ||
722 | 642 | ||
723 | override void swap(void *p1, void *p2) const @trusted | 643 | override const(void)[] initializer() @trusted { return (cast(void *)null)[0 .. size_t.sizeof]; } |
724 | { | ||
725 | } | ||
726 | 644 | ||
727 | override @property immutable(void)* rtInfo() nothrow pure const @safe { return rtinfoNoPointers; } | 645 | override void swap(void*, void*) {} |
728 | 646 | ||
729 | unittest | 647 | override @property immutable(void)* rtInfo() { return rtinfoNoPointers; } |
648 | } | ||
649 | |||
650 | unittest | ||
651 | { | ||
652 | with (typeid(typeof(null))) | ||
730 | { | 653 | { |
731 | with (typeid(typeof(null))) | 654 | assert(toString == "typeof(null)"); |
732 | { | 655 | assert(getHash(null) == 0); |
733 | assert(toString == "typeof(null)"); | 656 | assert(equals(null, null)); |
734 | assert(getHash(null) == 0); | 657 | assert(compare(null, null) == 0); |
735 | assert(equals(null, null)); | 658 | assert(tsize == typeof(null).sizeof); |
736 | assert(compare(null, null) == 0); | 659 | assert(initializer.ptr is null); |
737 | assert(tsize == typeof(null).sizeof); | 660 | assert(initializer.length == typeof(null).sizeof); |
738 | assert(initializer == new ubyte[(void*).sizeof]); | 661 | assert(rtInfo == rtinfoNoPointers); |
739 | assert(rtInfo == rtinfoNoPointers); | ||
740 | } | ||
741 | } | 662 | } |
742 | } | 663 | } |
743 | 664 | ||
diff --git a/libphobos/src/MERGE b/libphobos/src/MERGE index 2babfbe6347..b5b939f41b3 100644 --- a/libphobos/src/MERGE +++ b/libphobos/src/MERGE | |||
@@ -1,4 +1,4 @@ | |||
1 | 896b1d0e1e8b69bccac0e180ecd1b42a70f95d5b | 1 | 1a3e80ec25afab6123cdcfe20186f36f006b68bb |
2 | 2 | ||
3 | The first line of this file holds the git revision number of the last | 3 | The first line of this file holds the git revision number of the last |
4 | merge done from the dlang/phobos repository. | 4 | merge done from the dlang/phobos repository. |
diff --git a/libphobos/src/std/algorithm/internal.d b/libphobos/src/std/algorithm/internal.d index 3caeefebf9a..6b45599524e 100644 --- a/libphobos/src/std/algorithm/internal.d +++ b/libphobos/src/std/algorithm/internal.d | |||
@@ -62,4 +62,6 @@ version (StdUnittest) | |||
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
65 | // Used instead of `&object.member` when `member` may be | ||
66 | // either a field or a @property function. | ||
65 | package(std) T* addressOf(T)(ref T val) { return &val; } | 67 | package(std) T* addressOf(T)(ref T val) { return &val; } |
diff --git a/libphobos/src/std/bigint.d b/libphobos/src/std/bigint.d index bbb55c288cf..b2fcc07142b 100644 --- a/libphobos/src/std/bigint.d +++ b/libphobos/src/std/bigint.d | |||
@@ -414,17 +414,17 @@ public: | |||
414 | /** | 414 | /** |
415 | * Implements assignment operators of the form `BigInt op= BigInt`. | 415 | * Implements assignment operators of the form `BigInt op= BigInt`. |
416 | */ | 416 | */ |
417 | BigInt opOpAssign(string op, T)(T y) pure nothrow @safe scope return | 417 | BigInt opOpAssign(string op, T)(T y) pure nothrow @safe return scope |
418 | if ((op=="+" || op== "-" || op=="*" || op=="|" || op=="&" || op=="^" || op=="/" || op=="%") | 418 | if ((op=="+" || op== "-" || op=="*" || op=="|" || op=="&" || op=="^" || op=="/" || op=="%") |
419 | && is (T: BigInt)) | 419 | && is (T: BigInt)) |
420 | { | 420 | { |
421 | static if (op == "+") | 421 | static if (op == "+") |
422 | { | 422 | { |
423 | data = BigUint.addOrSub(data, y.data, sign != y.sign, &sign); | 423 | data = BigUint.addOrSub(data, y.data, sign != y.sign, sign); |
424 | } | 424 | } |
425 | else static if (op == "-") | 425 | else static if (op == "-") |
426 | { | 426 | { |
427 | data = BigUint.addOrSub(data, y.data, sign == y.sign, &sign); | 427 | data = BigUint.addOrSub(data, y.data, sign == y.sign, sign); |
428 | } | 428 | } |
429 | else static if (op == "*") | 429 | else static if (op == "*") |
430 | { | 430 | { |
@@ -2244,7 +2244,7 @@ void divMod(const BigInt dividend, const BigInt divisor, out BigInt quotient, ou | |||
2244 | BigUint.divMod(dividend.data, divisor.data, q, r); | 2244 | BigUint.divMod(dividend.data, divisor.data, q, r); |
2245 | quotient.sign = dividend.sign != divisor.sign; | 2245 | quotient.sign = dividend.sign != divisor.sign; |
2246 | quotient.data = q; | 2246 | quotient.data = q; |
2247 | remainder.sign = dividend.sign; | 2247 | remainder.sign = r.isZero() ? false : dividend.sign; |
2248 | remainder.data = r; | 2248 | remainder.data = r; |
2249 | } | 2249 | } |
2250 | 2250 | ||
@@ -2291,6 +2291,14 @@ void divMod(const BigInt dividend, const BigInt divisor, out BigInt quotient, ou | |||
2291 | assert(q * d + r == -c); | 2291 | assert(q * d + r == -c); |
2292 | } | 2292 | } |
2293 | 2293 | ||
2294 | // https://issues.dlang.org/show_bug.cgi?id=22771 | ||
2295 | @safe pure nothrow unittest | ||
2296 | { | ||
2297 | BigInt quotient, remainder; | ||
2298 | divMod(BigInt(-50), BigInt(1), quotient, remainder); | ||
2299 | assert(remainder == 0); | ||
2300 | } | ||
2301 | |||
2294 | // https://issues.dlang.org/show_bug.cgi?id=19740 | 2302 | // https://issues.dlang.org/show_bug.cgi?id=19740 |
2295 | @safe unittest | 2303 | @safe unittest |
2296 | { | 2304 | { |
diff --git a/libphobos/src/std/container/rbtree.d b/libphobos/src/std/container/rbtree.d index 0b0a0b2f59f..622dee4df2f 100644 --- a/libphobos/src/std/container/rbtree.d +++ b/libphobos/src/std/container/rbtree.d | |||
@@ -111,7 +111,7 @@ struct RBNode(V) | |||
111 | /** | 111 | /** |
112 | * Get the left child | 112 | * Get the left child |
113 | */ | 113 | */ |
114 | @property inout(RBNode)* left() inout | 114 | @property inout(RBNode)* left() inout return scope |
115 | { | 115 | { |
116 | return _left; | 116 | return _left; |
117 | } | 117 | } |
@@ -119,7 +119,7 @@ struct RBNode(V) | |||
119 | /** | 119 | /** |
120 | * Get the right child | 120 | * Get the right child |
121 | */ | 121 | */ |
122 | @property inout(RBNode)* right() inout | 122 | @property inout(RBNode)* right() inout return scope |
123 | { | 123 | { |
124 | return _right; | 124 | return _right; |
125 | } | 125 | } |
@@ -127,7 +127,7 @@ struct RBNode(V) | |||
127 | /** | 127 | /** |
128 | * Get the parent | 128 | * Get the parent |
129 | */ | 129 | */ |
130 | @property inout(RBNode)* parent() inout | 130 | @property inout(RBNode)* parent() inout return scope |
131 | { | 131 | { |
132 | return _parent; | 132 | return _parent; |
133 | } | 133 | } |
@@ -377,7 +377,7 @@ struct RBNode(V) | |||
377 | * Returns the next highest valued node in the tree after this one, or end | 377 | * Returns the next highest valued node in the tree after this one, or end |
378 | * if this was the highest-valued node. | 378 | * if this was the highest-valued node. |
379 | */ | 379 | */ |
380 | Node remove(Node end) | 380 | Node remove(Node end) return |
381 | { | 381 | { |
382 | // | 382 | // |
383 | // remove this node from the tree, fixing the color if necessary. | 383 | // remove this node from the tree, fixing the color if necessary. |
@@ -558,7 +558,7 @@ struct RBNode(V) | |||
558 | /** | 558 | /** |
559 | * Return the leftmost descendant of this node. | 559 | * Return the leftmost descendant of this node. |
560 | */ | 560 | */ |
561 | @property inout(RBNode)* leftmost() inout | 561 | @property inout(RBNode)* leftmost() inout return |
562 | { | 562 | { |
563 | inout(RBNode)* result = &this; | 563 | inout(RBNode)* result = &this; |
564 | while (result._left !is null) | 564 | while (result._left !is null) |
@@ -569,7 +569,7 @@ struct RBNode(V) | |||
569 | /** | 569 | /** |
570 | * Return the rightmost descendant of this node | 570 | * Return the rightmost descendant of this node |
571 | */ | 571 | */ |
572 | @property inout(RBNode)* rightmost() inout | 572 | @property inout(RBNode)* rightmost() inout return |
573 | { | 573 | { |
574 | inout(RBNode)* result = &this; | 574 | inout(RBNode)* result = &this; |
575 | while (result._right !is null) | 575 | while (result._right !is null) |
@@ -583,7 +583,7 @@ struct RBNode(V) | |||
583 | * You should never call this on the marker node, as it is assumed that | 583 | * You should never call this on the marker node, as it is assumed that |
584 | * there is a valid next node. | 584 | * there is a valid next node. |
585 | */ | 585 | */ |
586 | @property inout(RBNode)* next() inout | 586 | @property inout(RBNode)* next() inout return |
587 | { | 587 | { |
588 | inout(RBNode)* n = &this; | 588 | inout(RBNode)* n = &this; |
589 | if (n.right is null) | 589 | if (n.right is null) |
@@ -602,7 +602,7 @@ struct RBNode(V) | |||
602 | * You should never call this on the leftmost node of the tree as it is | 602 | * You should never call this on the leftmost node of the tree as it is |
603 | * assumed that there is a valid previous node. | 603 | * assumed that there is a valid previous node. |
604 | */ | 604 | */ |
605 | @property inout(RBNode)* prev() inout | 605 | @property inout(RBNode)* prev() inout return |
606 | { | 606 | { |
607 | inout(RBNode)* n = &this; | 607 | inout(RBNode)* n = &this; |
608 | if (n.left is null) | 608 | if (n.left is null) |
diff --git a/libphobos/src/std/conv.d b/libphobos/src/std/conv.d index a10f4da7f9c..8512a445daf 100644 --- a/libphobos/src/std/conv.d +++ b/libphobos/src/std/conv.d | |||
@@ -1642,7 +1642,7 @@ if (!isImplicitlyConvertible!(S, T) && | |||
1642 | Array-to-array conversion (except when target is a string type) | 1642 | Array-to-array conversion (except when target is a string type) |
1643 | converts each element in turn by using `to`. | 1643 | converts each element in turn by using `to`. |
1644 | */ | 1644 | */ |
1645 | private T toImpl(T, S)(S value) | 1645 | private T toImpl(T, S)(scope S value) |
1646 | if (!isImplicitlyConvertible!(S, T) && | 1646 | if (!isImplicitlyConvertible!(S, T) && |
1647 | !isSomeString!S && isDynamicArray!S && | 1647 | !isSomeString!S && isDynamicArray!S && |
1648 | !isExactSomeString!T && isArray!T) | 1648 | !isExactSomeString!T && isArray!T) |
diff --git a/libphobos/src/std/file.d b/libphobos/src/std/file.d index c974ada2ae8..a99c5170afb 100644 --- a/libphobos/src/std/file.d +++ b/libphobos/src/std/file.d | |||
@@ -4635,7 +4635,7 @@ private struct DirIteratorImpl | |||
4635 | import std.path : chainPath; | 4635 | import std.path : chainPath; |
4636 | auto searchPattern = chainPath(directory, "*.*"); | 4636 | auto searchPattern = chainPath(directory, "*.*"); |
4637 | 4637 | ||
4638 | static auto trustedFindFirstFileW(typeof(searchPattern) pattern, WIN32_FIND_DATAW* findinfo) @trusted | 4638 | static auto trustedFindFirstFileW(typeof(searchPattern) pattern, scope WIN32_FIND_DATAW* findinfo) @trusted |
4639 | { | 4639 | { |
4640 | return FindFirstFileW(pattern.tempCString!FSChar(), findinfo); | 4640 | return FindFirstFileW(pattern.tempCString!FSChar(), findinfo); |
4641 | } | 4641 | } |
@@ -4653,7 +4653,7 @@ private struct DirIteratorImpl | |||
4653 | return toNext(true, &_findinfo); | 4653 | return toNext(true, &_findinfo); |
4654 | } | 4654 | } |
4655 | 4655 | ||
4656 | bool toNext(bool fetch, WIN32_FIND_DATAW* findinfo) @trusted | 4656 | bool toNext(bool fetch, scope WIN32_FIND_DATAW* findinfo) @trusted |
4657 | { | 4657 | { |
4658 | import core.stdc.wchar_ : wcscmp; | 4658 | import core.stdc.wchar_ : wcscmp; |
4659 | 4659 | ||
@@ -5274,7 +5274,21 @@ Returns: | |||
5274 | */ | 5274 | */ |
5275 | string tempDir() @trusted | 5275 | string tempDir() @trusted |
5276 | { | 5276 | { |
5277 | import std.path : dirSeparator; | 5277 | // We must check that the end of a path is not a separator, before adding another |
5278 | // If we don't we end up with https://issues.dlang.org/show_bug.cgi?id=22738 | ||
5279 | static string addSeparator(string input) | ||
5280 | { | ||
5281 | import std.path : dirSeparator; | ||
5282 | import std.algorithm.searching : endsWith; | ||
5283 | |||
5284 | // It is very rare a directory path will reach this point with a directory separator at the end | ||
5285 | // However on OSX this can happen, so we must verify lest we break user code i.e. https://github.com/dlang/dub/pull/2208 | ||
5286 | if (!input.endsWith(dirSeparator)) | ||
5287 | return input ~ dirSeparator; | ||
5288 | else | ||
5289 | return input; | ||
5290 | } | ||
5291 | |||
5278 | static string cache; | 5292 | static string cache; |
5279 | if (cache is null) | 5293 | if (cache is null) |
5280 | { | 5294 | { |
@@ -5294,7 +5308,7 @@ string tempDir() @trusted | |||
5294 | static string findExistingDir(T...)(lazy T alternatives) | 5308 | static string findExistingDir(T...)(lazy T alternatives) |
5295 | { | 5309 | { |
5296 | foreach (dir; alternatives) | 5310 | foreach (dir; alternatives) |
5297 | if (!dir.empty && exists(dir)) return dir ~ dirSeparator; | 5311 | if (!dir.empty && exists(dir)) return addSeparator(dir); |
5298 | return null; | 5312 | return null; |
5299 | } | 5313 | } |
5300 | 5314 | ||
@@ -5309,7 +5323,7 @@ string tempDir() @trusted | |||
5309 | 5323 | ||
5310 | if (cache is null) | 5324 | if (cache is null) |
5311 | { | 5325 | { |
5312 | cache = getcwd() ~ dirSeparator; | 5326 | cache = addSeparator(getcwd()); |
5313 | } | 5327 | } |
5314 | } | 5328 | } |
5315 | return cache; | 5329 | return cache; |
@@ -5338,6 +5352,9 @@ string tempDir() @trusted | |||
5338 | import std.algorithm.searching : endsWith; | 5352 | import std.algorithm.searching : endsWith; |
5339 | import std.path : dirSeparator; | 5353 | import std.path : dirSeparator; |
5340 | assert(tempDir.endsWith(dirSeparator)); | 5354 | assert(tempDir.endsWith(dirSeparator)); |
5355 | |||
5356 | // https://issues.dlang.org/show_bug.cgi?id=22738 | ||
5357 | assert(!tempDir.endsWith(dirSeparator ~ dirSeparator)); | ||
5341 | } | 5358 | } |
5342 | 5359 | ||
5343 | /** | 5360 | /** |
diff --git a/libphobos/src/std/functional.d b/libphobos/src/std/functional.d index bc8d368e970..da698e045fe 100644 --- a/libphobos/src/std/functional.d +++ b/libphobos/src/std/functional.d | |||
@@ -68,6 +68,8 @@ import std.traits : isCallable, Parameters; | |||
68 | 68 | ||
69 | import std.internal.attributes : betterC; | 69 | import std.internal.attributes : betterC; |
70 | 70 | ||
71 | public import core.lifetime : forward; | ||
72 | |||
71 | private template needOpCallAlias(alias fun) | 73 | private template needOpCallAlias(alias fun) |
72 | { | 74 | { |
73 | /* Determine whether or not unaryFun and binaryFun need to alias to fun or | 75 | /* Determine whether or not unaryFun and binaryFun need to alias to fun or |
@@ -1845,10 +1847,3 @@ if (isCallable!(F)) | |||
1845 | static assert(! is(typeof(dg_xtrnC) == typeof(dg_xtrnD))); | 1847 | static assert(! is(typeof(dg_xtrnC) == typeof(dg_xtrnD))); |
1846 | } | 1848 | } |
1847 | } | 1849 | } |
1848 | |||
1849 | // forward used to be here but was moved to druntime | ||
1850 | template forward(args...) | ||
1851 | { | ||
1852 | import core.lifetime : fun = forward; | ||
1853 | alias forward = fun!args; | ||
1854 | } | ||
diff --git a/libphobos/src/std/internal/math/biguintcore.d b/libphobos/src/std/internal/math/biguintcore.d index 6a93e0a16b0..d5c4768f064 100644 --- a/libphobos/src/std/internal/math/biguintcore.d +++ b/libphobos/src/std/internal/math/biguintcore.d | |||
@@ -813,7 +813,7 @@ public: | |||
813 | 813 | ||
814 | // If wantSub is false, return x + y, leaving sign unchanged. | 814 | // If wantSub is false, return x + y, leaving sign unchanged. |
815 | // If wantSub is true, return abs(x - y), negating sign if x<y | 815 | // If wantSub is true, return abs(x - y), negating sign if x<y |
816 | static BigUint addOrSub(scope BigUint x, scope BigUint y, bool wantSub, bool *sign) | 816 | static BigUint addOrSub(scope BigUint x, scope BigUint y, bool wantSub, ref bool sign) |
817 | pure nothrow @safe | 817 | pure nothrow @safe |
818 | { | 818 | { |
819 | BigUint r; | 819 | BigUint r; |
@@ -822,10 +822,10 @@ public: | |||
822 | bool negative; | 822 | bool negative; |
823 | // sub returns GC allocated array, can be safely cast to immutable | 823 | // sub returns GC allocated array, can be safely cast to immutable |
824 | r.data = (() @trusted => cast(immutable) sub(x.data, y.data, &negative))(); | 824 | r.data = (() @trusted => cast(immutable) sub(x.data, y.data, &negative))(); |
825 | *sign ^= negative; | 825 | sign ^= negative; |
826 | if (r.isZero()) | 826 | if (r.isZero()) |
827 | { | 827 | { |
828 | *sign = false; | 828 | sign = false; |
829 | } | 829 | } |
830 | } | 830 | } |
831 | else | 831 | else |
diff --git a/libphobos/src/std/socket.d b/libphobos/src/std/socket.d index f8908cf76ef..cd2323281d3 100644 --- a/libphobos/src/std/socket.d +++ b/libphobos/src/std/socket.d | |||
@@ -787,13 +787,20 @@ class InternetHost | |||
787 | assert(ih.name == "www.digitalmars.com" || ih.name == "digitalmars.com", | 787 | assert(ih.name == "www.digitalmars.com" || ih.name == "digitalmars.com", |
788 | ih.name); | 788 | ih.name); |
789 | 789 | ||
790 | assert(ih.getHostByAddr(ih.addrList[0])); | 790 | /* The following assert randomly fails in the test suite. |
791 | string getHostNameFromInt = ih.name.dup; | 791 | * https://issues.dlang.org/show_bug.cgi?id=22791 |
792 | * So just ignore it when it fails. | ||
793 | */ | ||
794 | //assert(ih.getHostByAddr(ih.addrList[0])); | ||
795 | if (ih.getHostByAddr(ih.addrList[0])) | ||
796 | { | ||
797 | string getHostNameFromInt = ih.name.dup; | ||
792 | 798 | ||
793 | assert(ih.getHostByAddr(ia.toAddrString())); | 799 | assert(ih.getHostByAddr(ia.toAddrString())); |
794 | string getHostNameFromStr = ih.name.dup; | 800 | string getHostNameFromStr = ih.name.dup; |
795 | 801 | ||
796 | assert(getHostNameFromInt == getHostNameFromStr); | 802 | assert(getHostNameFromInt == getHostNameFromStr); |
803 | } | ||
797 | } | 804 | } |
798 | 805 | ||
799 | 806 | ||
diff --git a/libphobos/src/std/sumtype.d b/libphobos/src/std/sumtype.d index 658fd384784..5e35a6b9cd5 100644 --- a/libphobos/src/std/sumtype.d +++ b/libphobos/src/std/sumtype.d | |||
@@ -262,6 +262,8 @@ private enum isHashable(T) = __traits(compiles, | |||
262 | 262 | ||
263 | private enum hasPostblit(T) = __traits(hasPostblit, T); | 263 | private enum hasPostblit(T) = __traits(hasPostblit, T); |
264 | 264 | ||
265 | private enum isInout(T) = is(T == inout); | ||
266 | |||
265 | /** | 267 | /** |
266 | * A [tagged union](https://en.wikipedia.org/wiki/Tagged_union) that can hold a | 268 | * A [tagged union](https://en.wikipedia.org/wiki/Tagged_union) that can hold a |
267 | * single value from any of a specified set of types. | 269 | * single value from any of a specified set of types. |
@@ -419,6 +421,7 @@ public: | |||
419 | ( | 421 | ( |
420 | allSatisfy!(isCopyable, Map!(InoutOf, Types)) | 422 | allSatisfy!(isCopyable, Map!(InoutOf, Types)) |
421 | && !anySatisfy!(hasPostblit, Map!(InoutOf, Types)) | 423 | && !anySatisfy!(hasPostblit, Map!(InoutOf, Types)) |
424 | && allSatisfy!(isInout, Map!(InoutOf, Types)) | ||
422 | ) | 425 | ) |
423 | { | 426 | { |
424 | /// Constructs a `SumType` that's a copy of another `SumType`. | 427 | /// Constructs a `SumType` that's a copy of another `SumType`. |
@@ -1492,6 +1495,23 @@ version (D_BetterC) {} else | |||
1492 | immutable SumType!(int*) si = ∋ | 1495 | immutable SumType!(int*) si = ∋ |
1493 | } | 1496 | } |
1494 | 1497 | ||
1498 | // Immutable member type with copy constructor | ||
1499 | // https://issues.dlang.org/show_bug.cgi?id=22572 | ||
1500 | @safe unittest | ||
1501 | { | ||
1502 | static struct CopyConstruct | ||
1503 | { | ||
1504 | this(ref inout CopyConstruct other) inout {} | ||
1505 | } | ||
1506 | |||
1507 | static immutable struct Value | ||
1508 | { | ||
1509 | CopyConstruct c; | ||
1510 | } | ||
1511 | |||
1512 | SumType!Value s; | ||
1513 | } | ||
1514 | |||
1495 | /// True if `T` is an instance of the `SumType` template, otherwise false. | 1515 | /// True if `T` is an instance of the `SumType` template, otherwise false. |
1496 | private enum bool isSumTypeInstance(T) = is(T == SumType!Args, Args...); | 1516 | private enum bool isSumTypeInstance(T) = is(T == SumType!Args, Args...); |
1497 | 1517 | ||
diff --git a/libphobos/src/std/typecons.d b/libphobos/src/std/typecons.d index 28edb9b8c29..ea8f8bd0545 100644 --- a/libphobos/src/std/typecons.d +++ b/libphobos/src/std/typecons.d | |||
@@ -2798,13 +2798,24 @@ struct Nullable(T) | |||
2798 | } | 2798 | } |
2799 | } | 2799 | } |
2800 | 2800 | ||
2801 | this (ref return scope inout Nullable!T rhs) inout | 2801 | static if (__traits(hasPostblit, T)) |
2802 | { | 2802 | { |
2803 | _isNull = rhs._isNull; | 2803 | this(this) |
2804 | if (!_isNull) | 2804 | { |
2805 | _value.payload = rhs._value.payload; | 2805 | if (!_isNull) |
2806 | else | 2806 | _value.payload.__xpostblit(); |
2807 | _value = DontCallDestructorT.init; | 2807 | } |
2808 | } | ||
2809 | else static if (__traits(hasCopyConstructor, T)) | ||
2810 | { | ||
2811 | this(ref return scope inout Nullable!T rhs) inout | ||
2812 | { | ||
2813 | _isNull = rhs._isNull; | ||
2814 | if (!_isNull) | ||
2815 | _value.payload = rhs._value.payload; | ||
2816 | else | ||
2817 | _value = DontCallDestructorT.init; | ||
2818 | } | ||
2808 | } | 2819 | } |
2809 | 2820 | ||
2810 | /** | 2821 | /** |
@@ -9630,13 +9641,28 @@ unittest | |||
9630 | { | 9641 | { |
9631 | int b; | 9642 | int b; |
9632 | @disable this(this); | 9643 | @disable this(this); |
9633 | this (ref return scope inout S rhs) inout | 9644 | this(ref return scope inout S rhs) inout |
9634 | { | 9645 | { |
9635 | this.b = rhs.b + 1; | 9646 | this.b = rhs.b + 1; |
9636 | } | 9647 | } |
9637 | } | 9648 | } |
9638 | 9649 | ||
9639 | Nullable!S s1 = S(1); | 9650 | Nullable!S s1 = S(1); |
9651 | assert(s1.get().b == 2); | ||
9652 | Nullable!S s2 = s1; | ||
9653 | assert(s2.get().b == 3); | ||
9654 | } | ||
9655 | |||
9656 | @safe unittest | ||
9657 | { | ||
9658 | static struct S | ||
9659 | { | ||
9660 | int b; | ||
9661 | this(this) { ++b; } | ||
9662 | } | ||
9663 | |||
9664 | Nullable!S s1 = S(1); | ||
9665 | assert(s1.get().b == 2); | ||
9640 | Nullable!S s2 = s1; | 9666 | Nullable!S s2 = s1; |
9641 | assert(s2.get().b > s1.get().b); | 9667 | assert(s2.get().b == 3); |
9642 | } | 9668 | } |
diff --git a/libphobos/src/std/uni/package.d b/libphobos/src/std/uni/package.d index 192b6fd2b2d..9780b1b318f 100644 --- a/libphobos/src/std/uni/package.d +++ b/libphobos/src/std/uni/package.d | |||
@@ -5363,7 +5363,7 @@ pure @safe unittest | |||
5363 | pure @safe unittest | 5363 | pure @safe unittest |
5364 | { | 5364 | { |
5365 | import std.range : stride; | 5365 | import std.range : stride; |
5366 | static bool testAll(Matcher, Range)(scope ref Matcher m, ref Range r) | 5366 | static bool testAll(Matcher, Range)(ref Matcher m, ref Range r) @safe |
5367 | { | 5367 | { |
5368 | bool t = m.test(r); | 5368 | bool t = m.test(r); |
5369 | auto save = r.idx; | 5369 | auto save = r.idx; |
diff --git a/libphobos/src/std/zip.d b/libphobos/src/std/zip.d index 4d7422bdd1c..72d128700bf 100644 --- a/libphobos/src/std/zip.d +++ b/libphobos/src/std/zip.d | |||
@@ -222,14 +222,6 @@ final class ArchiveMember | |||
222 | @property @safe pure nothrow @nogc uint expandedSize() const { return _expandedSize; } | 222 | @property @safe pure nothrow @nogc uint expandedSize() const { return _expandedSize; } |
223 | 223 | ||
224 | /** | 224 | /** |
225 | * Should be 0. | ||
226 | * | ||
227 | * Returns: The number of the disk where this member can be found. | ||
228 | */ | ||
229 | deprecated("Multidisk not supported; will be removed in 2.099.0") | ||
230 | @property @safe pure nothrow @nogc ushort diskNumber() const { return 0; } | ||
231 | |||
232 | /** | ||
233 | * Data of member in compressed form. | 225 | * Data of member in compressed form. |
234 | * | 226 | * |
235 | * Returns: The file data in compressed form. | 227 | * Returns: The file data in compressed form. |
@@ -452,13 +444,6 @@ public: | |||
452 | private bool _isZip64; | 444 | private bool _isZip64; |
453 | static const ushort zip64ExtractVersion = 45; | 445 | static const ushort zip64ExtractVersion = 45; |
454 | 446 | ||
455 | deprecated("Use digitalSignatureLength instead; will be removed in 2.098.0") | ||
456 | static const int digiSignLength = 6; | ||
457 | deprecated("Use zip64EndOfCentralDirLocatorLength instead; will be removed in 2.098.0") | ||
458 | static const int eocd64LocLength = 20; | ||
459 | deprecated("Use zip64EndOfCentralDirLength instead; will be removed in 2.098.0") | ||
460 | static const int eocd64Length = 56; | ||
461 | |||
462 | private Segment[] _segs; | 447 | private Segment[] _segs; |
463 | 448 | ||
464 | /** | 449 | /** |
@@ -469,29 +454,11 @@ public: | |||
469 | @property @safe @nogc pure nothrow ubyte[] data() { return _data; } | 454 | @property @safe @nogc pure nothrow ubyte[] data() { return _data; } |
470 | 455 | ||
471 | /** | 456 | /** |
472 | * 0 since multi-disk zip archives are not supported. | ||
473 | * | ||
474 | * Returns: Number of this disk. | ||
475 | */ | ||
476 | deprecated("Multidisk not supported; will be removed in 2.099.0") | ||
477 | @property @safe @nogc pure nothrow uint diskNumber() const { return 0; } | ||
478 | |||
479 | /** | ||
480 | * 0 since multi-disk zip archives are not supported. | ||
481 | * | ||
482 | * Returns: Number of the disk, where the central directory starts. | ||
483 | */ | ||
484 | deprecated("Multidisk not supported; will be removed in 2.099.0") | ||
485 | @property @safe @nogc pure nothrow uint diskStartDir() const { return 0; } | ||
486 | |||
487 | /** | ||
488 | * Number of ArchiveMembers in the directory. | 457 | * Number of ArchiveMembers in the directory. |
489 | * | 458 | * |
490 | * Returns: The number of files in this archive. | 459 | * Returns: The number of files in this archive. |
491 | */ | 460 | */ |
492 | deprecated("Use totalEntries instead; will be removed in 2.099.0") | 461 | @property @safe @nogc pure nothrow uint totalEntries() const { return cast(uint) _directory.length; } |
493 | @property @safe @nogc pure nothrow uint numEntries() const { return cast(uint) _directory.length; } | ||
494 | @property @safe @nogc pure nothrow uint totalEntries() const { return cast(uint) _directory.length; } /// ditto | ||
495 | 462 | ||
496 | /** | 463 | /** |
497 | * True when the archive is in Zip64 format. Set this to true to force building a Zip64 archive. | 464 | * True when the archive is in Zip64 format. Set this to true to force building a Zip64 archive. |
diff --git a/libphobos/testsuite/libphobos.betterc/test19933.d b/libphobos/testsuite/libphobos.betterc/test19933.d new file mode 100644 index 00000000000..a0faadd2112 --- /dev/null +++ b/libphobos/testsuite/libphobos.betterc/test19933.d | |||
@@ -0,0 +1,11 @@ | |||
1 | /*******************************************/ | ||
2 | // https://issues.dlang.org/show_bug.cgi?id=19933 | ||
3 | // https://issues.dlang.org/show_bug.cgi?id=18816 | ||
4 | |||
5 | import core.stdc.stdio; | ||
6 | |||
7 | extern(C) int main() | ||
8 | { | ||
9 | fprintf(stderr, "Hello\n"); | ||
10 | return 0; | ||
11 | } | ||
diff --git a/libphobos/testsuite/libphobos.hash/test_hash.d b/libphobos/testsuite/libphobos.hash/test_hash.d index d0a8e5fb809..0ad2443c826 100644 --- a/libphobos/testsuite/libphobos.hash/test_hash.d +++ b/libphobos/testsuite/libphobos.hash/test_hash.d | |||
@@ -277,7 +277,7 @@ void issue22076() | |||
277 | static struct S1 | 277 | static struct S1 |
278 | { | 278 | { |
279 | S0 a; | 279 | S0 a; |
280 | inout(S0)* b() inout nothrow { return &a; } | 280 | inout(S0)* b() inout return nothrow { return &a; } |
281 | alias b this; | 281 | alias b this; |
282 | } | 282 | } |
283 | 283 | ||