Commit graph

726 commits

Author SHA1 Message Date
Tim Schendekehl
33286cccd8
Fix issue 18919 - __FILE__ and __LINE__ should work when used in default argument expressions (#15968)
The parser now always creates AST nodes for default init expressions
like __FILE__. They are replaced in resolveLoc. Variable inDefaultArg
in Scope is used, so the nodes are not replaced too early.
2024-01-07 23:57:48 +01:00
Nick Treleaven
dea9e0e586
Deprecate string literals as (static) assert conditions (#15860)
* Deprecate string literals as assert conditions

Fix Issue 14387 - Disallow string literals as assert conditions

* Avoid running expression semantic, only deprecate literals

Ignore enum strings.

* Fix runnable test
2023-12-29 18:10:55 +01:00
Dennis
14ecea9ea7
Add @standalone attribute for module constructors (#15537)
* Add `@__standalone` attribute

* Remove underscores from __standalone
2023-12-22 11:03:03 -08:00
Martin Kinkelin
cf9df8437c Makefiles: Add comments wrt. usage on Windows and a few example invocations 2023-12-18 07:29:32 +08:00
Martin Kinkelin
7914f70da8 Add changelog entry 2023-12-18 07:29:32 +08:00
Martin Kinkelin
254de93ac8 Makefile: Include druntime in install target 2023-12-18 07:29:32 +08:00
Martin Kinkelin
fa9731559a Add changelog entry 2023-12-12 01:32:21 +01:00
Adam D. Ruppe
2d42fdbcf8 make pragma great again 2023-12-08 15:07:33 -05:00
richard (rikki) andrew cattermole
2625a1607c Initial attempt at stdatomic.h 2023-12-08 12:45:28 +01:00
Iain Buclaw
b932359777 Merge remote-tracking branch 'upstream/stable' into merge_stable 2023-12-02 13:56:46 +00:00
Iain Buclaw
724e0051bb purge changelog 2023-12-02 13:56:36 +00:00
Teodor Dutu
055accfbe6
Translate _d_newarray{mTX, miTX, Op} to a single template (#15819)
- Move code for `_d_newarraymTX` to `core.internal.array.construction`
- Remove `_d_newarraymiTX` and `_d_newarraymOp`
- Add unittests for `_d_newarraymTX`
- Move lowering to `_d_newarraymTX` to the semantic phase
- Inline the lowering when inlining `NewExp`s
- Add changelog entry about the new hook

Signed-off-by: Teodor Dutu <teodor.dutu@gmail.com>
2023-11-17 09:57:30 +02:00
Teodor Dutu
265a72629c
changelog: Describe the template _d_newarrayT (#15729)
Signed-off-by: Teodor Dutu <teodor.dutu@gmail.com>
2023-10-30 16:20:34 +02: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
Ernesto Castellotti
a2695d8822
Add Intel CET to getTargetInfo (#15433)
This follows PR #15415 which added Intel CET IBT support and
LDC PR #4437 to add support for the new CET target in order
to maintain a common interface between DMD and LDC.

Later it would be useful to do the same for GDC as well.
2023-08-27 10:35:41 +02:00
Walter Bright
622a432974
fix Issue 24084 - Add -nothrow Switch to Compiler (#15536) 2023-08-17 17:28:56 -07:00
Nick Treleaven
b677368227 [stable] Make enum function a deprecation, not an error (#15533)
[stable] Make enum function a deprecation, not an error

Signed-off-by: Dennis <dkorpel@users.noreply.github.com>
Signed-off-by: Vladimir Panteleev <CyberShadow@users.noreply.github.com>
Signed-off-by: Petar Kirov <PetarKirov@users.noreply.github.com>
Merged-on-behalf-of: Vladimir Panteleev <CyberShadow@users.noreply.github.com>
2023-08-15 23:23:08 +01:00
Iain Buclaw
6fee5868f2 dtoh: Always refer to default arguments using their FQN.
Static variables used in a default argument context are now emitted using
their fully qualified name. This is to avoid generating ambiguous
assignments, for instance:
```
struct S
{
    __gshared int param;
    void example(int param = S.param);
}
```
In the above example, the visitor for dtoh VarExp will omit the `S`
parent, as the static field is nested in `S`.
```
    void example(int param = param);
```
Although D understands that `param` refers to the static field, this is
not the case in C++, and the compilation will fail with:
```
error: parameter 'param' may not appear in this context
```
2023-08-04 07:51:19 +08:00
Nick Treleaven
3f572825e6 Add changelog for #15493 2023-08-04 01:49:57 +02:00
Iain Buclaw
e7932f2c02 Merge remote-tracking branch 'upstream/stable' into merge_stable 2023-08-01 23:22:42 +00:00
Iain Buclaw
9775bca012 purge changelog 2023-08-01 23:22:34 +00:00
Dennis Korpel
cb0b9bf63b Make non-scope constructor a DIP1000 error 2023-08-01 15:10:43 +02: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
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
Nick Treleaven
2288effb5b Add changelog for catch qualifier deprecation & update release no 2023-07-18 08:17:52 +08:00
Nick Treleaven
8fe5144813
Fix Issue 13063 - enum is allowed as storage class for functions (#15405)
* Fix Issue 13063 - `enum` is allowed as storage class for functions

* Remove enum from unrelated test

* Add changelog
2023-07-14 14:39:56 +03:00
Jacob Carlborg
17fc037fc2
Add predefined version identifier for visionOS (#15371)
This is Apple's new operating system for their VR/AR device Vision Pro.
2023-07-03 17:26:30 +02:00
Dennis
3afdc87093
Add changelog entry for linux input headers (#15340) 2023-06-22 07:50:10 +03:00
FeepingCreature
36043ded81
Make 'private function is not accessible' deprecation an error. (#15319)
Affects issue 21275, 23947.
2023-06-16 14:51:14 +03:00
Vladimir Panteleev
7cdae6e3bb
Add Valgrind GC integration (#15304)
* rt.minfo: Avoid calling realloc with size 0

This is not portable, and memcheck complains about this.

* Add C Valgrind API

Add the BSD-licensed C header files which provide the API for
controlling Valgrind from within programs executed under it.

The files are from Valgrind v3.21.0.

* Add some D bindings for the Valgrind C API

We will use these in the GC implementation to tell Valgrind which
memory operations are OK or not.

* Silence Valgrind warnings caused by GC marking

Allow the conservative GC to scan memory, whether it has been
initialized by the application or not.

* Add test suite for Valgrind

* Unify VALGRIND with MEMSTOMP

The two share the same goal: mark memory which should not be accessed
any more.

* Mask "invalid" access to free lists

The GC stores free lists in the cells of the objects on the list.

We would like to allow the GC to work with these lists, but still
raise a warning if application code attempts to access them.

* Distinguish between writable and unwritable invalidation

Freshly allocated memory should be writable but not readable.

Explicitly deallocated or GC-ed memory should be neither readable or
writable.

* Add use-after-free test

* Invalidate freshly-allocated memory

* Integrate VALGRIND with SENTINEL

* Fix reporting of arrays of structs with destructors

* Re-invalidate reused blocks during malloc/calloc

* Add Changelog entry

* .pre-commit-config.yaml: Exempt vendored files

* etc.valgrind.valgrind: Propagate return values of the vbits functions

* etc.valgrind.valgrind: Add documentation for functions

Copy/adapt the documentation in memcheck.h.

* druntime/test/valgrind: Add no_use_after_gc test

* ci/cirrusci.sh: Install Valgrind on Linux

Run the Druntime Valgrind integration tests.

libc6-dbg is needed to allow Valgrind to redirect certain functions.

* etc.valgrind.valgrind: Add @nogc

Although the GC is the primary user, this is not a restriction of
these Valgrind API wrappers.

* druntime/test/valgrind: Fix no_use_after_gc test with -release

Trick the optimizer to pretend we're doing something with the result
of those invalid memory accesses.
2023-06-15 01:01:42 -07:00
Iain Buclaw
a73e70fe84 Merge remote-tracking branch 'upstream/stable' into merge_stable 2023-06-02 10:20:46 +00:00
Iain Buclaw
915317a398 purge changelog 2023-06-02 10:05:13 +00:00
Dennis Korpel
928a03bd14 Turn overloading extern(C) functions into an error 2023-05-10 16:48:32 +02:00
Paul Backus
5bee22eab7 Add changelog for assignment-style alias this 2023-05-10 11:43:19 +02:00
Dennis
fa520ba04f
Turn semicolon as empty statement into an error (#15072) 2023-04-04 13:13:44 +03:00
Iain Buclaw
58fc94f010 Merge remote-tracking branch 'upstream/stable' into merge_stable 2023-04-01 18:22:19 +00:00
Iain Buclaw
f6a9e8c244 purge changelog 2023-04-01 18:16:29 +00:00
Dennis
2dcc6b9f87
Fix 17374 - Improve inferred attribute error message (#15051) 2023-03-31 11:32:42 +03:00
Dennis
ef1bca90e0
Parse UDAs like template arguments (#14881) 2023-03-29 22:23:45 -07:00
Nick Treleaven
7d6ac55712
Fix Issue 12118 - Modify immutable data using throw (#14706)
* Fix Issue 12118 - Modify immutable data using throw

* Change immutable test to const

* Deprecate throwing any qualified type

* Allow throw shared as std.concurrency does that

* Use static this instead of static const for test

* Only allow single shared qualifier or none

* Add changelog

* Disallow throwing shared objects too

* Update changelog/dmd.throw-qualifier.dd

Co-authored-by: Razvan Nitu <razvan.nitu1305@gmail.com>

---------

Co-authored-by: Razvan Nitu <razvan.nitu1305@gmail.com>
2023-03-13 17:42:18 +02:00
Mathias LANG
eca46c71ad
dmd: Deprecate 'in' parameters on non-extern(D,C++) functions (#14951)
This error was introduced in `-preview=in` in v2.101.0.
In order to make `-preview=in` the default, we add a deprecation
even if `-preview=in` is not used.
2023-03-08 10:57:41 +02:00
Mathias LANG
879e20f321
Deprecate 'in ref' to prepare for -preview=in (#14931)
This should nudge people into using '-preview=in' and clear up
the remaining projects which are incompatible with it.
2023-03-07 11:51:36 +02:00
Dennis
9efc250901
Deprecate -preview=dip25 switch (#14891) 2023-02-22 11:24:39 +02:00
Dennis
43fb0474cb
Revert "fix Issue 23558 - add __traits(getModuleClasses [, module name]) (#14699)" (#14892)
This reverts commit 450ba046cf.
2023-02-22 11:14:34 +02:00
Razvan Nitu
af7817b4ae
Deprecate alias this for classes v2 (#14812) 2023-02-15 13:28:28 +02:00
Walter Bright
450ba046cf
fix Issue 23558 - add __traits(getModuleClasses [, module name]) (#14699) 2023-02-09 11:53:43 +02:00
Walter Bright
f1b70f41f7
fix Issue 23545 - export int a; should generate dllexport, not dllimport (#14680) 2023-02-07 16:27:41 -08:00
Walter Bright
300ba0c0b8
ImportC: add __check(assign-expression) extension (#14026) 2023-02-07 12:57:43 +02:00
Iain Buclaw
d0a1cc404c Merge remote-tracking branch 'upstream/stable' into merge_stable 2023-02-01 20:31:50 +00:00
Iain Buclaw
49ee6fdb76 purge changelog 2023-02-01 20:31:39 +00:00