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.
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.
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.
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.
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.
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.
Resolves https://github.com/dlang/dmd/issues/20434
Allowing this gnu/clang extension actually removes lines of code as
we can unify the parsing and semantics of `_Alignof` and `sizeof`
and have the normal D machinery handle the difference later.
Fixes https://github.com/dlang/dmd/issues/20472
Arrays in C implicitly convert to a pointer to their first member,
so do the implicit conversion when using them in an arrow member lookup.
Fixes: https://github.com/dlang/dmd/issues/21183
The previous MR put the macro in a `#if linux` which meant it
didn't actually solve the problem of being unable to
`#include <math.h>` on macos. So put it in a better spot.
Also enable the test that includes that header for macos so that
it stays solved.
The gnu attribute aligned() allows specifying the alignment of an entire
struct, mostly as a syntatic convenience. This attribute allows
compile-time integer expressions, but the parser was trying to evaluate them
ahead of time by checking for an integer literal. Instead we need to
preserve the expression and defer it to a later semantic stage.
Accomplish this by emulating the behavior by specifying the alignment of
the first member of the struct.
I didn't change how __declspec(align(#)) parses as from the
documentation it seems to only allow integer literals. Some light
testing with cl.exe gives syntax errors when trying to use _Alignof() in
that position.
* bump VERSION to v2.110.0
* purge changelog
* bump VERSION to v2.111.0-beta.1
* Accept __rvalue attribute on ref functions; which will force the result to be treated as __rvalue. (#20946)
This is essential to implement `move`, `forward`, etc.
* memoryerror.d: Fix AnySupported version condition (#20983)
* Fix#20982 - wrong line number in iasmgcc (#20993)
* Move genCfunc to cxxfrontend (#20992)
* druntime: Fix compilation of rt.cover on Android (#21015)
* Expose SourceLoc to C++ interface (#20980)
* [stable] C++ header fixes for declaration, expression, and typinf (#21016)
Seen either from compilation errors or missing symbols at link time.
* C++ headers: Add 3 Declaration bitfield setters/getters required by LDC
* druntime: Add module declaration to rt.invariant, to prevent conflicts with user-provided invariant.d (#21017)
* Fix#21020 - Indexing a *cast* AA yields no lvalue anymore (#21029)
* Add C++23 to CppStdRevision enum (#21043)
* Improve UFCS/property error message (#21046)
* bump VERSION to v2.111.0-rc.1
* Fix#21045 - import __stdin causes compilation to pause while reading from stdin (#21047)
Moves the special handling of reading from stdin out of the semantic
routines to the DMD driver itself. All references to `__stdin.d` have
also been removed from the frontend implementation.
* Update source code and coverage links (#21111)
* Fix#21024 - Optimize x^^c expressions (#21082)
* Fix#21024 - Optimize x^^c expressions
Reason for the *magic* constraint c<8 on inlining x^^c:
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86_64/fpu/e_powl.S;h=47f129f34d368d7c67b8e5f2462b36b0bebb7621;hb=HEAD#l136
* Fix poor assumption about expression state
* Restrict optimization to floating point expressions
* Generalize optimization to any scalar data type
* Fix segfault on x^^c where x is a single member anonymous enum
DMD segfaulted on compiling the unittests in std/algorithm/sorting.o, the
unittest that caused the segfault can be reduced to:
enum real Two = 2.0;
auto _ = Two^^3;
I'm not sure why copying the anonymous enum into a `const` variable causes
the compiler to segfault.
* Add tests to x^^c inlining optimization
* Fix missing type for e1 ^^ -1 to 1 / e1 rewrite
* Move rewrites from constant folding to expression semantic and restrict them to [-1, 2]
* Improve error message for the x^^2 rewrite.
Before:
ex.d(4): Error: can implicitly convert expression `(const const(double) __powtmp2 = x + 5.0;) , __powtmp2 * ...` of type `double` to `int`
int y = ( x + 5 ) ^^ 2;
^
and after:
ex.d(4): Error: cannot implicitly convert expression `(x + 5.0) ^^ 2L` of type `double` to `int`
int y = ( x + 5 ) ^^ 2;
^
* Update C++ frontend header to match change in `CommaExp`
* Address code review feedback
Co-authored-by: Dennis Korpel <dkorpel@gmail.com>
---------
Co-authored-by: Dennis Korpel <dkorpel@gmail.com>
* Revert "Fix #21024 - Optimize x^^c expressions (#21082)" (#21114)
This reverts commit fa1f860e4b.
* bump VERSION to v2.111.0
* purge changelog
* Strip trailing newline off sarif version
---------
Co-authored-by: Manu Evans <turkeyman@gmail.com>
Co-authored-by: Martin Kinkelin <kinke@users.noreply.github.com>
Co-authored-by: Iain Buclaw <ibuclaw@gdcproject.org>
Co-authored-by: Martin Kinkelin <noone@nowhere.com>
Co-authored-by: Fares A. Bakhit <faresa.bakhit@gmail.com>
* Fix#21024 - Optimize x^^c expressions
Reason for the *magic* constraint c<8 on inlining x^^c:
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86_64/fpu/e_powl.S;h=47f129f34d368d7c67b8e5f2462b36b0bebb7621;hb=HEAD#l136
* Fix poor assumption about expression state
* Restrict optimization to floating point expressions
* Generalize optimization to any scalar data type
* Fix segfault on x^^c where x is a single member anonymous enum
DMD segfaulted on compiling the unittests in std/algorithm/sorting.o, the
unittest that caused the segfault can be reduced to:
enum real Two = 2.0;
auto _ = Two^^3;
I'm not sure why copying the anonymous enum into a `const` variable causes
the compiler to segfault.
* Add tests to x^^c inlining optimization
* Fix missing type for e1 ^^ -1 to 1 / e1 rewrite
* Move rewrites from constant folding to expression semantic and restrict them to [-1, 2]
* Improve error message for the x^^2 rewrite.
Before:
ex.d(4): Error: can implicitly convert expression `(const const(double) __powtmp2 = x + 5.0;) , __powtmp2 * ...` of type `double` to `int`
int y = ( x + 5 ) ^^ 2;
^
and after:
ex.d(4): Error: cannot implicitly convert expression `(x + 5.0) ^^ 2L` of type `double` to `int`
int y = ( x + 5 ) ^^ 2;
^
* Update C++ frontend header to match change in `CommaExp`
* Address code review feedback
---------
Co-authored-by: Fares A. Bakhit <faresa.bakhit@gmail.com>
* Fix#21024 - Optimize x^^c expressions
Reason for the *magic* constraint c<8 on inlining x^^c:
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86_64/fpu/e_powl.S;h=47f129f34d368d7c67b8e5f2462b36b0bebb7621;hb=HEAD#l136
* Fix poor assumption about expression state
* Restrict optimization to floating point expressions
* Generalize optimization to any scalar data type
* Fix segfault on x^^c where x is a single member anonymous enum
DMD segfaulted on compiling the unittests in std/algorithm/sorting.o, the
unittest that caused the segfault can be reduced to:
enum real Two = 2.0;
auto _ = Two^^3;
I'm not sure why copying the anonymous enum into a `const` variable causes
the compiler to segfault.
* Add tests to x^^c inlining optimization
* Fix missing type for e1 ^^ -1 to 1 / e1 rewrite
* Move rewrites from constant folding to expression semantic and restrict them to [-1, 2]
* Improve error message for the x^^2 rewrite.
Before:
ex.d(4): Error: can implicitly convert expression `(const const(double) __powtmp2 = x + 5.0;) , __powtmp2 * ...` of type `double` to `int`
int y = ( x + 5 ) ^^ 2;
^
and after:
ex.d(4): Error: cannot implicitly convert expression `(x + 5.0) ^^ 2L` of type `double` to `int`
int y = ( x + 5 ) ^^ 2;
^
* Update C++ frontend header to match change in `CommaExp`
* Address code review feedback
Co-authored-by: Dennis Korpel <dkorpel@gmail.com>
---------
Co-authored-by: Dennis Korpel <dkorpel@gmail.com>
* Fix error when struct initializer isn't accepted
* Rename StructDeclaration.hasRegularCtor parameter to ignoreDisabled
checkDisabled detected disabled ctors when it was false, which was
confusing!
* Update tests
* Fix dlang#18262 - Resolved special enum case and other conflicts
* Fix dlang#18262 - Resolved Special Enum case and failing test.
* Fix dlang#18262 - Resolved special enum case and other failing tests
Moves the special handling of reading from stdin out of the semantic
routines to the DMD driver itself. All references to `__stdin.d` have
also been removed from the frontend implementation.
* bump VERSION to v2.110.0
* purge changelog
* bump VERSION to v2.111.0-beta.1
* Accept __rvalue attribute on ref functions; which will force the result to be treated as __rvalue. (#20946)
This is essential to implement `move`, `forward`, etc.
* memoryerror.d: Fix AnySupported version condition (#20983)
* Fix#20982 - wrong line number in iasmgcc (#20993)
* Move genCfunc to cxxfrontend (#20992)
* druntime: Fix compilation of rt.cover on Android (#21015)
* Expose SourceLoc to C++ interface (#20980)
* [stable] C++ header fixes for declaration, expression, and typinf (#21016)
Seen either from compilation errors or missing symbols at link time.
* C++ headers: Add 3 Declaration bitfield setters/getters required by LDC
* druntime: Add module declaration to rt.invariant, to prevent conflicts with user-provided invariant.d (#21017)
* Fix#21020 - Indexing a *cast* AA yields no lvalue anymore (#21029)
* Add C++23 to CppStdRevision enum (#21043)
* Improve UFCS/property error message (#21046)
---------
Co-authored-by: Manu Evans <turkeyman@gmail.com>
Co-authored-by: Martin Kinkelin <kinke@users.noreply.github.com>
Co-authored-by: Iain Buclaw <ibuclaw@gdcproject.org>
Co-authored-by: Martin Kinkelin <noone@nowhere.com>
* Fix: Prevent ICE on final switch forward referencing its enum
* more simpler approach
* moved the enum member analysis
* Move enum number analysis to sementic2
* WhiteSpace Remove
* Remove Redundant Code in enumsem