Commit graph

15909 commits

Author SHA1 Message Date
Ate Eskola
95d19d97ac Fix issue 23250 - corrected reginal indicator pairing. 2022-07-15 16:53:51 +03:00
Razvan Nitu
494b318c0a
Merge pull request #8502 from GrimMaple/issue_22637
Fix Issue 22637 - std.conv `to!double` and `parse!double` dont throw on under/overflow
2022-07-12 11:44:13 +03:00
Grim Maple
1c3903c2e6 Fix Issue 22637 - std.conv to!double and parse!double dont throw on under/overflow
This happened because `parse` enforced on real.
And provided number actually fits real.
Changed to enforce on `Target` type instead
2022-07-09 18:09:25 +03:00
Iain Buclaw
a9a504f406 Merge remote-tracking branch 'upstream/stable' into merge_stable 2022-07-09 17:08:41 +02:00
Grim Maple
553d8cb56c Fix Issue 18631 - std.random.choice does not work with const arrays
`auto ref` is not needed on `Range` param
2022-07-07 15:38:21 +00:00
Razvan Nitu
7e0dbdf1a3
Merge pull request #8500 from RazvanN7/fix_scope_failure
Use try-catch instead of scope(failure) for block that returns
2022-07-07 16:08:38 +03:00
RazvanN7
52935b182a Use try-catch instead of scope(failure) for block that returns 2022-07-07 15:28:43 +03:00
Geod24
87c6e7e354 std.sumtype: Move TagTuple to module level to reduce instantiations
TagTuple wass previously nested within matchImpl, meaning it gets
a different instantiation for each match call with different handlers.
This is not required, as the only template parameters it needs are
the SumTypes being used. In practice, we might even get away with
using the length, but the gain is likely to be marginal compared
to the gains from moving it out of matchImpl.
Another underlying motivation for this change is that it works around
a compiler bug triggered with complex code using const SumType
(the compiler complains that 'this' for 'invariant' is of the wrong type,
const vs non-const).
2022-07-07 00:05:35 +00:00
Iain Buclaw
1516ecad93 std.complex: Use complex(LN10) as divisor in log10 2022-07-05 23:25:40 +00:00
Iain Buclaw
ff16d73e4c std.math.exponential: Fix coefficients for log2 and log10 2022-07-05 23:24:50 +00:00
Iain Buclaw
0497537e22 std.math.exponential: Split generic logN implementations to own impl templates 2022-07-05 10:37:31 +02:00
Iain Buclaw
682e16d3ec std.math.exponential: Implement pure logb() for double and float precision 2022-07-04 23:48:56 +00:00
WebFreak001
73589e6f81
fix Issue 23215: segfault in std.file.remove 2022-06-28 13:15:30 +02:00
Su
a4a18d21c4
preallocate oom error (#8480)
* preallocate oom error

fixes issue 23196.

unfortunately, while i believe it should be possible to make this function `@nogc nothrow` [since we are throwing an error, which cannot be recovered from], i wasn't able to figure out how to get enforce to realise it. advice would be greatly appreciated on this front.

* undo wording change

* Update stdio.d

use onOutOfMemoryError instead of custom implementation

* nogc nothrow

* style fix

* remove unneeded variable

* remove unused import
2022-06-22 06:33:10 +01:00
Dennis Korpel
e34f88f64d Add missing return scope to std.file 2022-06-22 02:27:36 +00:00
Tomáš Chaloupka
9ac9d359ac Fix 23132 - Avoid ranges copy when compared for equality 2022-06-21 15:09:48 +00:00
Mathias LANG
16cacff3e6
Merge pull request #8478 from Ast-x64/numeric-quadruple
std.numeric: Hack with quadruple-precision real type
2022-06-18 15:31:37 +02:00
Ast-x64
f27f15b075 std/numeric.d: Add tests for real type 2022-06-18 09:43:52 +08:00
Ast-x64
f50d7dfe62
std/numeric.d: Reorder alignment for BigEndian
Co-authored-by: Iain Buclaw <ibuclaw@gdcproject.org>
2022-06-18 01:15:59 +08:00
Ast-x64
c5d80bae52
std/numeric.d: Make isIEEEQuadruple private
Co-authored-by: Iain Buclaw <ibuclaw@gdcproject.org>
2022-06-17 21:38:33 +08:00
Ast-x64
a7f3230e95
std/numeric.d: Use a more sensible padding array
Co-authored-by: Luís Ferreira <contact@lsferreira.net>
2022-06-17 10:02:12 +08:00
Ast-x64
0c56468d19 RISCV: Fix wrong ExceptionMask values
According to RISCV specifications
https://riscv.org/wp-content/uploads/2019/12/riscv-spec-20191213.pdf,
figure 11.2, the mask flags should be NX, UF, OF, DZ, NV in order.
2022-06-16 20:22:10 +00:00
Ast-x64
b2d5da9c43 Extend floating point precision in some tests
These tests may work better with quadruple-presicion real types now.
2022-06-16 19:53:02 +00:00
Ast-x64
488761d86a std.numeric: Hack with quadruple-precision real type
The CustomFloat should be converted to real before most operations, but
there is no support for convertions of real types with
quadruple-precision (e.g. real type on RISCV64 platform). As the
significand is stored using 112 bits, which cannot fit in a ulong type
(CustomFloat do not allow significand more than a ulong), we should only
use the highest 64 bits of significand (this may cause presicion loss
	from real type, but is enough for what CustomFloat can support
	at most). So add 48 padding bits by declaring a uint and a
ushort before the significand, and set align(1) in this case.
2022-06-17 00:57:40 +08:00
Dennis Korpel
f54e0cd163 Issue 23190 - make some std.file unittests @safe 2022-06-16 11:39:29 +00:00
Robert burner Schadek
1f0ec5405f remove compile features from std.experimental.logger
Fix Iain comment

Razvan suggest changelog fix
2022-06-14 16:42:40 +00:00
Paul Backus
a504a5e7d6 Fix Issue 23182 - Can't assign struct with opAssign to SumType in CTFE
SumType.opAssign now avoids calling core.lifetime.move or
core.lifetime.forward during CTFE whenever possible.
2022-06-14 04:38:57 +00:00
Razvan Nitu
1206fc94f9
Merge pull request #8470 from dlang/9il-patch-2
nogc biguintx86.d
2022-06-09 15:00:35 +03:00
João Lourenço
5e746a0490
test(sumtype): utilize D_Invariants conditional compilation
Signed-off-by: João Lourenço <jlourenco5691@gmail.com>
2022-05-30 10:35:07 +01:00
Walter Bright
28bf65292c add scope to MmFile constructors 2022-05-30 05:43:57 +00:00
Ilia Ki
f522ea4fcc
ditto 2022-05-29 22:07:47 +04:00
Ilia Ki
a9baa6aa3e
Update biguintx86.d 2022-05-29 21:59:57 +04:00
Hiroki Noda
d46814c863 Add std.int128 to std module 2022-05-20 16:26:52 +00:00
Luís Ferreira
96858b5dde
chore(utf): documentation of byUTF is wrong about thrown exceptions (#8464)
chore(utf): documentation of byUTF is wrong about thrown exceptions

Signed-off-by: Dennis <dkorpel@users.noreply.github.com>
Merged-on-behalf-of: Dennis <dkorpel@users.noreply.github.com>
2022-05-19 09:48:24 +00:00
Luís Ferreira
3c3f40847c chore(std): add std.checkedint to std module
Previous change that moved std.checkedint out of experimental stage
didn't added the module to the list of modules on std module
`std/package.d`. This patch does that.

Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2022-05-19 09:24:26 +00:00
yori
b22224db3f Added @nogc to thisProcessID and thisThreadID in std.process 2022-05-16 21:21:20 +00:00
Martin Kinkelin
b20444aca4 Use new __traits(classInstanceAlignment)
Tackling the Phobos part of issue 16508.
2022-05-13 18:38:09 +00:00
João Lourenço
d39c4ea290
test(sumtype): add unittests when returning the matched value's reference
Signed-off-by: João Lourenço <jlourenco5691@gmail.com>
2022-05-11 21:23:57 +01:00
João Lourenço
6069c44930
fix(sumtype): template canMatch does not account for ref when matching
The template `canMatch` does not account for `ref`.
The template `valueTypes` stores all types of the member values and uses SumTypes's `get` function, which returns a `ref`.
However, ref does not persist and the type is not sent to `canMatch` as a `ref`.
Because of this, when matching, `canMatch` will fail as it will test for a copy, and returning a reference of that value results in escaping it.

Fix Issue 23101

Signed-off-by: João Lourenço <jlourenco5691@gmail.com>
2022-05-10 20:25:46 +01:00
Luís Ferreira
a56287dd8b chore(math/exponential): avoid import constants if not InlineAsm_X87
Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2022-05-09 18:44:14 +00:00
Luís Ferreira
19c6e8d251 chore(math/hardware): align spaces by 4 instead of by 3
Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2022-05-09 18:42:23 +00:00
Vladimir Panteleev
3121a99e19 std.socket: Always compile slow unit tests 2022-05-08 08:25:36 +00:00
Steven Schveighoffer
f712d16b0a
Add scope decorations to std.socket (#8438) 2022-05-07 20:28:19 +08:00
Carsten Schlote
ad93dd0305 Fixed linter issue on style 2022-04-29 17:26:56 +02:00
Carsten Schlote
f434dc3cae Add custom fill value to std.outbuffer.OutBuffer class
Extend the fill, alignSize, align{2,4} methods of `std.outbuffer.OutBuffer` to specify value to write
when filling (up to an alignment).

For flash device images it is desirable to use 0xff as the fill value,
because 0xff is the value of the unprogrammed flash memory cell. Padding
with 0 requires to programm the flash cell from 0xff to 0x00, which
increases wear and tear on the flash memory device. Usually there is some
larger block at the end if the flash memory image, which must be padded
up to the size of the flash device (usuallay a power of two). Instead
of padding with 0x00 the PR allows to fill with 0xff instead.

There might also be other use-cases, where it might be reasonable to fill
the alignment gaps with some other value than 0x00, e.g. when debugging
and viewing output data in a hex editor. It is easier to spot gaps, when
the padded spaces contain a custom value like 0x55 or 0xaa.

A new fill method was added, which allows filling with a user-defined value
instead of the 0 as in the previous implementation.
2022-04-29 12:57:10 +02:00
chloekek
707eb37656 Issue 22986: Mark ErrnoException.errno as scope
This allows retrieval of the error number when compiling with -dip1008.
2022-04-27 18:55:50 +00:00
Hiroki Noda
5429908c4a Fix: add missing FunctionAttribute 2022-04-25 15:22:59 +00:00
RazvanN7
d2c3da6d50 Fix Issue 20182 - [REG 2.086.0] std.traits.ParameterDefaults fails for copy constructor of nested struct 2022-04-18 22:26:49 +00:00
Razvan Nitu
dc6fcbd8ef
Merge pull request #8426 from WalterBright/int128
add std.int128 a 128 bit integer arithmetic type
2022-04-18 09:18:31 +03:00
Dennis
0745f76249
Merge pull request #8431 from dkorpel/fix-std-path-variadic-test
Fix std.path unittest returning dangling pointer
2022-04-17 09:02:56 +02:00