|
| 1 | +Ddoc |
| 2 | + |
| 3 | +$(CHANGELOG_NAV_INJECT) |
| 4 | + |
| 5 | +$(VERSION Feb 01, 2024, =================================================, |
| 6 | + |
| 7 | +$(CHANGELOG_HEADER_STATISTICS |
| 8 | +$(VER) comes with 9 major changes and 52 fixed Bugzilla issues. |
| 9 | + A huge thanks goes to the |
| 10 | + $(LINK2 #contributors, 35 contributors) |
| 11 | + who made $(VER) possible.) |
| 12 | + |
| 13 | +$(BUGSTITLE_TEXT_HEADER Compiler changes, |
| 14 | + |
| 15 | +$(LI $(RELATIVE_LINK2 dmd.assert-string,A string literal as an assert condition is deprecated)) |
| 16 | +$(LI $(RELATIVE_LINK2 dmd.makefiles,Makefiles cleanup for the compiler)) |
| 17 | +$(LI $(RELATIVE_LINK2 dmd.pragma,Unrecognized pragmas are no longer an error, but instead simply ignored)) |
| 18 | +$(LI $(RELATIVE_LINK2 dmd.standalone-attribute,Added `@standalone` for module constructors)) |
| 19 | +$(LI $(RELATIVE_LINK2 dmd.template-_d_newarratmT,`_d_newarray{mTX,miTX,OpT}` are converted to a single template: `_d_newarraymTX`)) |
| 20 | + |
| 21 | +) |
| 22 | + |
| 23 | +$(BUGSTITLE_TEXT_HEADER Runtime changes, |
| 24 | + |
| 25 | +$(LI $(RELATIVE_LINK2 druntime.makefiles,Makefiles cleanup for druntime)) |
| 26 | +$(LI $(RELATIVE_LINK2 druntime.stdatomic,New addition of the C stdatomic header implemented in D)) |
| 27 | + |
| 28 | +) |
| 29 | + |
| 30 | +$(BUGSTITLE_TEXT_HEADER Library changes, |
| 31 | + |
| 32 | +$(LI $(RELATIVE_LINK2 is_forward_range_element,isForwardRange now takes an optional element type.)) |
| 33 | +$(LI $(RELATIVE_LINK2 makefiles,Makefiles cleanup)) |
| 34 | + |
| 35 | +) |
| 36 | + |
| 37 | +$(CHANGELOG_SEP_HEADER_TEXT_NONEMPTY) |
| 38 | + |
| 39 | +$(CHANGELOG_SEP_HEADER_TEXT) |
| 40 | + |
| 41 | +$(BUGSTITLE_TEXT_BODY Compiler changes, |
| 42 | + |
| 43 | +$(LI $(LNAME2 dmd.assert-string,A string literal as an assert condition is deprecated) |
| 44 | +$(CHANGELOG_SOURCE_FILE dmd, changelog/dmd.assert-string.dd) |
| 45 | +$(P |
| 46 | +Boolean evaluation of a string literal could happen unintentionally |
| 47 | +e.g. when an `assert(0, "message")` was meant and the `0` was missing. |
| 48 | +) |
| 49 | + |
| 50 | +```d |
| 51 | +assert("unexpected runtime condition"); |
| 52 | +static assert("unhandled case for `", T, "`"); |
| 53 | +``` |
| 54 | + |
| 55 | +$(P |
| 56 | +The 2 asserts would silently always have no effect. |
| 57 | +Now these cases will be detected with deprecation messages. |
| 58 | +If the original behaviour was actually intended, use `expr !is null` instead: |
| 59 | +) |
| 60 | + |
| 61 | +```d |
| 62 | +assert("" !is null); |
| 63 | +static assert("" !is null); |
| 64 | +``` |
| 65 | +) |
| 66 | + |
| 67 | +$(LI $(LNAME2 dmd.makefiles,Makefiles cleanup for the compiler) |
| 68 | +$(CHANGELOG_SOURCE_FILE dmd, changelog/dmd.makefiles.dd) |
| 69 | +$(P |
| 70 | +The Makefiles for building the compiler (`compiler/src/{posix,win32,win64}.mak`) have been deprecated for a while, and finally removed. Please use the `compiler/src/build.d` tool directly now (see [docs](https://github.com/dlang/dmd/tree/master/compiler/src#building-the-compiler)), or build compiler and druntime in one step via the top-level Makefile in the repo root, e.g., for an optimized build using an LDC host compiler: `make -jN HOST_DMD=ldmd2 ENABLE_RELEASE=1 ENABLE_LTO=1` |
| 71 | +) |
| 72 | + |
| 73 | +$(P |
| 74 | +The top-level Makefile has been renamed from `posix.mak` to `Makefile` (with a deprecated `posix.mak` forwarder). The semantics of some targets have slightly changed, e.g., druntime is included in the `test`, `install` and `clean` targets now. |
| 75 | +) |
| 76 | + |
| 77 | +$(P |
| 78 | +The legacy `src/posix.mak` file still exists, but forwards to the top-level Makefile. So e.g. the default `all` target now includes druntime too, not just the compiler. |
| 79 | +) |
| 80 | + |
| 81 | +$(P |
| 82 | +Top-level `win{32,64}.mak` and legacy `src/win{32,64}.mak` files (for DigitalMars make) have been removed altogether. The generic top-level `Makefile` works on Windows too - with a GNU make (and a git installation providing bash and GNU tools). |
| 83 | +) |
| 84 | + |
| 85 | +$(P |
| 86 | +Long-deprecated `compiler/test/Makefile` has also been removed; use `compiler/test/run.d` directly instead (see [docs](https://github.com/dlang/dmd/tree/master/compiler/test#quick-guide)). |
| 87 | +) |
| 88 | +) |
| 89 | + |
| 90 | +$(LI $(LNAME2 dmd.pragma,Unrecognized pragmas are no longer an error, but instead simply ignored) |
| 91 | +$(CHANGELOG_SOURCE_FILE dmd, changelog/dmd.pragma.dd) |
| 92 | +$(P |
| 93 | +Previously, unrecognized pragmas would issue a hard error unless you used the `-ignore` dmd switch. Now, they are always ignored and the `-ignore` dmd switch is ignored. |
| 94 | +) |
| 95 | +) |
| 96 | + |
| 97 | +$(LI $(LNAME2 dmd.standalone-attribute,Added `@standalone` for module constructors) |
| 98 | +$(CHANGELOG_SOURCE_FILE dmd, changelog/dmd.standalone-attribute.dd) |
| 99 | +$(P |
| 100 | +When two modules import each other and both have module constructors, |
| 101 | +druntime would throw an error because it can't determine which to run first. |
| 102 | +) |
| 103 | + |
| 104 | +$(P |
| 105 | +This could be circumvented by using `pragma(crt_constructor)` instead, but in C runtime constructors, druntime isn't initialized. |
| 106 | +Therefore the Garbage Collector can't be used in such constructors. |
| 107 | +) |
| 108 | + |
| 109 | +$(P |
| 110 | +`@standalone` is a new attribute that can be used to mark module constructors that run after druntime has been initialized, |
| 111 | +but do not depend on any other module constructors being run before it, so it will not cause a cyclic dependency error. |
| 112 | +It must be imported from `core.attribute`. |
| 113 | +) |
| 114 | + |
| 115 | +$(P |
| 116 | +The compiler doesn't verify that the module constructor truly doesn't depend on other variables being initialized, so it must be enforced manually. |
| 117 | +Because of this, they must be marked `@system` or `@trusted`. |
| 118 | +) |
| 119 | + |
| 120 | +--- |
| 121 | +import core.attribute : standalone; |
| 122 | + |
| 123 | +immutable int* x; |
| 124 | + |
| 125 | +@standalone @system shared static this() |
| 126 | +{ |
| 127 | + x = new int(10); |
| 128 | +} |
| 129 | + |
| 130 | +void main() |
| 131 | +{ |
| 132 | + assert(*x == 10); |
| 133 | +} |
| 134 | +--- |
| 135 | + |
| 136 | +$(P |
| 137 | +If possible, prefer to solve cyclic dependency errors by putting the offending module constructors into their own smaller modules instead of using `@standalone`. |
| 138 | +) |
| 139 | +) |
| 140 | + |
| 141 | +$(LI $(LNAME2 dmd.template-_d_newarratmT,`_d_newarray{mTX,miTX,OpT}` are converted to a single template: `_d_newarraymTX`) |
| 142 | +$(CHANGELOG_SOURCE_FILE dmd, changelog/dmd.template-_d_newarratmT.dd) |
| 143 | +$(P |
| 144 | +The template `_d_newarraymTX` now uses DBI to check what type of initialiser is required by the type of the elements in the array. |
| 145 | +Thus it replaces both `_d_newarraymTX` and `_d_newarraymiTX`. |
| 146 | +) |
| 147 | + |
| 148 | +$(P |
| 149 | +`_d_newarrayOpT` was the generic implementation of both of the above hooks. |
| 150 | +It first allocated the "outer" arrays as pointer arrays and then it called either `_d_newarrayT` or `_d_newarrayiT`, to allocate initialise the "inner" 1-dimensional arrays accordingly. |
| 151 | +Now this is no longer needed due to the merge between `_d_newarraymTX` and `_d_newarraymiTX`. |
| 152 | +) |
| 153 | + |
| 154 | +$(P |
| 155 | +Now the compiler performs the following lowering: |
| 156 | +) |
| 157 | + |
| 158 | +--- |
| 159 | +S[][] s = new S[][](2, 3) |
| 160 | + |
| 161 | +// is now lowered to: |
| 162 | +S[] s = _d_newarraymTX!(S[][], S)([2, 3]); |
| 163 | +--- |
| 164 | + |
| 165 | +$(P |
| 166 | +This change adds the new template to `core.internal.array.construction`. |
| 167 | +) |
| 168 | +) |
| 169 | + |
| 170 | + |
| 171 | +) |
| 172 | + |
| 173 | +$(BUGSTITLE_TEXT_BODY Runtime changes, |
| 174 | + |
| 175 | +$(LI $(LNAME2 druntime.makefiles,Makefiles cleanup for druntime) |
| 176 | +$(CHANGELOG_SOURCE_FILE dmd, changelog/druntime.makefiles.dd) |
| 177 | +$(P |
| 178 | +The `{posix,win32,win64}.mak` Makefiles have been merged to a generic `Makefile` (including the ones in `druntime/test/`). `posix.mak` is kept as a deprecated forwarder for now. |
| 179 | +) |
| 180 | + |
| 181 | +$(P |
| 182 | +On Windows, you can/need to use the generic Makefile too - with a GNU make (and a git installation providing bash and GNU tools). Windows devs can finally exploit parallelism via `-j`! You may download a prebuilt zipped .exe from https://github.com/dlang/dmd/releases/download/nightly/gnumake-4.4-win64.zip. |
| 183 | +) |
| 184 | +) |
| 185 | + |
| 186 | +$(LI $(LNAME2 druntime.stdatomic,New addition of the C stdatomic header implemented in D) |
| 187 | +$(CHANGELOG_SOURCE_FILE dmd, changelog/druntime.stdatomic.dd) |
| 188 | +$(P |
| 189 | +The goal of this module is to assist in porting efforts for code from C to D and to give as close as possible same code generation as the system C compiler counterpart. |
| 190 | +) |
| 191 | + |
| 192 | +$(P |
| 193 | +If you do not care about code generation quality should the aliases to the function names not exist, you may append ``_impl`` to get at the implementation. |
| 194 | +) |
| 195 | + |
| 196 | +$(P |
| 197 | +If the code generation provided by a given function is not on-par to the system C compiler and it matters to your use case, please report it as a bug. |
| 198 | +) |
| 199 | +) |
| 200 | + |
| 201 | + |
| 202 | +) |
| 203 | + |
| 204 | +$(BUGSTITLE_TEXT_BODY Library changes, |
| 205 | + |
| 206 | +$(LI $(LNAME2 is_forward_range_element,isForwardRange now takes an optional element type.) |
| 207 | +$(CHANGELOG_SOURCE_FILE phobos, changelog/is_forward_range_element.dd) |
| 208 | +$(P |
| 209 | +isForwardRange now has an optional 2nd template parameter that defaults |
| 210 | +to void. If not void, it only evaluates to true if the range's element |
| 211 | +type is the same type as this extra argument, modulo const. For |
| 212 | +instance, `isForwardRange!(int[], const(int))` is true, but |
| 213 | +`isForwardRange!(int[], string)` is false. |
| 214 | +) |
| 215 | +) |
| 216 | + |
| 217 | +$(LI $(LNAME2 makefiles,Makefiles cleanup) |
| 218 | +$(CHANGELOG_SOURCE_FILE phobos, changelog/makefiles.dd) |
| 219 | +$(P |
| 220 | +The `{posix,win32,win64}.mak` Makefiles have been merged to a generic `Makefile`. `posix.mak` is kept as a deprecated forwarder for now. |
| 221 | +) |
| 222 | + |
| 223 | +$(P |
| 224 | +On Windows, you can/need to use the generic Makefile too - with a GNU make (and a git installation providing bash and GNU tools). Windows devs can finally exploit parallelism via `-j`! You may download a prebuilt zipped .exe from https://github.com/dlang/dmd/releases/download/nightly/gnumake-4.4-win64.zip. |
| 225 | +) |
| 226 | +) |
| 227 | + |
| 228 | + |
| 229 | +) |
| 230 | + |
| 231 | +$(CHANGELOG_SEP_TEXT_BUGZILLA) |
| 232 | + |
| 233 | +$(BUGSTITLE_BUGZILLA DMD Compiler regression fixes, |
| 234 | + |
| 235 | +$(LI $(BUGZILLA 24266): ImportC: struct initializer entry gets ignored) |
| 236 | +$(LI $(BUGZILLA 24274): [REG master] ImportC: unrecognized C initializer with array in struct) |
| 237 | +$(LI $(BUGZILLA 24301): [REG 2.100] Misleading error message when passing non-copyable struct by value in @safe code) |
| 238 | +) |
| 239 | +$(BUGSTITLE_BUGZILLA DMD Compiler bug fixes, |
| 240 | + |
| 241 | +$(LI $(BUGZILLA 16357): cast$(LPAREN)T[]$(RPAREN)[x] casts x to T instead of [x] to T[]) |
| 242 | +$(LI $(BUGZILLA 20339): isPOD returns true if sizeof is accessed inside struct declaration) |
| 243 | +$(LI $(BUGZILLA 20369): shadowed variable in foreach loop always considered "foreach variable") |
| 244 | +$(LI $(BUGZILLA 22216): Incomplete/incorrect error message for mutability overloads) |
| 245 | +$(LI $(BUGZILLA 22905): gdb backtrace contains wrong location) |
| 246 | +$(LI $(BUGZILLA 23411): ImportC: undefined identifier __builtin_nanf) |
| 247 | +$(LI $(BUGZILLA 23713): compilable/testcstuff1.c:206:1: error: static assertion failed: sizeof$(LPAREN)u'a'$(RPAREN) == 4) |
| 248 | +$(LI $(BUGZILLA 23714): compilable/testcstuff1.c:213:1: error: static assertion failed: u'ab' == 0x610062) |
| 249 | +$(LI $(BUGZILLA 23972): class identity check is broken) |
| 250 | +$(LI $(BUGZILLA 24031): ImportC: rejects nested C initializers) |
| 251 | +$(LI $(BUGZILLA 24094): importC __declspec not working in front of declaration statement) |
| 252 | +$(LI $(BUGZILLA 24200): ImportC: .di file collected macro conflicts with Special Token) |
| 253 | +$(LI $(BUGZILLA 24224): __traits$(LPAREN)initSymbol$(RPAREN) treats aggregate-derived enum as base type) |
| 254 | +$(LI $(BUGZILLA 24248): const constructor call with mutable target gives wrong error message) |
| 255 | +$(LI $(BUGZILLA 24264): ImportC: inliner trips on _Bool return) |
| 256 | +$(LI $(BUGZILLA 24276): ImportC: typedef aliases not emitted correctly in .di files) |
| 257 | +$(LI $(BUGZILLA 24280): ImportC: forward reference error when compiling multiple files) |
| 258 | +$(LI $(BUGZILLA 24281): Segfault with missing field after named argument) |
| 259 | +$(LI $(BUGZILLA 24283): [SIMD][CODEGEN] Bad codegen with and not + AVX2 registers) |
| 260 | +$(LI $(BUGZILLA 24292): Struct with destructor wrongly returned in register) |
| 261 | +$(LI $(BUGZILLA 24303): anonymous struct problems when typedef'd in separate C files) |
| 262 | +$(LI $(BUGZILLA 24304): __uint16_t, __uint32_t, __uint64_t are not recognized) |
| 263 | +$(LI $(BUGZILLA 24306): ImportC: same name structs in separate C files interfere when compiled together) |
| 264 | +) |
| 265 | +$(BUGSTITLE_BUGZILLA DMD Compiler enhancements, |
| 266 | + |
| 267 | +$(LI $(BUGZILLA 14387): Disallow string literals as assert conditions) |
| 268 | +$(LI $(BUGZILLA 23629): importC: Need to support code coverage analysis) |
| 269 | +$(LI $(BUGZILLA 24069): ImportC does not parse function pointer as parameter without name) |
| 270 | +$(LI $(BUGZILLA 24125): ImportC: vector type initializer not understood) |
| 271 | +$(LI $(BUGZILLA 24155): ImportC: accept C23 default initializers) |
| 272 | +$(LI $(BUGZILLA 24206): Can't alias a function type that returns a type with a TypeSuffix) |
| 273 | +$(LI $(BUGZILLA 24238): Confusing "not an lvalue"error messages) |
| 274 | +$(LI $(BUGZILLA 24247): Improve constructor not callable using $modifier object error) |
| 275 | +$(LI $(BUGZILLA 24294): ImportC: unrecognized command line option -Wno-builtin-macro-redefined with gcc) |
| 276 | +$(LI $(BUGZILLA 24297): ImportC incompatible with glibc _FORTIFY_SOURCE) |
| 277 | +) |
| 278 | +$(BUGSTITLE_BUGZILLA Phobos regression fixes, |
| 279 | + |
| 280 | +$(LI $(BUGZILLA 24243): Can't format chain$(LPAREN)filter, filter$(RPAREN)) |
| 281 | +) |
| 282 | +$(BUGSTITLE_BUGZILLA Phobos bug fixes, |
| 283 | + |
| 284 | +$(LI $(BUGZILLA 24151): std.container.array: Array!string$(LPAREN)""$(RPAREN) does not compile) |
| 285 | +$(LI $(BUGZILLA 24215): std.traits.isBasicType!Enum should be false) |
| 286 | +$(LI $(BUGZILLA 24278): std.math.abs promotes unsigned argument to 32 bits) |
| 287 | +) |
| 288 | +$(BUGSTITLE_BUGZILLA Phobos enhancements, |
| 289 | + |
| 290 | +$(LI $(BUGZILLA 11111): std.algorithm.canFind should support Needles...) |
| 291 | +$(LI $(BUGZILLA 24075): Can't use toChars with `ushort` or `ubyte`) |
| 292 | +) |
| 293 | +$(BUGSTITLE_BUGZILLA Druntime bug fixes, |
| 294 | + |
| 295 | +$(LI $(BUGZILLA 4071): Missing support to share memory and objects between DLLs and executable) |
| 296 | +$(LI $(BUGZILLA 24272): operations.arrayOp is forced @nogc nothrow pure) |
| 297 | +$(LI $(BUGZILLA 24298): cpp_delete should check for null) |
| 298 | +) |
| 299 | +$(BUGSTITLE_BUGZILLA Druntime enhancements, |
| 300 | + |
| 301 | +$(LI $(BUGZILLA 20332): associative array clear function should be @safe) |
| 302 | +) |
| 303 | +$(BUGSTITLE_BUGZILLA dlang.org bug fixes, |
| 304 | + |
| 305 | +$(LI $(BUGZILLA 23712): ImportC: Unclear documentation of what type is inferred from integer literals $(LPAREN)type of 9223372036854775808 is undefined$(RPAREN)) |
| 306 | +$(LI $(BUGZILLA 24239): dlang.org tests on CircleCI run out of memory) |
| 307 | +$(LI $(BUGZILLA 24241): Spec disallows missing default arguments) |
| 308 | +) |
| 309 | +$(BUGSTITLE_BUGZILLA dlang.org enhancements, |
| 310 | + |
| 311 | +$(LI $(BUGZILLA 24176): Parameters of opApply delegate don't have to be `ref`) |
| 312 | +$(LI $(BUGZILLA 24177): Array literal can implicitly convert to an expected type) |
| 313 | +$(LI $(BUGZILLA 24210): Function types are not documented) |
| 314 | +) |
| 315 | +) |
| 316 | +$(D_CONTRIBUTORS_HEADER 35) |
| 317 | +$(D_CONTRIBUTORS |
| 318 | + $(D_CONTRIBUTOR Adam D. Ruppe) |
| 319 | + $(D_CONTRIBUTOR Atila Neves) |
| 320 | + $(D_CONTRIBUTOR Basile Burg) |
| 321 | + $(D_CONTRIBUTOR Daniel Pflager) |
| 322 | + $(D_CONTRIBUTOR Danil Sidoruk) |
| 323 | + $(D_CONTRIBUTOR Denis Feklushkin) |
| 324 | + $(D_CONTRIBUTOR Dennis) |
| 325 | + $(D_CONTRIBUTOR Dennis Korpel) |
| 326 | + $(D_CONTRIBUTOR Feldwor) |
| 327 | + $(D_CONTRIBUTOR HuskyNator) |
| 328 | + $(D_CONTRIBUTOR Iain Buclaw) |
| 329 | + $(D_CONTRIBUTOR IchorDev) |
| 330 | + $(D_CONTRIBUTOR Imperatorn) |
| 331 | + $(D_CONTRIBUTOR imrying) |
| 332 | + $(D_CONTRIBUTOR Jeremy) |
| 333 | + $(D_CONTRIBUTOR jibal) |
| 334 | + $(D_CONTRIBUTOR Martin Kinkelin) |
| 335 | + $(D_CONTRIBUTOR Mathias Lang) |
| 336 | + $(D_CONTRIBUTOR Mathis Beer) |
| 337 | + $(D_CONTRIBUTOR mhh) |
| 338 | + $(D_CONTRIBUTOR Mike Parker) |
| 339 | + $(D_CONTRIBUTOR Nicholas Wilson) |
| 340 | + $(D_CONTRIBUTOR Nick Treleaven) |
| 341 | + $(D_CONTRIBUTOR Paul Backus) |
| 342 | + $(D_CONTRIBUTOR Petar Kirov) |
| 343 | + $(D_CONTRIBUTOR Rainer Schuetze) |
| 344 | + $(D_CONTRIBUTOR Razvan Nitu) |
| 345 | + $(D_CONTRIBUTOR richard (rikki) andrew cattermole) |
| 346 | + $(D_CONTRIBUTOR ryuukk) |
| 347 | + $(D_CONTRIBUTOR Sönke Ludwig) |
| 348 | + $(D_CONTRIBUTOR Teodor Dutu) |
| 349 | + $(D_CONTRIBUTOR Tim Schendekehl) |
| 350 | + $(D_CONTRIBUTOR Walter Bright) |
| 351 | + $(D_CONTRIBUTOR Yang Yujie) |
| 352 | + $(D_CONTRIBUTOR Семён Марьясин) |
| 353 | +) |
| 354 | +$(D_CONTRIBUTORS_FOOTER) |
| 355 | +$(CHANGELOG_NAV_INJECT) |
| 356 | + |
| 357 | +Macros: |
| 358 | + VER=2.107.0 |
| 359 | + TITLE=Change Log: $(VER) |
0 commit comments