Commit graph

40602 commits

Author SHA1 Message Date
Walter Bright
bdd45686de
reals do not fit in XMM registers (#21288) 2025-04-22 15:34:19 +08:00
Elias Batek
3ad50a0b08
Bump Ubuntu to 22.04 for GHA workflow runnable_cxx (#21286) 2025-04-22 07:18:07 +08:00
Iain Buclaw
48acb53296 druntime: Move syscall bindings in perf_event to own module 2025-04-22 06:30:55 +08:00
Walter Bright
b0ed73d783 more cases of creating complex expressions 2025-04-21 21:40:15 +08:00
Walter Bright
4379255e45 use OPpair instead of OPadd to form complex type 2025-04-21 10:03:10 +08:00
Walter Bright
4aa543a2a2
load 128 bit floating point constants from global (#21279) 2025-04-20 17:34:28 -07:00
abul
ddb917f8e8 Template function named argument error messages 2025-04-21 07:01:22 +08:00
Walter Bright
283547e3af
calling compiler helper functions now works (#21276) 2025-04-20 09:35:50 -07:00
Walter Bright
4c2d438f75
add ability to call helper functions (#21275) 2025-04-19 20:23:18 -07:00
Walter Bright
6208d4da8d
initial support for 128 bit floats (#21269) 2025-04-19 16:48:01 -07:00
drpriver
856d4921a0 Fix #21271 - ImportC: incorrect compatibility macro for __pragma
Fixes https://github.com/dlang/dmd/issues/21271

Redefine the compatibility macro in terms of C99's `_Pragma()`
instead of ignoring it. Clang and GCC will replace `_Pragma()`
with `#pragma` directives in the preprocessed output, while
cl.exe will actually convert it back to `__pragma()`.

This is still a better situation than before as ImportC partially
supports `__pragma()`.
2025-04-19 18:37:13 +08:00
drpriver
dfe501dde6 Fix #21267: ImportC: __forceinline ignored
Fixes https://github.com/dlang/dmd/issues/21267

`__forceinline` is the same as `__attribute__((always_inline))`,
so `#define` it to be the same.
2025-04-19 17:09:14 +08:00
drpriver
0845912f27
Fix #18263: ImportC fails when DMD is installed in path with spaces (#21263)
Fixes https://github.com/dlang/dmd/issues/18263

Command to invoke the preprocessor wasn't quoting paths.

This isn't bulletproof and really the interface should be taking an
array of strings or use a command-builder type pattern, but this
resolves the common issue of paths with spaces in them.
2025-04-18 21:35:39 +02:00
Nick Treleaven
011c27165e
Fix wrong 'not an lvalue' error when assigning to sequence (#21260)
Fixes #21259.
2025-04-18 20:29:13 +08:00
Abul Hossain Khan
bc3c423fd7
Fix error location for binary operations to point at operator instead of first operand (#21253) 2025-04-18 07:24:30 +08:00
Walter Bright
93d2e53e94
fix offsets in prolog_saveregs/restoreregs (#21251) 2025-04-17 16:35:25 +08:00
Walter Bright
d6602a6b0f
fix #21203 Placement new does not count as initialization (#21243) 2025-04-16 15:14:46 +08:00
drpriver
1244ef260b
Fix #21241 - ImportC: wrong static function called after linking (#21242)
Fixes https://github.com/dlang/dmd/issues/21241

C Static functions were being given the same externally mangled
name as their identifier, which caused only one to be picked
when linking with linkers that supported that.

Additionally, the dmd glue code was only outputting one of these
static functions as a workaround for a different linker issue.

Solve this by giving C static functions a unique name (by using D
mangling) and adding an `isStatic()` check to the dmd glue hack.
2025-04-16 10:13:50 +08:00
drpriver
5fd0d29211
Fix #20502 - importc: macro conflicts with struct of same name (#21234)
Fixes https://github.com/dlang/dmd/issues/20502

Similar to VarDeclarations, don't let TemplateDeclarations from
C defines shadow a real symbol.
2025-04-16 07:27:33 +08:00
Matthew Qiu
e5de57e518
Moved Dsymbol.oneMembers to dsymbolsem (#21238) 2025-04-15 20:22:18 +08:00
Matthew Qiu
1fe1cac81b
Moved VarDeclaration.checkNestedReference to funcsem (#21237) 2025-04-15 19:46:48 +08:00
Matthew Qiu
c296cb1ec2
Moved _foreach and indirect dep getLocalClasses from dmodule to dsymbolsem (#21236) 2025-04-15 19:30:15 +08:00
Albert24GG
03c8f2723f
Templatize _d_arraysetcapacity hook (#21143) 2025-04-15 18:07:47 +08:00
Abhay Pratap
513293b0d8
dcast.d: Improve pointer conversion error messages (#21221) 2025-04-15 18:03:44 +08:00
drpriver
f4ca164257
Fix #20499 - [ImportC] typedef struct with name as a pointer cannot be used with struct name (#21232)
Fixes https://github.com/dlang/dmd/issues/20499
Fixes https://github.com/dlang/dmd/issues/20963

ImportC deferred declaring "tagged" types (structs/unions/enums)
until after it saw a possible typedef so that the identifier for
a typedef declaration like:

    typedef struct { int x; } Foo;

would give the struct the name Foo. In several circumstances,
this led to tagged types not being declared. Resolve this by
chasing down those circumstances.

Also, there were other circumstances where types weren't being
correctly declared which caused other issues. Lock those down.
2025-04-15 15:31:21 +08:00
Walter Bright
c30def82bd
fix ldr/str floating point registers (#21235) 2025-04-15 15:30:53 +08:00
Abul Hossain Khan
d0cf2c7117
Add Testcases For other Fixed issues (#21231) 2025-04-14 23:17:17 +02:00
drpriver
292019346b
Fix 21225: ImportC: macro interpreted as an enum conflicts with function (#21228)
Fixes https://github.com/dlang/dmd/issues/21225

Don't let C macro variable declarations shadow any symbol.
2025-04-14 16:37:38 +08:00
Abul Hossain Khan
d657667ff8
Report correct location for undefined identifiers in function return types (#21223) 2025-04-14 16:08:52 +08:00
Walter Bright
5fcca3e152
add floatPost() (#21227) 2025-04-14 14:35:36 +08:00
drpriver
8a8746f318
Fix 18127 - ImportC: redeclaration of struct in different translation unit doesn’t check compatibility (#21224)
Fixes: https://github.com/dlang/dmd/issues/18127

When merging struct definitions from different C imports, check that the
structs are actually compatible according to the C rules. If they are
not, issue an error.
2025-04-14 14:35:20 +08:00
Walter Bright
605fb8bf5b
change mscoffobj.d to more D style (#21218) 2025-04-12 22:25:38 -07:00
Walter Bright
f5ef1eb0da
upgrade obj_mangle2() to use OutBuffer (#21209) 2025-04-12 17:38:28 -07:00
Emily
b553068344
Changed author name to new one (#21217)
I have changed my name and would not like to have
anything public associated with my old name.

Signed-off-by: Emily <info@emy.sh>
2025-04-13 08:23:30 +08:00
drpriver
6c3860ef32
ImportC: Fix interaction of aligned and packed structs (#21204)
Previous iteration of this did not properly account for the interaction
of aligned and packed and would even segfault on a null access in such
a case. This version properly handles that interaction by aligning the
struct itself instead of the first member and not forcing the struct
alignment to 1 if it is packed.
2025-04-13 06:55:56 +08:00
Walter Bright
346a772985
fix #21161 placement new fails on default-init struct (#21212) 2025-04-12 20:21:01 +08:00
drpriver
d66ef6a26d
Fix #21210 - ImportC: Initializing struct containing array with = {0} fails (#21211)
Fixes https://github.com/dlang/dmd/issues/21210
2025-04-12 19:17:24 +08:00
Martin Kinkelin
ce6cef9762
Merge pull request #21202 from kinke/merge_stable
Merge stable
2025-04-12 13:04:54 +02:00
fossdd
81dd72b2a3
druntime: add support for musl RISCV64 (#21213)
Based on https://git.musl-libc.org/cgit/musl/tree/arch/riscv64/bits?h=v1.2.5
2025-04-12 18:01:30 +08:00
Martin Kinkelin
7d368925cc Merge remote-tracking branch 'origin/stable' 2025-04-12 11:55:36 +02:00
Sönke Ludwig
09ed02ce56
Fix segmentation fault on macOS 15.4 (#21176)
Strips off additional bits that are not part of the actual TLV key to avoid applications using DRuntime crashing during initialization.

Fixes #21126.
2025-04-12 11:53:18 +02:00
Martin Kinkelin
58d065f935 Merge remote-tracking branch 'origin/stable'
Conflicts:
	compiler/src/dmd/declaration.h
	compiler/src/dmd/frontend.h
	compiler/src/dmd/globals.h
	compiler/src/dmd/typesem.d
	compiler/src/tests/cxxfrontend.cc
	compiler/test/fail_compilation/fail347.d
2025-04-11 13:35:53 +02:00
Dennis
09864e4c35
backend: Remove void initialization from code vars (#21206)
Co-authored-by: Dennis Korpel <dennis@sarc.nl>
2025-04-11 18:37:20 +08:00
Nicholas Wilson
5fdf5f3c68
[NFC] outline class function semantic analysis out of funcDeclarationSemantic (#21182)
This closes over several `goto`s whose target labels are now contained completely within the outlined code.
2025-04-11 16:38:16 +08:00
drpriver
493cd034a9
ImportC: va_arg fails in working C code (#21186)
Fixes https://github.com/dlang/dmd/issues/20423

Ultimate cause of this issue was that va_arg was being shadowed
by the collected template-like macros. As va_arg is not a normal
function (it takes a type as a parameter), this interfered with
the cparser's rewrite of va_arg to a call to the single argument
template version in core.stdc.stdarg.
2025-04-11 05:10:31 +08:00
drpriver
e9984553e6
Fix 20334: ImportC: enums created from string literal #defines don’t implicitly convert to const(char)* in D. (#21193)
Fixes: https://github.com/dlang/dmd/issues/20334

After preprocessing, #defines in C code that are just string literals
are converted into D enums. As these are collected for use in D code,
they should behave like D string literals and not C string literals.
2025-04-11 05:08:10 +08:00
Dennis
1b34fea478
Fix #21179 - Failure to convert const(T) to T after type is used in cast() (#21201) 2025-04-11 05:05:48 +08:00
Martin Kinkelin
bb25d82a3b
build.d: Fix dependencies on generated string-import files (#21192)
This is just a byproduct of taking a closer look at this code,
as part of investigating the recent CI failures on Windows, where
the VERSION and SYSCONFDIR.imp rules seem to run twice - and then
fail for the 2nd run, Windows complaining about another process using
the file. I guess that could be an Anti-malware process running right
after creating the file the first time. And both rules check the file
contents as part of their condition, so if the rule is processed twice,
we try to immediately read its contents after the write.

Each of these 2 auto-generated files is string-imported exactly once:

* `SYSCONFDIR.imp` in the driver's `dmd/dinifile.d` (and actually on
  Posix only)
* `VERSION` in the lexer's `dmd/globals.d`

I've revised the deps accordingly, which might avoid processing these
rules multiple times as a side-effect.
2025-04-11 05:03:54 +08:00
Walter Bright
81cd0b26ef
fixes for assignaddrc() and cmpval() (#21195) 2025-04-10 15:59:53 +08:00
Walter Bright
52cb9fdc1b
re-enable RM.load check (#21196) 2025-04-10 15:59:10 +08:00