dmd
dmd copied to clipboard
[experiment] fix Issue 17544 - Versions derived from predefined versions not reserved
Either the compiler needs to start rejecting derived version identifiers, or the spec needs fixing.
Putting this out there as an experimental change - warts and all. :-)
Analysis:
The result of building druntime:
src/core/stdc/errno.d(40): Deprecation: version identifier `X86_Any` is reserved and cannot be set
src/core/sys/posix/signal.d(42): Deprecation: version identifier `X86_Any` is reserved and cannot be set
src/core/sys/posix/fcntl.d(45): Deprecation: version identifier `X86_Any` is reserved and cannot be set
src/core/sys/posix/sys/mman.d(44): Deprecation: version identifier `X86_Any` is reserved and cannot be set
src/core/sys/linux/link.d(27): Deprecation: version identifier `X86_Any` is reserved and cannot be set
src/core/sys/linux/dlfcn.d(28): Deprecation: version identifier `X86_Any` is reserved and cannot be set
src/core/sys/posix/dlfcn.d(42): Deprecation: version identifier `X86_Any` is reserved and cannot be set
src/core/internal/backtrace/unwind.d(20): Deprecation: version identifier `X86_Any` is reserved and cannot be set
src/core/stdc/fenv.d(45): Deprecation: version identifier `X86_Any` is reserved and cannot be set
src/core/stdc/fenv.d(50): Deprecation: version identifier `GNUFP` is reserved and cannot be set
src/core/stdc/math.d(41): Deprecation: version identifier `X86_Any` is reserved and cannot be set
src/core/sys/posix/sys/socket.d(44): Deprecation: version identifier `X86_Any` is reserved and cannot be set
src/core/sys/linux/epoll.d(35): Deprecation: version identifier `X86_Any` is reserved and cannot be set
src/core/sys/linux/netinet/in_.d(16): Deprecation: version identifier `linux_libc` is reserved and cannot be set
src/core/sys/linux/sys/eventfd.d(29): Deprecation: version identifier `X86_Any` is reserved and cannot be set
src/core/sys/linux/sys/inotify.d(43): Deprecation: version identifier `X86_Any` is reserved and cannot be set
src/core/sys/linux/sys/mman.d(29): Deprecation: version identifier `X86_Any` is reserved and cannot be set
src/core/sys/posix/locale.d(38): Deprecation: version identifier `GNULinuxLocale` is reserved and cannot be set
src/core/sys/posix/ucontext.d(49): Deprecation: version identifier `X86_Any` is reserved and cannot be set
src/rt/alloca.d(16): Deprecation: version identifier `alloca` is reserved and cannot be set
Each can be explained away by either of the following:
-
X86
is a reserved version identifier (for x86) -
linux
is a reserved version identifier (for linux) -
GNU
is a reserved version identifier (for GDC) -
all
is a reserved version identifier
Thanks for your pull request, @ibuclaw!
Bugzilla references
Auto-close | Bugzilla | Severity | Description |
---|---|---|---|
✓ | 17544 | normal | Versions derived from predefined versions not reserved |
Testing this PR locally
If you don't have a local development environment setup, you can use Digger to test this PR:
dub run digger -- build "master + dmd#14271"
I vote for "Specs needs fixing"
Me too. I frequently use something like version (LDC) version (Win64) version = LDC_Win64;
. Having to prefix such helpers would IMO just uglify the code, plus they are local to their module anyway. And we'd risk making existing code bases invalid after adding some new predefined version (not starting with D_
).
FYI @WalterBright
@kinke @Geod24 there are a few deprecated versions in the spec too, should we actually start emitting a deprecation warning if people are still using them?
That'd be fine (but hardly worth it) IMO - except for darwin
. Deprecating that (and recommending OSX
instead!) was IMO a big mistake; now we have https://github.com/dlang/druntime/blob/d1d65f979231c293c4483504fe7f34f4698a35d4/src/rt/sections_darwin_64.d#L14-L21 in numerous druntime/Phobos modules - I count 427 occurrences of version = Darwin;
in 108 (LDC) druntime/Phobos modules.