Commit graph

15600 commits

Author SHA1 Message Date
dkorpel
5242beb167 add return scope to realloc 2021-06-08 09:32:30 +00:00
Razvan Nitu
4d6254fbb3
Merge pull request #8130 from iK4tsu/fix-algorithm-findsplit-methods
Fix std.algorithm findSplit methods module documentation
2021-06-08 13:43:02 +08:00
Martin Kinkelin
36fd878467 Fix Issue 22001 - Avoid undefined bytes in std.conv.toChars() results for radix 10
The buffer is initialized from right-to-left in initialize(), and unused
bytes are left alone. Previously, the whole result wasn't preinitialized
with T.init, so the unused buffer bytes weren't well-defined. Initialize
it now (with zeros), as the whole buffer is still used for equality/
identity comparisons etc.
2021-06-08 07:25:08 +08:00
The Dlang Bot
19003dd639
Merge pull request #8127 from kinke/bitpattern
[stable] std.math.operations: Slightly revise extractBitpattern()

Signed-off-by: Razvan Nitu <RazvanN7@users.noreply.github.com>
Merged-on-behalf-of: Razvan Nitu <RazvanN7@users.noreply.github.com>
2021-06-07 18:22:22 +00:00
João Lourenço
882cf3df43
std.algorithm: improve findSplit methods module documentation
Signed-off-by: João Lourenço <jlourenco5691@gmail.com>
2021-06-07 12:07:47 +01:00
Martin Nowak
7a461990da Merge remote-tracking branch 'upstream/stable' into merge_stable 2021-06-04 13:02:58 +02:00
Martin Kinkelin
e150b1e052 std.stdio: Restore compilability of unittests for iOS 2021-06-03 18:23:40 +00:00
Martin Kinkelin
679521d44e std.format.internal.floats: Restore compilability of unittests for targets with quadruple real precision
Such as non-Apple AArch64; `printFloat()` doesn't support that format.
2021-06-03 07:56:06 +00:00
Martin Kinkelin
06037a25b4 std.math.exponential: Minimally relax a pow() unittest for targets with 64-bit real
Required since #7783.
2021-06-03 07:56:03 +00:00
Martin Kinkelin
8946209a9b Revert #7823 - Faster pow implementation for integral exponents
There are multiple issues with that commit, incl. out-of-bounds read
on x86 systems and a significant performance decrease for qualified
floating-point types; see #8124 for a full list of flaws.

I'm questioning the tackled goal in the first place, because I expect
users to use that `pow` mainly with small integral exponents, *not*
expecting underflows to 0 or overflows to ±infinity, so optimizing
for these cases and sacrificing performance for the regular case doesn't
make a lot of sense to me.
2021-06-03 09:57:57 +09:00
Martin Kinkelin
3d90677e51 std.math.operations: Fix extractBitpattern() unittest 2021-06-02 21:22:27 +02:00
Martin Kinkelin
4d8be9050b std.math.operations: Slightly simplify extractBitpattern() 2021-06-02 20:45:13 +02:00
Martin Kinkelin
5a46c9ecf6 std.math.operations: Make extractBitpattern() @trusted
To enable unsafe reinterpret-casts directly, without extra lambdas.
2021-06-02 20:42:09 +02:00
Martin Kinkelin
ddd044d6c7 std.math.operations: Fix out-of-bounds read in extractBitpattern()
For 32-bit x86 targets with `real.sizeof == 12`.
2021-06-02 20:38:25 +02:00
dkorpel
d875674af7 fix local variable lifetimes in systime parsing 2021-06-02 02:12:41 +00:00
dkorpel
6c51d19c89 Add return scope to MultiArray ctor 2021-06-01 14:14:06 +02:00
dkorpel
d0a0cdb0a2 use icmp instead of toUpper in getopt 2021-06-01 13:36:56 +02:00
Walter Bright
74a40f4783 add @trusted for scope pointer to scope pointer 2021-05-31 00:45:26 +02:00
dkorpel
5f7816a77e use splitter instead of split in getopt 2021-05-30 03:00:56 +02:00
dkorpel
b1281eb67a add more return/scope to pure bigint functions 2021-05-30 01:10:13 +02:00
dkorpel
f62e725c91 add return scope to xml.toType 2021-05-30 01:07:37 +02:00
The Dlang Bot
86d586a2e8
Merge pull request #8118 from kinke/math_new
[stable] Fix missing imports for non-x87 real after std.math split-up

Signed-off-by: Iain Buclaw <ibuclaw@users.noreply.github.com>
Merged-on-behalf-of: Iain Buclaw <ibuclaw@users.noreply.github.com>
2021-05-29 16:08:25 +02:00
Martin Kinkelin
a5b66d6614 std.math.hardware: Remove unused InlineAsm_X87* version declarations 2021-05-29 14:50:32 +02:00
Martin Kinkelin
0a685c19ac std.math: Fix missing imports for non-x87 real after split-up 2021-05-29 14:48:17 +02:00
Martin Nowak
14f71b32fa Merge remote-tracking branch 'upstream/stable' into merge_stable 2021-05-28 13:04:01 +02:00
The Dlang Bot
048df4a66c
Merge pull request #8048 from andralex/SharedConstInoutOf
Add missing SharedConstInoutOf and refactor QualifierOf
merged-on-behalf-of: Razvan Nitu <RazvanN7@users.noreply.github.com>
2021-05-25 13:05:36 +02:00
Martin Kinkelin
8f262acda1 std.format.internal.write: Replace brittle runtime check by compile-time check
When checking whether `T.toString` for some class `T` is inherited from
base class `Object`.

The runtime check fails when using a druntime DLL on Windows, where
`Object.toString` in other DLLs/executables is a trampoline (in the
druntime import library) to the dllimported function, with its own
identity.
2021-05-23 15:42:44 +02:00
dkorpel
460ed9c619 improve documentation of SortedRange.release 2021-05-21 16:24:20 +02:00
aG0aep6G
d7bf7301be add scope to parameters of toUTF32 and toUTFImpl 2021-05-21 01:25:49 +02:00
nordlow
61d60d2121 Annotate std/file.d to please dlang/dmd#12520 2021-05-20 13:14:21 +02:00
berni44
85afd3555f std.format: Clean up rounding of floats. 2021-05-20 17:59:09 +08:00
Razvan Nitu
16d01b0d14
Merge pull request #8073 from berni44/rounding_f
std.format: Use rounding tool to round %f on floats.
2021-05-20 14:31:59 +08:00
Witold Baryluk
a8d4b00f98 Fix issue 21926 - Allow leadings zeros in std.conv.octal
First of all, the DDoc currently says that:

"Leading zero is allowed, but not required."

The current implementation doesn't respect that.

D lexer allows leading zero(s) also.

And when considering octal from string, there is no possibility
of confusion, as the comments in the code claim. Disallowing
leading zeros for octal conversion from string, does not help
with anything actually.

So lets allow leading zeros.

Allowing leading zeros, does help when implementing various
APIs (i.e. glibc, Linux kernel), where a lot of octal constant,
are defined with multiple leading zeros, for readability and
alignment, in C headers. Having to manually or automatically
special case these when porting such API definitions, is
counter-productive.

Example from a Linux kernel (`include/uapi/linux/stat.h`):

```c
#define S_IFMT  00170000
#define S_IFSOCK 0140000
#define S_IFLNK	 0120000
#define S_IFREG  0100000
#define S_IFBLK  0060000
#define S_IFDIR  0040000
#define S_IFCHR  0020000
#define S_IFIFO  0010000
#define S_ISUID  0004000
#define S_ISGID  0002000
#define S_ISVTX  0001000
```

With this patch, now it is trivial and easier to convert these to D:

```d
...
enum S_ISVTX = octal!"0001000";
```

while being close to original. That helps with readability,
and long term maintenance.

In fact the run-time version provided by `parse!(int)(string, 8)`
also supports leading zeros already. So this makes `octal`
more consistent `parse`.
2021-05-20 01:48:15 +02:00
Razvan Nitu
5131694f1c
Merge pull request #8088 from nordlow/fix-pure-scope-json
Annotate std/json.d to please dlang/dmd#12520
2021-05-19 14:38:26 +08:00
Razvan Nitu
6ae4991ca1
Merge pull request #8104 from WalterBright/bigint-ret
bigint.d: add return annotations for opOpAssign()
2021-05-19 14:29:33 +08:00
nordlow
dc54832b5c Annotate std/path.d to please dlang/dmd#12520, absolutePath excluded 2021-05-19 04:06:24 +02:00
Walter Bright
22ca8abece bigint.d: add return annotations for opOpAssign() 2021-05-18 09:43:40 -07:00
Walter Bright
f0e8bcf369
Merge pull request #8081 from nordlow/fix-pure-scope-bigint
Annotate std/bigint.d and std/internal/math/biguintcore.d to please d…
2021-05-18 09:40:09 -07:00
nordlow
a44f71813f Annotate std/bigint.d and std/internal/math/biguintcore.d to please dlang/dmd#12520 #8076 2021-05-18 13:14:08 +02:00
nordlow
62d9ffb42c Annotate std/range/package.d to please dlang/dmd#12520 2021-05-18 11:31:41 +02:00
nordlow
450e79cd6a Annotate std/json.d to please dlang/dmd#12520 2021-05-18 11:02:18 +02:00
The Dlang Bot
862c39241d
Merge pull request #8092 from dlang/revert-8055-issue_9489
Revert "Fix Issue 9489 - writeln of struct with disabled copy ctor"
merged-on-behalf-of: Razvan Nitu <RazvanN7@users.noreply.github.com>
2021-05-18 08:49:41 +02:00
Iain Buclaw
7ff6bb705d Revert "Annotate std/path.d to please dlang/dmd#12520"
This reverts commit 384b4be243.
2021-05-18 06:48:54 +02:00
avaj
8b31d022f0 std.traits: Fix unittest for isNumeric 2021-05-18 05:13:18 +02:00
nordlow
f1bcb5270f Annotate std/bitmanip to please dlang/dmd#12520 2021-05-18 04:48:36 +02:00
nordlow
4449049c18 Annotate std/base64.d to please dlang/dmd#12520 #8076 2021-05-18 03:28:07 +02:00
nordlow
4ba167b15b Annotate std/container/dlist.d to please dlang/dmd#12520 2021-05-18 01:58:16 +02:00
nordlow
b4ce8436d7 Annotate bitmapped_block.d to please dlang/dmd#12520 2021-05-18 01:13:52 +02:00
nordlow
1a72c4f83e Annotate std/net/isemail.d to please dlang/dmd#12520 2021-05-18 00:29:19 +02:00
The Dlang Bot
a01c94531e
Merge pull request #8079 from nordlow/fix-pure-scope-searching
Annotate std/algorithm/searching.d to please dlang/dmd#12520
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
2021-05-17 23:44:59 +02:00