Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit df539c5

Browse files
authored
Merge pull request #2272 from jmdavis/uname
Rename utsname's update member to version_. merged-on-behalf-of: Petar Kirov <ZombineDev@users.noreply.github.com>
2 parents 6f9925a + 2be1aff commit df539c5

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

changelog/utsname_version.dd

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
core.sys.posix.utsname.update renamed to version_
2+
3+
The struct that $(D uname) returns - $(D utsname) - has the field $(D version)
4+
in C. The D definition of the struct cannot match that, because $(D version) is
5+
a keyword in D. So, it's been called $(D update), which is not an obvious
6+
choice. It is more in line with current naming policies (and more in line with
7+
the name in C) for it to be called $(D version_), since that's the closest that
8+
we can get to $(D version) in D. So, $(D update) has now been renamed to
9+
$(D version_), and $(D update) is an alias of $(D version_) which will be
10+
deprecated in a future release.

src/core/sys/posix/sys/utsname.d

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ version(CRuntime_Glibc)
2626
char[utsNameLength] sysname;
2727
char[utsNameLength] nodename;
2828
char[utsNameLength] release;
29-
// The field name is version but version is a keyword in D.
30-
char[utsNameLength] update;
29+
char[utsNameLength] version_;
30+
// TODO Deprecate after version_ has been in an official release.
31+
alias update = version_;
3132
char[utsNameLength] machine;
3233

3334
char[utsNameLength] __domainname;
@@ -44,8 +45,9 @@ else version(Darwin)
4445
char[utsNameLength] sysname;
4546
char[utsNameLength] nodename;
4647
char[utsNameLength] release;
47-
// The field name is version but version is a keyword in D.
48-
char[utsNameLength] update;
48+
char[utsNameLength] version_;
49+
// TODO Deprecate after version_ has been in an official release.
50+
alias update = version_;
4951
char[utsNameLength] machine;
5052
}
5153

@@ -61,8 +63,9 @@ else version(FreeBSD)
6163
char[SYS_NMLN] sysname;
6264
char[SYS_NMLN] nodename;
6365
char[SYS_NMLN] release;
64-
// The field name is version but version is a keyword in D.
65-
char[SYS_NMLN] update;
66+
char[SYS_NMLN] version_;
67+
// TODO Deprecate after version_ has been in an official release.
68+
alias update = version_;
6669
char[SYS_NMLN] machine;
6770
}
6871

@@ -78,8 +81,9 @@ else version(NetBSD)
7881
char[utsNameLength] sysname;
7982
char[utsNameLength] nodename;
8083
char[utsNameLength] release;
81-
// The field name is version but version is a keyword in D.
82-
char[utsNameLength] update;
84+
char[utsNameLength] version_;
85+
// TODO Deprecate after version_ has been in an official release.
86+
alias update = version_;
8387
char[utsNameLength] machine;
8488
}
8589

@@ -94,8 +98,9 @@ else version(DragonFlyBSD)
9498
char[utsNameLength] sysname;
9599
char[utsNameLength] nodename;
96100
char[utsNameLength] release;
97-
// The field name is version but version is a keyword in D.
98-
char[utsNameLength] update;
101+
char[utsNameLength] version_;
102+
// TODO Deprecate after version_ has been in an official release.
103+
alias update = version_;
99104
char[utsNameLength] machine;
100105
}
101106

0 commit comments

Comments
 (0)