Commit graph

718 commits

Author SHA1 Message Date
MoonlightSentinel
a5eda669b1 Fix 22489 - dtoh: Handle custom mangling for functions (and globals)
Explicit mangling provided via `pragma(mangle, "..")` cannot be mapped
to C++. For `extern(C)` function it's possible to emulate the behavior
by replacing the identifier with the custom mangling. This doesn't work
for `extern(C++)` functions, so they are ignored.

The same rationale + solution applies to global variables with custom
mangling.
2022-03-27 12:19:58 +00:00
MoonlightSentinel
c9d6c52853 Fix 22934 - Emit context pointer as outer instead of this
Because the latter is obviosly not a valid identifier.
2022-03-27 13:10:12 +08:00
MoonlightSentinel
48db76398c
Merge remote-tracking branch 'upstream/stable' into merge_stable 2022-03-27 03:55:23 +02:00
Dennis
41a739fd02
Fix issue 22027, 22840 - inout doesn't imply return (#12689) 2022-03-22 12:44:15 +02:00
MoonlightSentinel
aa42a6bfdb Fix 22868 - Let __traits(parameters) see past opApply delegates
Ensure that `__traits(parameters)` consistently returns the parameters
of the enclosing function and instead of the parameters of the
`opApply` delegate (leaking an implementation detail).

Also added a bunch of tests - the parts hidden by `version (Fixed)`
fail due to another bug.
2022-03-12 16:43:27 +00:00
Martin Nowak
b335e410c8 Merge remote-tracking branch 'upstream/stable' into merge_stable
Conflicts:
	src/dmd/lexer.d
2022-03-08 16:05:19 +01:00
Martin Nowak
f5152bc721 purge changelog 2022-03-07 23:18:23 +01:00
Iain Buclaw
5f23d63c59 Deprecate 'scope' as a type constraint on struct and enum declarations 2022-03-06 12:03:06 +00:00
Geod24
3f146303bb Changelog: Tweak the release notes for scope class deprecation
A common misunderstanding is the difference between scope at the usage site
and scope on class declaration. So be extra verbose to let the user know
what is deprecated and what is not. Also remove the mention of structs,
as 'scope' on struct doesn't seem to have any effect, and many people
don't even know it is possible.
2022-03-05 18:51:53 +01:00
Iain Buclaw
ddbe7e28e5 Deprecate 'scope' as a type constraint on class declarations 2022-03-05 12:04:02 +00:00
Iain Buclaw
519ea6b645 End deprecation period for D1 style overload operators 2022-03-05 07:49:34 +08:00
Iain Buclaw
06360636c0 Merge remote-tracking branch 'upstream/stable' into merge_stable 2022-02-26 15:39:10 +01:00
Iain Buclaw
154f0f1a18 End deprecation period for using 'alias this' for partial assignment. 2022-02-18 15:31:27 +00:00
Nick Treleaven
a3865eb2b4 [stable] [changelog] Add item for noreturn main 2022-02-18 14:16:53 +00:00
Nick Treleaven
b051cc64a5 [changelog] Fix using sequence, not tuple 2022-02-18 12:31:00 +00:00
Nick Treleaven
380f9d83ae
[changelog] Fix using sequence, not tuple (#13670) 2022-02-17 15:07:33 +02:00
Iain Buclaw
d91171841c End deprecation period for the 'delete' keyword 2022-02-17 02:00:04 +00:00
Iain Buclaw
92db4554e8 End deprecation period for 'scope' as a type constraint on interface declarations 2022-02-16 22:01:42 +00:00
Iain Buclaw
61c05095d5 dmd.typesem: Remove usage of 'this' and 'super' as types 2022-02-16 15:06:15 +00:00
Walter Bright
153f706dc1
fix Issue 22541 - DIP1000: Resolve ambiguity of ref-return-scope parameters (#13357) 2022-01-24 13:55:38 +02:00
Martin Kinkelin
2acf557096
Remove -unittest special cases wrt. template emission (#13224)
* WIP: Remove -unittest special cases wrt. template emission

* WIP

* WIP2

* WIP3

* WIP4

* WIP5

* Print full compiler command-line in case building the unit_test_runner executable fails

* WIP6

* WIP7

* Ignore unittest blocks in non-root modules

* Temporary: Test with enforced -allinst

* Revert "Temporary: Test with enforced -allinst"

This reverts commit 6f1a5302d7cb981654e55722860fae0ddadbbc07.

* Add comment as to why unittests in non-root modules are ignored

And ignore them for doDocComments/doHdrGeneration too, for
consistency.

* Add changelog entry
2022-01-24 12:00:34 +02:00
Max Haughton
ad2d9a2616
Fixed macro paren 2022-01-21 21:36:03 +00:00
Nicholas Wilson
3ff790c1bc
Merge pull request #13162 from MoonlightSentinel/noreturn/throw-expression-full
Implement throw expressions (DIP 1034)
2022-01-21 22:54:17 +08:00
Max Haughton
f02995ebac
Fix Issue 22291 - Implement __traits(parameters) (#13071)
* Fix Issue 22291 - Implement __traits(arguments)

* Changelog and add functions from changelog to tests

* Rename the delegate as it collides with something somewhere else apparently

* Traits args: Style, Tests, Changelog, add a fail_compilation

* Update frontend header

* Turn argument into parameter

* Frontend change also

* Rebase and indentation

* Review comments, changelog grammar, newline

* Fix nits

Co-authored-by: RazvanN7 <razvan.nitu1305@gmail.com>
2022-01-21 16:37:22 +02:00
Nicholas Wilson
7d1f4440f8
Produce MS Coff by default when targetting windows (#13110)
* Produce MS Coff by default when targetting windows

This rebases #12825 but doesn't attempt to rename phobos libraries and doesn't change the build infra where possible(and doesn't have a large diff in `link.d`). See if this fixes the CI issues.

* remove OMF piplines

* Update glue.d

* Update target.d

* Update target.d

* Update frontend.h
2022-01-21 10:09:52 +02:00
Walter Bright
59b4e39260
ImportC: add support for importing modules with __import (#13539) 2022-01-17 13:44:23 -08:00
Hiroki Noda
d56dc86c51 Fix Issue 22672 - Allow casting from TypeTuple to TypeTuple
Currently DMD does not allow casting to TypeTuple even if they
are the same type is.
This is a bit odd, so only allow it in certain case.

Co-authored-by: Boris Carvajal <boris2.9@gmail.com>
Co-authored-by: Razvan Nitu <razvan.nitu1305@gmail.com>
2022-01-14 18:31:18 +00:00
RazvanN7
c50cbf14a7 Rebase + add more information in the changelog entry 2022-01-10 14:48:59 +02:00
Walter Bright
7154c6ad77 add changelog for -vasm 2022-01-10 14:42:53 +02:00
dkorpel
2fd591de1c Turn switch case fallthrough into an error 2022-01-09 12:28:27 +00:00
MoonlightSentinel
b425f05e8c
Changelog entry for throw expressions 2022-01-07 18:17:48 +01:00
Dennis
bb8f969d3e
Fixup intpromote by default (#13363) 2021-11-29 11:25:44 +02:00
12345swordy
d5e0407249
Set the preview switch fix16997 to true now. (#13348)
* Set the preview switch fix16997 to true now.

* Add preview switch.

* Fix test suit

* Fix the reverthelp.d test

* Auto gen the frontend

* Fix changelog/fix16997.dd

* Corrected frontend.h

* Update fix16997.dd

Modify changelog

* Fix trimming of spaces for changelog/fix16997.dd

* Update fix16997.dd

Fix Title description tile for changelog and move some text around

* Remove empty line

* Update fix16997.dd

add markdown

* Update fix16997.dd

* single quotes

Co-authored-by: MoonlightSentinel <moonlightsentinel@disroot.org>
2021-11-26 09:17:28 +02:00
MoonlightSentinel
37ef8581e3 Implement the LDC specific __traits(initSymbol)
`__traits(initSymbol, S)` was introduced in ldc-developers/ldc#3774 and
provides access to the initializer symbol of `S` in a way that does not
rely on `TypeInfo` or other hacks.

This commit contains some small adjustments to the initial patch which
improve the user experience:

- generated `VarExp` points to the `TraitsExp` instead of the symbol LoC
- CTFE issues a specific error message
- rejects interfaces because they don't have an initializer symbol and
  hence cause linker failures
- more extensive tests

Co-authored-by: Nicholas Wilson <iamthewilsonator@hotmail.com>
2021-11-17 03:10:36 +00:00
Martin Nowak
08554f7dfa purge changelog 2021-10-10 14:43:07 +02:00
Dennis
1f0793e0d0
Pull 2.098 changelog fixes from master (#13113) 2021-09-30 17:18:35 +03:00
Iain Buclaw
9fb279b9ce dtoh: Do not emit aliases to declarations as typedef 2021-08-05 16:52:59 +00:00
dkorpel
05d2188ad1 Fix issue 15889 - Array bounds check should report index and length 2021-08-03 09:29:10 +09:00
Iain Buclaw
571d19269c End deprecation period for incorrect initialization of union when first member isn't marked (Issues 19919 and 19917) 2021-07-30 12:25:38 +00:00
Iain Buclaw
20c5bad402 End deprecation period for allocators
The error has now been moved to the grammar. However there are new
deprecations for when the only remaining allowed use of allocators is
not explicitly `@disable new();`
2021-07-24 13:30:21 +00:00
Iain Buclaw
860166df87 End deprecation period for modifying immutable variable from static this 2021-07-23 11:35:51 +09:00
Carsten Schlote
3556605e91
Add .i extension for preprocessed C files to known file extensions (#12879)
* Add .i extension for preprocessed C files to known set of file extensions

Added .i as extension for preprocessed C files, which can be fed directly
to DMD. The file is then processed as C source file.

Supporting .i as file exzension allows to preprocess C code with GCC -E and
store the output to some file for further processing by DMD.

* Update existing Changelog on 'importc' feature.

Add some example on how to use the '.i' suffix instead of the '.c' suffix
for C files using C includes. Result of C preprocessor can be saved as
'.i' file and used as input to DMD.

* Add some first simple test for importc with .i files passed on cmdline

* Hide preprocessed C files

* Changed importc test to use .i.in file to fake preprocessor

TODO: Find some preprocessor, which works on Windows and Max targets.

Co-authored-by: Carsten Schlote <carsten.schlote@leica-camera.com>
2021-07-17 08:10:00 +08:00
dkorpel
645e94fb84 turn mutable case variables into an error 2021-07-12 15:23:38 +08:00
MoonlightSentinel
f7155847e9 dtoh: Don't write visibilities inside of anonymous structs/unions
Because C++ rejects any declaration that is not a variable.
2021-07-09 11:25:28 +00:00
MoonlightSentinel
89ea20882f dtoh: Allow forward declaration of types used in ref parameters
They act like pointers and don't require a full declaration.
2021-07-09 10:08:10 +08:00
Florian
92fc29114c
dtoh: Don't crash for noreturn (#12794)
Ignore variables / functions using `noreturn` as done for imaginary
types and emit `char[0]` for members of type `noreturn`.
2021-07-01 21:50:04 +08:00
MoonlightSentinel
7bd880ca18
dtoh: Traverse UnaExp / BinExp instead of relying on toChars
This ensures that expressions requiring special handling are properly
emitted when nested into one of those expressions.
2021-07-01 00:06:40 +02:00
MoonlightSentinel
1e5c951f42 dtoh: Resolve symbols from TypeIdentifier
Ensures that the referenced symbol is emitted into the header file
if possible.
2021-06-29 23:55:41 +00:00
MoonlightSentinel
4970507d8f dtoh: Use writeIdentifier when writing VarExp that refer to...
... static members.

This ensures that the header generator writes the required prefix for
`__gshared` variables and also prevents the emission of static functions
outside of the enclosing aggregate.
2021-06-29 16:25:45 +00:00
MoonlightSentinel
77ce5edd9f dtoh: Properly emit static arrays in template declarations whose...
...  length is a constant (instead of a literal).

`int[SomeLength]` is parsed as `TypeAArray` even if `SomeLength` is later
resolved to be an integral constant instead of a type. This caused the
visitor to emit such symbols as `void*`.

This commit checks for such types and tries to resolve the "key" to
determine if it's actually an associative array.
2021-06-29 01:29:40 +00:00