Fix CUDA warnings/errors, _Noinit shadowing, other cleanups #772
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.
<random>This was defining a doubly-nested
struct _Noinit, shadowing the STL-wide machinery that we should have been using:STL/stl/inc/yvals.h
Lines 311 to 313 in f0f0b55
<istream>Rename
bool _Noinitto_Skip_init, avoiding more shadowing.<yvals_core.h>CUDA 9.2 was activating
__has_cpp_attribute(msvc::known_semantics)yet emittingwarning: attribute namespace "msvc" is unrecognized. I've added a TRANSITION workaround.<memory>We were unconditionally using
__declspec(empty_bases), causing CUDA 9.2 to emiterror: unknown attribute "empty_bases". @CaseyCarter noticed that this had no effect (only one base can possibly be empty here), so we can simply remove__declspec(empty_bases). (These control blocks are new to VS 2019 16.7, so this is extra safe.)<string>CUDA 9.2 was emitting a valid
warning: pointless comparison of unsigned integer with zero. Because it doesn't supportif constexpr, I've added a separate function, marked TRANSITION. Note for the perceptive: I left// can hold -2^63 and 2^64 - 1, plus NULunchanged in the original function so we can restore it easily.<xlocmon>CUDA 9.2 noticed bogus code here - we
static_cast<size_t>theintreturn value ofsprintf_s, soif (_Count < 0)was always false!<xutility>CUDA 9.2 correctly complained about unreachable code here. I've adjusted the preprocessor/control flow to be simpler. This is a permanent improvement, not TRANSITION.
<xstring>Unwrap two comments.
<xlocmon><xlocnum>Avoid
&_Src[sizeof(_Src)]and&_Buf[_Count]. (The former technically performs a forbidden dereferencing; the latter can too, depending on the value of_Count.) I considered using_Src, _Src + sizeof(_Src), but figured the throughput/debug codegen ofbegin/endwas acceptable in iostreams.