determine ldc version in static if or version?
Nicholas Wilson
iamthewilsonator at hotmail.com
Thu Apr 2 01:27:26 UTC 2020
On Wednesday, 1 April 2020 at 21:19:54 UTC, Adam D. Ruppe wrote:
> I want to do like
>
> static if(__LDC_VERSION == 1.19) {
> // declaration
> }
>
>
> All the tricks I know that I have tried so far give the dmd
> numbers. Perhaps I could use that to identify a particular
> version as a hack, but I specifically am curious about the ldc
> version because of a change they made there independently of D.
>
> Is there something I don't know about?
https://github.com/ldc-developers/druntime/blob/ldc/src/ldc/intrinsics.di#L22-L34
version (LDC_LLVM_309) enum LLVM_version = 309;
else version (LDC_LLVM_400) enum LLVM_version = 400;
else version (LDC_LLVM_500) enum LLVM_version = 500;
else version (LDC_LLVM_600) enum LLVM_version = 600;
else version (LDC_LLVM_700) enum LLVM_version = 700;
else version (LDC_LLVM_701) enum LLVM_version = 701;
else version (LDC_LLVM_800) enum LLVM_version = 800;
else version (LDC_LLVM_900) enum LLVM_version = 900;
else version (LDC_LLVM_1000) enum LLVM_version = 1000;
else version (LDC_LLVM_1100) enum LLVM_version = 1100;
else static assert(false, "LDC LLVM version not supported");
enum LLVM_atleast(int major) = (LLVM_version >= major * 100);
More information about the Digitalmars-d-learn
mailing list