-
-
Notifications
You must be signed in to change notification settings - Fork 748
Fix issue 16970 - Fix deprecations and warnings when compiling Phobos #4956
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -629,48 +629,18 @@ private mixin template socketOSExceptionCtors() | |
|
|
||
|
|
||
| /** | ||
| * Class for exceptions thrown from an $(D InternetHost). | ||
| * Class for exceptions thrown from an `InternetHost`. | ||
| */ | ||
| class HostException: SocketOSException | ||
| { | ||
| mixin socketOSExceptionCtors; | ||
| } | ||
|
|
||
| /** | ||
| * $(D InternetHost) is a class for resolving IPv4 addresses. | ||
| * `InternetHost` is a class for resolving IPv4 addresses. | ||
| * | ||
| * Consider using $(D getAddress), $(D parseAddress) and $(D Address) methods | ||
| * Consider using `getAddress`, `parseAddress` and `Address` methods | ||
| * instead of using this class directly. | ||
| * | ||
| * Example: | ||
| * --- | ||
| * auto ih = new InternetHost; | ||
| * | ||
| * // Forward lookup | ||
| * writeln("About www.digitalmars.com:"); | ||
| * if (ih.getHostByName("www.digitalmars.com")) | ||
| * { | ||
| * writefln(" Name: %s", ih.name); | ||
| * auto ip = InternetAddress.addrToString(ih.addrList[0]); | ||
| * writefln(" IP address: %s", ip); | ||
| * foreach (string s; ih.aliases) | ||
| * writefln(" Alias: %s", s); | ||
| * writeln("---"); | ||
| * | ||
| * // Reverse lookup | ||
| * writefln("About IP %s:", ip); | ||
| * if (ih.getHostByAddr(ih.addrList[0])) | ||
| * { | ||
| * writefln(" Name: %s", ih.name); | ||
| * foreach (string s; ih.aliases) | ||
| * writefln(" Alias: %s", s); | ||
| * } | ||
| * else | ||
| * writeln(" Reverse lookup failed"); | ||
| * } | ||
| * else | ||
| * writeln(" Can't resolve www.digitalmars.com"); | ||
| * --- | ||
| */ | ||
| class InternetHost | ||
| { | ||
|
|
@@ -824,7 +794,7 @@ class InternetHost | |
| } | ||
| } | ||
|
|
||
|
|
||
| /// | ||
| @safe unittest | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We now verify with CircleCi that public examples are runnable (also part of the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I missed that |
||
| { | ||
| InternetHost ih = new InternetHost; | ||
|
|
@@ -834,29 +804,21 @@ class InternetHost | |
| ih.getHostByAddr("127.0.0.1"); | ||
| assert(ih.addrList[0] == 0x7F_00_00_01); | ||
|
|
||
| softUnittest({ | ||
| if (!ih.getHostByName("www.digitalmars.com")) | ||
| return; // don't fail if not connected to internet | ||
| //writefln("addrList.length = %d", ih.addrList.length); | ||
| assert(ih.addrList.length); | ||
| InternetAddress ia = new InternetAddress(ih.addrList[0], InternetAddress.PORT_ANY); | ||
| assert(ih.name == "www.digitalmars.com" || ih.name == "digitalmars.com", | ||
| ih.name); | ||
| // writefln("IP address = %s", ia.toAddrString()); | ||
| // writefln("name = %s", ih.name); | ||
| // foreach (int i, string s; ih.aliases) | ||
| // { | ||
| // writefln("aliases[%d] = %s", i, s); | ||
| // } | ||
| // writefln("---"); | ||
| if (!ih.getHostByName("www.digitalmars.com")) | ||
| return; // don't fail if not connected to internet | ||
|
|
||
| //assert(ih.getHostByAddr(ih.addrList[0])); | ||
| // writefln("name = %s", ih.name); | ||
| // foreach (int i, string s; ih.aliases) | ||
| // { | ||
| // writefln("aliases[%d] = %s", i, s); | ||
| // } | ||
| }); | ||
| assert(ih.addrList.length); | ||
| InternetAddress ia = new InternetAddress(ih.addrList[0], InternetAddress.PORT_ANY); | ||
| assert(ih.name == "www.digitalmars.com" || ih.name == "digitalmars.com", | ||
| ih.name); | ||
|
|
||
| assert(ih.getHostByAddr(ih.addrList[0])); | ||
| string getHostNameFromInt = ih.name.dup; | ||
|
|
||
| assert(ih.getHostByAddr(ia.toAddrString())); | ||
| string getHostNameFromStr = ih.name.dup; | ||
|
|
||
| assert(getHostNameFromInt == getHostNameFromStr); | ||
| } | ||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed Example from ddoc and just made the unittest part of the docs, because:
///unittest)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes in general ddoced examples are horrible, because we can't ensure that they even compile.
As I seem not to be able to add a comment in the lines outside of the diff: maybe you could replace the commented
writeflnwithassert's, so that it won't look to weird to a reader?Note that for the rendered documentation we are considering to replace
assert's likea == bautomatically with a writeln equivalent