Remove macros and a compiler workaround#1307
Merged
StephanTLavavej merged 19 commits intomicrosoft:masterfrom Oct 3, 2020
Merged
Remove macros and a compiler workaround#1307StephanTLavavej merged 19 commits intomicrosoft:masterfrom
StephanTLavavej merged 19 commits intomicrosoft:masterfrom
Conversation
CaseyCarter
suggested changes
Sep 22, 2020
CaseyCarter
approved these changes
Sep 22, 2020
miscco
reviewed
Sep 22, 2020
CaseyCarter
approved these changes
Sep 24, 2020
Member
Author
|
Moving |
mnatsuhara
approved these changes
Sep 25, 2020
Contributor
mnatsuhara
left a comment
There was a problem hiding this comment.
Couldn't find anything to nitpick! Looks good! :)
CaseyCarter
approved these changes
Sep 28, 2020
Contributor
There was a problem hiding this comment.
Pushed a minor merge conflict resolution: #1270 changed #include <errno.h> to #include <cerrno> in xferaise.cpp, which we want to remove here regardless of the header name.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog
xlocale,xlocinfo.h_XBand_XS. They were zero, so they served no useful purpose.xlocinfo.hto their only usage inxlocale, then immediately#undefthem. These macros are extremely short, making them unusually polluting.xstddef_CLASS_DEFINE_CONST, which was unused after constexpr INVOKE and related utilities #703.ymath.h,src/xmath.hpp_Feraiseargument" macros fromymath.h(where they're visible to users viacomplex) tosrc/xmath.hpp(as they're used in separately compiled files only).src/xferaise.cppxmath.hppto get those macros. (This was the only file not already includingxmath.hpp, and it drags in the previously included headers.)functionalstl vcr compiler, so it appears that we don't need to retain this workaround for CUDA.dequeemplace_front(which orphans) and_Emplace_back_internal(which doesn't orphan) in a centralized manner. Note thatpush_backalready behaved like this._PUSH_FRONT_BEGINetc. macros (deleting unnecessary semicolons). No logic changes._DEQUEMAPSIZwithstatic constexpr int _Minimum_map_size,privatewithindeque._DEQUESIZto be astatic constexpr intin_Deque_val, and rename it to_Block_sizenow that it's not a macro.complex_C_COMPLEX_Tguard is necessary.filesystemcat,dog,elkelements, consistent withtests/std/tests/P0218R1_filesystem/test.cpp. (This isn't strictly required by our policies, but it avoids potential headaches. I also believe that the animals are more readable - they're in alphabetical order and differ in their first letter, unlike the extremely similarbar/baz.)_File_time_clockuses the same 100 nanosecond period assystem_clock; simply use that type. (It's not going to change unexpectedly, due to ABI.)chrono,xtimec.hsystem_clock::period, removing the last use of_XTIME_NSECS_PER_TICK. Comment that this is 100 nanoseconds.ratiodenominators default to1; taking advantage of this slightly improves clarity._XTIME_TICKS_PER_TIME_Twhich was10000000LL. That value, 10,000,000, is how many 100ns ticks occur in 1s (which is the period fortime_t). We can and should use thechrono/ratiotype system for this.to_time_ttakes a 100nstime_point _Time._Time.time_since_epoch()gives us a 100nsduration. Previously, we extracted a raw integer with.count(), truncate-divided by_XTIME_TICKS_PER_TIME_Tto get a raw integer of whole seconds, and then redundantly cast to__time64_t. (That's the same as ourrep,long long.) Now, we can useduration_cast<seconds>to perform the truncating conversion. Then we can extract and return.count(). (secondsis also represented bylong long.)from_time_ttakes__time64_t _Tm, a raw integer of whole seconds. We previously multiplied by_XTIME_TICKS_PER_TIME_Tto get a raw integer of 100ns ticks, then invoked theexplicitconstructors for ourdurationandtime_point. Now, it's simpler to explicitly constructseconds{_Tm}(again, samelong longrepresentation), which encodes in the type system what we know about_Tm's meaning. Then, we can implicitly convert to ourdurationwhile explicitly constructing ourtime_point. (Thedurationconversion is implicit and safe because converting from whole seconds to fine-grained 100ns ticks is information-preserving. Yaychronodesign!)ratio_multiply<ratio<100>, nano>and we don't need to write down the inverse value_XTIME_TICKS_PER_TIME_T.Test Coverage
This tests
to_time_t's truncating behavior, which is the "hard" part:STL/tests/std/tests/Dev11_0555154_system_clock_to_time_t/test.cpp
Lines 17 to 32 in 5f3e912
This tests
from_time_t's behavior:STL/tests/tr1/tests/chrono/test.cpp
Lines 203 to 206 in 5f3e912
Therefore, I believe that existing test coverage is sufficient. Just in case, I tested this manually:
Manual Testing
VS 2019 16.8 Preview 3:
This PR: