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.
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.
* build.d: Fix VERSION fallback if `git describe` fails
Which can fail for *shallow* git clones, as used for GitHub Actions.
* [apply to config.d as well; e.g., used by Visual Studio project]
* 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>
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.