Skip to content

Commit

Permalink
Various cleanups (#3177)
Browse files Browse the repository at this point in the history
Co-authored-by: Casey Carter <[email protected]>
  • Loading branch information
StephanTLavavej and CaseyCarter authored Oct 26, 2022
1 parent 82837b7 commit 296e840
Show file tree
Hide file tree
Showing 18 changed files with 29 additions and 58 deletions.
2 changes: 0 additions & 2 deletions azure-devops/cmake-configure-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ steps:
cmake ${{ parameters.cmakeAdditionalFlags}} -G Ninja ^
-DCMAKE_CXX_COMPILER=cl ^
-DCMAKE_BUILD_TYPE=Release ^
-DLIT_FLAGS=$(litFlags) ^
-DSTL_USE_ANALYZE=ON ^
-DSTL_BINARY_DIR=$(${{ parameters.buildOutputLocationVar }}) ^
-S $(Build.SourcesDirectory)/benchmarks -B $(${{ parameters.benchmarkBuildOutputLocationVar }})
displayName: 'Configure the benchmarks'
Expand Down
2 changes: 0 additions & 2 deletions stl/inc/expected
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ public:
}

// clang-format off
// TRANSITION, LLVM-46269, destructor order is significant
~expected() requires is_trivially_destructible_v<_Ty> && is_trivially_destructible_v<_Err> = default;
// clang-format on

Expand Down Expand Up @@ -842,7 +841,6 @@ public:
}

// clang-format off
// TRANSITION, LLVM-46269, destructor order is significant
~expected() requires is_trivially_destructible_v<_Err> = default;
// clang-format on

Expand Down
1 change: 0 additions & 1 deletion stl/inc/iterator
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,6 @@ public:
_Raw_clear();
}

// TRANSITION, LLVM-46269, destructor order is significant
// clang-format off
constexpr ~_Variantish() requires is_trivially_destructible_v<_Ty1> && is_trivially_destructible_v<_Ty2> = default;

Expand Down
3 changes: 0 additions & 3 deletions stl/inc/ranges
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ namespace ranges {
}
}

// TRANSITION, LLVM-46269, destructor order is significant
// clang-format off
~_Movable_box() requires is_trivially_destructible_v<_Ty> = default;

Expand Down Expand Up @@ -483,7 +482,6 @@ namespace ranges {
}
}

// TRANSITION, LLVM-46269, destructor order is significant
// clang-format off
~_Defaultabox() requires is_trivially_destructible_v<_Ty> = default;

Expand Down Expand Up @@ -701,7 +699,6 @@ namespace ranges {
}
}

// TRANSITION, LLVM-46269, destructor order is significant
// clang-format off
~_Non_propagating_cache() requires is_trivially_destructible_v<_Ty> = default;
// clang-format on
Expand Down
6 changes: 3 additions & 3 deletions stl/inc/string
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,21 @@ _EXPORT_STD template <class _Elem, class _Traits, class _Alloc>
basic_istream<_Elem, _Traits>& getline(
basic_istream<_Elem, _Traits>&& _Istr, basic_string<_Elem, _Traits, _Alloc>& _Str) {
// get characters into string, discard newline
return getline(_Istr, _Str, _Istr.widen('\n'));
return _STD getline(_STD move(_Istr), _Str, _Istr.widen('\n'));
}

_EXPORT_STD template <class _Elem, class _Traits, class _Alloc>
basic_istream<_Elem, _Traits>& getline(
basic_istream<_Elem, _Traits>& _Istr, basic_string<_Elem, _Traits, _Alloc>& _Str, const _Elem _Delim) {
// get characters into string, discard delimiter
return getline(_STD move(_Istr), _Str, _Delim);
return _STD getline(_STD move(_Istr), _Str, _Delim);
}

_EXPORT_STD template <class _Elem, class _Traits, class _Alloc>
basic_istream<_Elem, _Traits>& getline(
basic_istream<_Elem, _Traits>& _Istr, basic_string<_Elem, _Traits, _Alloc>& _Str) {
// get characters into string, discard newline
return getline(_STD move(_Istr), _Str, _Istr.widen('\n'));
return _STD getline(_STD move(_Istr), _Str, _Istr.widen('\n'));
}

_EXPORT_STD _NODISCARD inline int stoi(const string& _Str, size_t* _Idx = nullptr, int _Base = 10) {
Expand Down
12 changes: 0 additions & 12 deletions stl/inc/xlocinfo
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ _MRTIMP2 _Success_(return >= 0) int __cdecl _Mbrtowc(
_When_(_Max_multibyte != 0, _Out_) wchar_t*, const char*, size_t _Max_multibyte, mbstate_t*, const _Cvtvec*);
#endif // _M_CEE_PURE

_CRTIMP2_PURE float __CLRCALL_PURE_OR_CDECL _Stof(const char*, _Out_opt_ _Deref_post_opt_valid_ char**, long);
_CRTIMP2_PURE double __CLRCALL_PURE_OR_CDECL _Stod(const char*, _Out_opt_ _Deref_post_opt_valid_ char**, long);
_CRTIMP2_PURE long double __CLRCALL_PURE_OR_CDECL _Stold(const char*, _Out_opt_ _Deref_post_opt_valid_ char**, long);

_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Strcoll(const char*, const char*, const char*, const char*, const _Collvec*);
_CRTIMP2_PURE size_t __CLRCALL_PURE_OR_CDECL _Strxfrm(_Out_writes_(_End1 - _String1)
_Post_readable_size_(return) char* _String1,
Expand Down Expand Up @@ -106,14 +102,6 @@ _Success_(return > 0) _ACRTIMP size_t __cdecl _Wcsftime(
_Out_writes_z_(_Maxsize) wchar_t*, _In_ size_t _Maxsize, _In_z_ const wchar_t*, _In_ const tm*, _In_opt_ void*);
_END_EXTERN_C

#ifdef _M_CEE_PURE
[System::Runtime::InteropServices::DllImport(_CRT_MSVCP_CURRENT, EntryPoint = "_GetLocaleForCP",
CallingConvention = System::Runtime::InteropServices::CallingConvention::Cdecl)] extern "C" _locale_t
_GetLocaleForCP(unsigned int);
#else // _M_CEE_PURE
_MRTIMP2 _locale_t __cdecl _GetLocaleForCP(unsigned int);
#endif // _M_CEE_PURE

_STD_BEGIN
extern "C++" class _CRTIMP2_PURE_IMPORT _Timevec { // smart pointer to information used by _Strftime
public:
Expand Down
4 changes: 0 additions & 4 deletions stl/inc/xlocnum
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ _STL_DISABLE_CLANG_WARNINGS

_EXTERN_C_UNLESS_PURE

_CRTIMP2_PURE float __CLRCALL_PURE_OR_CDECL _Stofx(const char*, _Out_opt_ _Deref_post_opt_valid_ char**, long, int*);
_CRTIMP2_PURE double __CLRCALL_PURE_OR_CDECL _Stodx(const char*, _Out_opt_ _Deref_post_opt_valid_ char**, long, int*);
_CRTIMP2_PURE long double __CLRCALL_PURE_OR_CDECL _Stoldx(
const char*, _Out_opt_ _Deref_post_opt_valid_ char**, long, int*);
_CRTIMP2_PURE long __CLRCALL_PURE_OR_CDECL _Stolx(const char*, _Out_opt_ _Deref_post_opt_valid_ char**, int, int*);
_CRTIMP2_PURE unsigned long __CLRCALL_PURE_OR_CDECL _Stoulx(
const char*, _Out_opt_ _Deref_post_opt_valid_ char**, int, int*);
Expand Down
5 changes: 0 additions & 5 deletions stl/src/special_math.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,9 @@
#include <utility>

#pragma warning(push)
#pragma warning(disable : 4619) // #pragma warning: there is no warning number '%d'
#pragma warning(disable : 4643) // Forward declaring '%s' in namespace std is not permitted by the C++ Standard
#pragma warning(disable : 4702) // unreachable code
#pragma warning(disable : 5219) // implicit conversion from '%s' to '%s', possible loss of data
#pragma warning(disable : 6326) // potential comparison of a constant with another constant

#define BOOST_CHRONO_HEADER_ONLY
#define BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE
#define BOOST_MATH_DOMAIN_ERROR_POLICY errno_on_error
#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error

Expand Down
2 changes: 2 additions & 0 deletions stl/src/xstod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@

_EXTERN_C_UNLESS_PURE

// TRANSITION, ABI: preserved for binary compatibility
_CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL _Stodx(const CTYPE* s, CTYPE** endptr, long pten, int* perr)
#include "xxstod.hpp"

// TRANSITION, ABI: preserved for binary compatibility
_CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL
_Stod(const CTYPE* s, CTYPE** endptr, long pten) { // convert string, discard error code
return _Stodx(s, endptr, pten, nullptr);
Expand Down
2 changes: 2 additions & 0 deletions stl/src/xstof.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@

_EXTERN_C_UNLESS_PURE

// TRANSITION, ABI: preserved for binary compatibility
_CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL _Stofx(const CTYPE* s, CTYPE** endptr, long pten, int* perr)
#include "xxstod.hpp"

// TRANSITION, ABI: preserved for binary compatibility
_CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL
_Stof(const CTYPE* s, CTYPE** endptr, long pten) { // convert string, discard error code
return _Stofx(s, endptr, pten, nullptr);
Expand Down
2 changes: 2 additions & 0 deletions stl/src/xstold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@

_EXTERN_C_UNLESS_PURE

// TRANSITION, ABI: preserved for binary compatibility
_CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL _Stoldx(const CTYPE* s, CTYPE** endptr, long pten, int* perr)
#include "xxstod.hpp"

// TRANSITION, ABI: preserved for binary compatibility
_CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL
_Stold(const CTYPE* s, CTYPE** endptr, long pten) { // convert string, discard error code
return _Stoldx(s, endptr, pten, nullptr);
Expand Down
2 changes: 2 additions & 0 deletions stl/src/xwstod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@

_EXTERN_C_UNLESS_PURE

// TRANSITION, ABI: preserved for binary compatibility
_CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL _WStodx(const CTYPE* s, CTYPE** endptr, long pten, int* perr)
#include "xxstod.hpp"

// TRANSITION, ABI: preserved for binary compatibility
_CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL
_WStod(const CTYPE* s, CTYPE** endptr, long pten) { // convert string, discard error code
return _WStodx(s, endptr, pten, nullptr);
Expand Down
2 changes: 2 additions & 0 deletions stl/src/xwstof.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@

_EXTERN_C_UNLESS_PURE

// TRANSITION, ABI: preserved for binary compatibility
_CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL _WStofx(const CTYPE* s, CTYPE** endptr, long pten, int* perr)
#include "xxstod.hpp"

// TRANSITION, ABI: preserved for binary compatibility
_CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL
_WStof(const CTYPE* s, CTYPE** endptr, long pten) { // convert string, discard error code
return _WStofx(s, endptr, pten, nullptr);
Expand Down
2 changes: 2 additions & 0 deletions stl/src/xwstold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@

_EXTERN_C_UNLESS_PURE

// TRANSITION, ABI: preserved for binary compatibility
_CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL _WStoldx(const CTYPE* s, CTYPE** endptr, long pten, int* perr)
#include "xxstod.hpp"

// TRANSITION, ABI: preserved for binary compatibility
_CRTIMP2_PURE FTYPE __CLRCALL_PURE_OR_CDECL
_WStold(const CTYPE* s, CTYPE** endptr, long pten) { // convert string, discard error code
return _WStoldx(s, endptr, pten, nullptr);
Expand Down
4 changes: 4 additions & 0 deletions tests/libcxx/expected_results.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,10 @@ std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_assignable.pass.cp
std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_assignable.pass.cpp:0 FAIL
std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_const_move.pass.cpp FAIL

# Not yet analyzed, possible path length issue. With a repo root of D:\GitHub\STL (13 characters), fails with:
# "error RC2136 : missing '=' in EXSTYLE=<flags>" followed by "LINK : fatal error LNK1327: failure during running rc.exe"
std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until_deadlock_bug.pass.cpp SKIPPED


# *** XFAILs WHICH PASS ***
# Nothing here! :-)
4 changes: 4 additions & 0 deletions tests/libcxx/skipped_tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,10 @@ utilities\meta\meta.unary\meta.unary.prop\is_nothrow_copy_assignable.pass.cpp
utilities\meta\meta.unary\meta.unary.prop\is_nothrow_move_assignable.pass.cpp
utilities\tuple\tuple.tuple\tuple.cnstr\convert_const_move.pass.cpp

# Not yet analyzed, possible path length issue. With a repo root of D:\GitHub\STL (13 characters), fails with:
# "error RC2136 : missing '=' in EXSTYLE=<flags>" followed by "LINK : fatal error LNK1327: failure during running rc.exe"
thread\thread.mutex\thread.mutex.requirements\thread.sharedtimedmutex.requirements\thread.sharedtimedmutex.class\try_lock_until_deadlock_bug.pass.cpp


# *** SKIPPED FOR MSVC-INTERNAL CONTEST ONLY ***
# "XFAIL: msvc" or "XFAIL: clang"
Expand Down
29 changes: 4 additions & 25 deletions tests/std/tests/P0323R12_expected/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,7 @@ namespace test_expected {

{ // Check payload type
using Expected = expected<payload_copy_constructor, int>;
#ifndef __clang__ // TRANSITION, LLVM-46269
static_assert(is_trivially_copy_constructible_v<Expected> == should_be_trivial);
#endif // !__clang__
static_assert(is_copy_constructible_v<Expected>);

const Expected with_value{in_place};
Expand All @@ -267,9 +265,7 @@ namespace test_expected {

{ // Check error type
using Expected = expected<int, payload_copy_constructor>;
#ifndef __clang__ // TRANSITION, LLVM-46269
static_assert(is_trivially_copy_constructible_v<Expected> == should_be_trivial);
#endif // !__clang__
static_assert(is_copy_constructible_v<Expected>);

const Expected with_value{in_place};
Expand All @@ -287,9 +283,7 @@ namespace test_expected {

{ // Check void payload
using Expected = expected<void, payload_copy_constructor>;
#ifndef __clang__ // TRANSITION, LLVM-46269
static_assert(is_trivially_copy_constructible_v<Expected> == should_be_trivial);
#endif // !__clang__
static_assert(is_copy_constructible_v<Expected>);

const Expected with_value{in_place};
Expand Down Expand Up @@ -339,9 +333,7 @@ namespace test_expected {

{ // Check payload type
using Expected = expected<payload_move_constructor, int>;
#ifndef __clang__ // TRANSITION, LLVM-46269
static_assert(is_trivially_move_constructible_v<Expected> == should_be_trivial);
#endif // !__clang__
static_assert(is_move_constructible_v<Expected>);

Expected value_input{in_place};
Expand All @@ -359,9 +351,7 @@ namespace test_expected {

{ // Check error type
using Expected = expected<int, payload_move_constructor>;
#ifndef __clang__ // TRANSITION, LLVM-46269
static_assert(is_trivially_move_constructible_v<Expected> == should_be_trivial);
#endif // !__clang__
static_assert(is_move_constructible_v<Expected>);

Expected value_input{in_place};
Expand All @@ -379,9 +369,7 @@ namespace test_expected {

{ // Check void payload
using Expected = expected<void, payload_move_constructor>;
#ifndef __clang__ // TRANSITION, LLVM-46269
static_assert(is_trivially_move_constructible_v<Expected> == should_be_trivial);
#endif // !__clang__
static_assert(is_move_constructible_v<Expected>);

Expected value_input{in_place};
Expand Down Expand Up @@ -410,15 +398,12 @@ namespace test_expected {
template <IsTriviallyDestructible triviallyDestructible>
struct payload_destructor {
constexpr payload_destructor(bool& destructor_called) : _destructor_called(destructor_called) {}
bool& _destructor_called;
};
template <> // TRANSITION, LLVM-46269
struct payload_destructor<IsTriviallyDestructible::Not> {
constexpr payload_destructor(bool& destructor_called) : _destructor_called(destructor_called) {}
payload_destructor(const payload_destructor&) = default;
// clang-format off
constexpr ~payload_destructor() requires (IsYes(triviallyDestructible)) = default;
// clang-format on
constexpr ~payload_destructor() {
_destructor_called = true;
};
}

bool& _destructor_called;
};
Expand All @@ -428,9 +413,7 @@ namespace test_expected {
bool destructor_called = false;
{ // Check payload
using Expected = expected<payload_destructor<triviallyDestructible>, int>;
#ifndef __clang__ // TRANSITION, LLVM-46269
static_assert(is_trivially_destructible_v<Expected> == is_trivial);
#endif // !__clang__

Expected val{in_place, destructor_called};
}
Expand All @@ -439,9 +422,7 @@ namespace test_expected {

{ // Check error
using Expected = expected<int, payload_destructor<triviallyDestructible>>;
#ifndef __clang__ // TRANSITION, LLVM-46269
static_assert(is_trivially_destructible_v<Expected> == is_trivial);
#endif // !__clang__

Expected err{unexpect, destructor_called};
}
Expand All @@ -450,9 +431,7 @@ namespace test_expected {

{ // Check void error
using Expected = expected<void, payload_destructor<triviallyDestructible>>;
#ifndef __clang__ // TRANSITION, LLVM-46269
static_assert(is_trivially_destructible_v<Expected> == is_trivial);
#endif // !__clang__

Expected err{unexpect, destructor_called};
}
Expand Down
3 changes: 2 additions & 1 deletion tests/std/tests/P0896R4_ranges_alg_is_permutation/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ struct instantiator {

NonCopyableBool() = default;
NonCopyableBool(const NonCopyableBool&) = delete;
} b;
};
NonCopyableBool b;
assert(ranges::is_permutation(range2, range2, [&](auto, auto) -> NonCopyableBool& { return b; }));
}
}
Expand Down

0 comments on commit 296e840

Please sign in to comment.