std.compiler: report LDC's own version instead of the DMD frontend version - #76
Conversation
… version Fixes ldc-developers/ldc#1958. std.compiler.version_major/version_minor previously derived from __VERSION__, which reflects the DMD frontend version bundled into LDC (e.g. 2112) rather than LDC's own release version (e.g. 1.43). version(LDC) now computes version_major/version_minor from LDC's actual release version string, string-imported at build time as 'ldccompilerversion.txt' (generated by the LDC build system).
|
What about simply hardcoding the version into an |
oh Very nice u are right i will make it thanks! |
Per review feedback on ldc-developers#76: use the new __LDC_VERSION__ compiler-level magic identifier (see ldc-developers/ldc#5277) instead of a build-generated string-import file. This mirrors __VERSION__ and avoids extra build complexity.
Done |
Fixes ldc-developers#1958 (companion to ldc-developers/phobos#76). Per review feedback, adds __LDC_VERSION__ as a compiler-level magic identifier (mirroring __VERSION__) instead of exposing the version via a build-generated string-import file: - dmd/id.d: register the __LDC_VERSION__ identifier - dmd/lexer.d, dmd/globals.h: add CompileEnv.ldcVersionNumber and resolve __LDC_VERSION__ to it in the lexer - CMakeLists.txt: derive LDC_VERSION_MAJOR/MINOR from LDC_VERSION and pass them as preprocessor definitions - driver/main.cpp: set compileEnv.ldcVersionNumber at startup - runtime/CMakeLists.txt: drop the earlier string-import approach
driver/main.cpp no longer calls sscanf, so the cstdio include is unused (per @JohanEngelen review comment). Update runtime/phobos submodule ref to 4f3d5b30f, which includes the merged std.compiler change (ldc-developers/phobos#76) that this PR depends on.
Fixes ldc-developers/ldc#1958
Fix: std.compiler.version_major/version_minor now report LDC's own version instead of the DMD frontend version.
Before this change, these values were computed from VERSION, which reflects the bundled DMD frontend version (e.g. 2112), not LDC's actual release version (e.g. 1.43). This meant std.compiler was reporting incorrect version numbers for LDC users.
Now, when compiling with LDC, version_major/version_minor are derived from LDC's real release version string instead.
