Commit graph

138 commits

Author SHA1 Message Date
Teodor Dutu
fcff1b51ba
Translate _d_newarray{U,iT,T} to a single template (#15299)
* druntime: Copy array allocation functions to `core.internal.array.utils`

This copies `__setArrayAllocLength()`, `__arrayAlloc()` and moves
`__arrayStart()` and `__arrayClearPad()` to
`core.internal.array.utils.d`. This is needed because `_d_newarrayT()`
calls these functions from `rt.lifetime.d`, but the file cannot be
imported from `core.internal.array.creation.d`.

Signed-off-by: Teodor Dutu <teodor.dutu@gmail.com>

* Translate `_d_newarray{U,iT,T}` to a single template

This achieves the following:
- Convert `_d_newarray{U,iT,T}` to a single template `_d_newarrayT` that
handles arrays of elements that either have an init symbol or are
zero-initialised.
- Move compiler lowering to the semantic phase
- Store lowered expression in `NewExp.lowering`

Signed-off-by: Teodor Dutu <teodor.dutu@gmail.com>

---------

Signed-off-by: Teodor Dutu <teodor.dutu@gmail.com>
2023-10-24 10:44:55 +03:00
Hiroki Noda
c2cab2c54f
Fix Issue 24168 - Corrupted if TLS values are passed in ref parameters (#15705)
when compiling with -fPIE
2023-10-19 23:04:44 -07:00
Walter Bright
8f5764ecbf
fix Issue 24181 - reading double parameter from RCX rather than XMM1 (#15707) 2023-10-19 14:29:42 +08:00
Iain Buclaw
17f4e16386
test: Add missing EXTRA_FILES directives to tests (#15698) 2023-10-16 16:06:48 +08:00
SixthDot
966029fc75
fix issue 23733 - Can't use template type parameter as type of alias parameter (#15691) 2023-10-16 06:23:19 +08:00
Iain Buclaw
38ff7c08b3
Fix ICE: failed to detect static initialization of associative array (#15683)
When an associative array field initializer was evaluated by CTFE, then
its "lowering" would neither be generated, nor copied back out of CTFE.

This would cause an assertion failure in dmd at src/dmd/todt.d(491).
2023-10-15 16:54:30 +08:00
Mai-Lapyst
16ec9fe5c8
Fix issue 11070 - Allow declaration statement in a switch expression (#15656) 2023-10-09 08:02:34 +08:00
Walter Bright
622676c446
fix Issue 24154 - ImportC: useless expression parsed as invalid variable declaration (#15639) 2023-09-30 09:13:35 -07:00
Walter Bright
67fc169ea3
fix Issue 24129 - ImportC: MS-Link cannot handle multiple COMDATs with the same name (#15585) 2023-09-20 15:50:49 -07:00
Iain Buclaw
73ae278220 Merge remote-tracking branch 'upstream/stable' into merge_stable 2023-09-15 22:23:02 +00:00
Martin Kinkelin
fbafba8790
Fix Issue 24139 - 'this' corruption in extern(C++) dtor when destructing via TypeInfo_Struct (#15598)
For the `TypeInfo_Struct.xdtor` field, the linkage of the aggregate
itself plays no role; it's the linkage of the destructor that matters.

A real-life example for this is DMD's own `OutBuffer`.
2023-09-11 10:55:13 +03:00
Dennis
243aaef2f8
Fix 23103 - static initialization of associative arrays is not implemented (#15468)
* Fix 23103 - static initialization of associative arrays is not implemented

* Remove Phobos references in newaa.d

* Expand static AA support and tests

* Use minimized newaa implementation

* Test AA with immutable key/value

* Add semantic2done check before class initsem

* Add test for layout compatibility

* Address review comments
2023-08-31 15:18:22 +02:00
Teodor Dutu
b349b6d0de Fix Issue 24078 - Fold constants on array concatenation only for strings
Without this limitation, the code could incorrectly concatenate
`["c"] ~ "a" ~ "b"` as `["c"] ~ "ab"`, which was incorrect.

Signed-off-by: Teodor Dutu <teodor.dutu@gmail.com>
2023-08-19 10:21:56 +02:00
Walter Bright
f7b3fab00f
move object generation files away from extern(C++) (#15477) 2023-07-31 11:11:29 +03:00
Dennis
c3d0b1ff88
Fix 24056 - const uninitialized data at module scope is not in TLS (#15458)
* Fix 24056 - const uninitialized data at module scope is not in TLS

* Update tests

* Add changelog entry
2023-07-28 17:04:00 +02:00
Dennis
00c24a8ce8
Remove version(D_Version2) blocks (#15435) 2023-07-20 17:24:30 +02:00
Dennis
307be0b328
Merge stable (#15429)
* druntime: Restrict some `pragma(inline, false)` kludges to DMD only

They appear related to DMD's inlining at the AST level; LDC at least
doesn't need them, so let the optimizer decide for non-DMD backends.

* Fix little C++ header regression

* Expose VarArg.KRvariadic to C++ headers

* Revert "Deprecate alias this for classes v2 (#14812)" (#15326)

This reverts commit af7817b4ae.

* Add changelog for catch qualifier deprecation & update release no

---------

Co-authored-by: Martin Kinkelin <noone@nowhere.com>
Co-authored-by: Walter Bright <WalterBright@users.noreply.github.com>
Co-authored-by: Nick Treleaven <ntrel002@gmail.com>
2023-07-18 10:55:05 +02:00
Walter Bright
5387bc4ccd
Revert "Deprecate alias this for classes v2 (#14812)" (#15326)
This reverts commit af7817b4ae.
2023-07-17 17:52:31 +02:00
Iain Buclaw
4dccb4aa5d Merge remote-tracking branch 'upstream/stable' into merge_stable 2023-07-15 13:45:11 +00:00
Razvan Nitu
1a87f8d6e4
Fix Issue 22427 - betterC: casting an array causes linker error in string comparison (#15404)
* Fix Issue 22427 - betterC: casting an array causes linker error in string comparison

* Fix Issue 22427 - betterC: casting an array causes linker error in string comparison
2023-07-14 19:02:15 +03:00
Walter Bright
087f75255e
revert deprecation of scope class (#15380) 2023-07-12 10:37:42 -07:00
Walter Bright
815716022e
add ENDBR32 and ENDBR64 to inline assembler (#15401) 2023-07-11 11:22:36 +03:00
Walter Bright
4af038d305
revert deprecation of body (#15379) 2023-07-05 19:09:18 -07:00
Walter Bright
78dc82bca2
fix Issue 24026 - ImportC: ICE on nested C initializer 2 (#15375) 2023-07-05 21:19:09 +02:00
Walter Bright
9c7e5b18ef
fix Issue 24029 - ImportC: symbol name clash on statement expressions (#15378) 2023-07-04 11:15:48 +03:00
Boris Carvajal
cd636a4402
Fix Issue 24010 - Destructor called before end of scope for tuples (#15351)
Co-authored-by: Walter Bright <walter@walterbright.com>
2023-06-30 18:35:02 +03:00
Nick Treleaven
bb638373d6
Fix Issue 15436 - Compiler still refers to AliasSeq-s as "tuple"-s (#15363)
* Fix Issue 15436 - Compiler still refers to AliasSeq-s as "tuple"-s

Replace "tuple type" with "type sequence".
Replace "tuple" with "sequence".
Pretty print `AliasSeq!(args)`, not `tuple(args)`.
Leave json as "tuple" for now.
Also mention std.typecons.Tuple when trying to return a sequence.

Note: This does not rename any internal compiler symbols.

* Update runnable tests

* Update stringof tests

* Update remaining tests

* retrigger tests
2023-06-30 11:02:00 +03:00
Dennis
530e41b7a0
Refer to bugzilla issues by hyperlink (#15328) 2023-06-16 14:48:47 +03:00
Iain Buclaw
b71237be65 Merge remote-tracking branch 'upstream/stable' into merge_stable 2023-06-15 22:13:48 +00:00
Teodor Dutu
7a3fdf292f
Move lowerings to _d_array{setassign,assign_{l,r}} to a LoweredAssignExp AST node (#15295)
Move lowerings to `_d_array{setassign,assign_{l,r}}` to a `LoweredAssignExp` AST node

Signed-off-by: Razvan Nitu <razvan.nitu1305@gmail.com>
Merged-on-behalf-of: unknown
2023-06-13 12:10:47 +02:00
Walter Bright
cfbdc36d12
fix Issue 23719 - runnable/test22071.c:22:16: error: .abc. is a pointer; did you mean to use .->.? (#15287) 2023-06-01 14:06:41 +03:00
Razvan Nitu
2dc1a97c0a
Fix Issue 16384 - Invariant not called with multiple defined. (#15280) 2023-06-01 06:09:48 +03:00
Walter Bright
907521dabe fix Issue 21425 - Using va_start twice results in wrong values 2023-05-27 23:22:40 +02:00
Nick Treleaven
c4dada4ea7 Fix optional type & parameters for function literal 2023-05-18 01:39:19 +02:00
Iain Buclaw
edfa97d800 Merge remote-tracking branch 'upstream/stable' into merge_stable 2023-05-16 10:17:06 +00:00
Walter Bright
b8c839e9f2
fix Issue 23877 - ImportC: Importing byteswap.h results in undefined reference to core.bitop.byteswap (#15224) 2023-05-11 14:06:00 +03:00
Boris Carvajal
6d36ef819d Fix Issue 20687 - Allow member function address as const initializer of static data 2023-05-10 05:45:25 +02:00
Walter Bright
7e4656324f
Issue 23889 - ImportC: alloca() not supported (#15191) 2023-05-08 12:33:22 +03:00
Rainer Schuetze
3072e43d2b
fix issues 20737 and 23014 - TLS variables unusable with -betterC/importC for Windows MSVC targets (#15170)
always generate access via __tls_index
2023-05-04 15:17:10 +03:00
Nick Treleaven
0659c9b577
Fix Issue 21415 - catch immutable exceptions breaks immutable (#14707)
* Fix Issue 21415 - catch immutable exceptions breaks immutable

* Disallow catching inout and shared too

* Workaround catch(shared) in eh2.d
2023-05-02 13:50:55 +02:00
Dennis Korpel
760f297924 Fix 19454 - Name collisions with unnamed function parameters 2023-05-01 18:42:25 +02:00
Teodor Dutu
1db1ba87fd
Translate _d_arraycatnTX to a template (#14550)
This brings the following changes:
- Improves the existing template `_d_arraycatnTX`, to now concatenates
both arrays and single elements
- Changes the lowerings to `_d_arraycatT` to use the new template
- Moves the lowering logic to `_d_arraycatnTX` to expressionsem.d
- Adds a new field to `CatExp` called `lowering` to store the template
  lowering
- Removes the old non-template `_d_arraycatnTX` and `_d_arraycatT` hooks
- Moves `test19688.d` from `runnable/` to `compilable/` until
https://issues.dlang.org/show_bug.cgi?id=23408 is fixed

Signed-off-by: Teodor Dutu <teodor.dutu@gmail.com>
2023-04-28 10:33:48 +03:00
Walter Bright
ee1ff1b88c
fix Issue 23837 - importc fails to link on windows x86 but successes on x64 (#15126) 2023-04-26 11:39:57 +03:00
Walter Bright
2d8381cbe2
fix Issue 23055 - importC: using compound-literal array as pointer in CTFE gives 'dereference of invalid pointer' (#15121)
* fix Issue 23055 - importC: using compound-literal array as pointer in CTFE gives 'dereference of invalid pointer'

* fix Issue 23055 - importC: using compound-literal array as pointer in CTFE gives 'dereference of invalid pointer'
2023-04-25 12:57:41 -07:00
Dennis
8f9e710ff9
Fix 21667 - scope parameter causes 'no size because of forward references' (#14561) 2023-04-17 12:59:44 +03:00
Walter Bright
6f9d321598
fix Issue 23402 - importc function definitions from includes can cause D name conflicts (#15101) 2023-04-13 12:17:15 -07:00
Steven Schveighoffer
525d90aef9
Fix issue 11989 -- deprecate TickDuration, it's no longer used anywhere. (#15024) 2023-04-07 11:50:13 +03:00
Walter Bright
5a79fff38f
fix Issue 23014 - importC: static thread-locals do not work (#15069) 2023-04-04 13:15:58 +03:00
Iain Buclaw
58fc94f010 Merge remote-tracking branch 'upstream/stable' into merge_stable 2023-04-01 18:22:19 +00:00
WebFreak001
498822ec8e Fix issue 14891 - profilgc to stdout not working
Improves error message for diagnostics and tests it
2023-03-22 16:55:47 +01:00