forked from OSchip/llvm-project
Revert "[libcxx] Resolve warnings for Wshift-sign-overflow"
This reverts commit 774c39313e
.
This commit is contained in:
parent
774c39313e
commit
5a42e2bc28
|
@ -212,7 +212,7 @@ class _LIBCPP_TEMPLATE_VIS duration
|
||||||
static const intmax_t __d1 = _R1::den / __gcd_d1_d2;
|
static const intmax_t __d1 = _R1::den / __gcd_d1_d2;
|
||||||
static const intmax_t __n2 = _R2::num / __gcd_n1_n2;
|
static const intmax_t __n2 = _R2::num / __gcd_n1_n2;
|
||||||
static const intmax_t __d2 = _R2::den / __gcd_d1_d2;
|
static const intmax_t __d2 = _R2::den / __gcd_d1_d2;
|
||||||
static const intmax_t max = numeric_limits<intmax_t>::max();
|
static const intmax_t max = -((intmax_t(1) << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1);
|
||||||
|
|
||||||
template <intmax_t _Xp, intmax_t _Yp, bool __overflow>
|
template <intmax_t _Xp, intmax_t _Yp, bool __overflow>
|
||||||
struct __mul // __overflow == false
|
struct __mul // __overflow == false
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
#include <__type_traits/alignment_of.h>
|
#include <__type_traits/alignment_of.h>
|
||||||
#include <__utility/pair.h>
|
#include <__utility/pair.h>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <limits>
|
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
|
@ -29,7 +28,9 @@ pair<_Tp*, ptrdiff_t>
|
||||||
get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT
|
get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT
|
||||||
{
|
{
|
||||||
pair<_Tp*, ptrdiff_t> __r(0, 0);
|
pair<_Tp*, ptrdiff_t> __r(0, 0);
|
||||||
const ptrdiff_t __m = (~ptrdiff_t(0) ^ numeric_limits<ptrdiff_t>::min()) / sizeof(_Tp);
|
const ptrdiff_t __m = (~ptrdiff_t(0) ^
|
||||||
|
ptrdiff_t(ptrdiff_t(1) << (sizeof(ptrdiff_t) * __CHAR_BIT__ - 1)))
|
||||||
|
/ sizeof(_Tp);
|
||||||
if (__n > __m)
|
if (__n > __m)
|
||||||
__n = __m;
|
__n = __m;
|
||||||
while (__n > 0)
|
while (__n > 0)
|
||||||
|
|
|
@ -79,8 +79,8 @@ typedef ratio<1000000000000000000000000, 1> yotta; // not supported
|
||||||
|
|
||||||
#include <__assert> // all public C++ headers provide the assertion handler
|
#include <__assert> // all public C++ headers provide the assertion handler
|
||||||
#include <__config>
|
#include <__config>
|
||||||
|
#include <climits>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <limits>
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <version>
|
#include <version>
|
||||||
|
|
||||||
|
@ -140,8 +140,8 @@ class __ll_add;
|
||||||
template <intmax_t _Xp, intmax_t _Yp>
|
template <intmax_t _Xp, intmax_t _Yp>
|
||||||
class __ll_add<_Xp, _Yp, 1>
|
class __ll_add<_Xp, _Yp, 1>
|
||||||
{
|
{
|
||||||
static const intmax_t min = numeric_limits<intmax_t>::min() + 1;
|
static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
|
||||||
static const intmax_t max = numeric_limits<intmax_t>::max();
|
static const intmax_t max = -min;
|
||||||
|
|
||||||
static_assert(_Xp <= max - _Yp, "overflow in __ll_add");
|
static_assert(_Xp <= max - _Yp, "overflow in __ll_add");
|
||||||
public:
|
public:
|
||||||
|
@ -158,8 +158,8 @@ public:
|
||||||
template <intmax_t _Xp, intmax_t _Yp>
|
template <intmax_t _Xp, intmax_t _Yp>
|
||||||
class __ll_add<_Xp, _Yp, -1>
|
class __ll_add<_Xp, _Yp, -1>
|
||||||
{
|
{
|
||||||
static const intmax_t min = numeric_limits<intmax_t>::min() + 1;
|
static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
|
||||||
static const intmax_t max = numeric_limits<intmax_t>::max();
|
static const intmax_t max = -min;
|
||||||
|
|
||||||
static_assert(min - _Yp <= _Xp, "overflow in __ll_add");
|
static_assert(min - _Yp <= _Xp, "overflow in __ll_add");
|
||||||
public:
|
public:
|
||||||
|
@ -172,8 +172,8 @@ class __ll_sub;
|
||||||
template <intmax_t _Xp, intmax_t _Yp>
|
template <intmax_t _Xp, intmax_t _Yp>
|
||||||
class __ll_sub<_Xp, _Yp, 1>
|
class __ll_sub<_Xp, _Yp, 1>
|
||||||
{
|
{
|
||||||
static const intmax_t min = numeric_limits<intmax_t>::min() + 1;
|
static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
|
||||||
static const intmax_t max = numeric_limits<intmax_t>::max();
|
static const intmax_t max = -min;
|
||||||
|
|
||||||
static_assert(min + _Yp <= _Xp, "overflow in __ll_sub");
|
static_assert(min + _Yp <= _Xp, "overflow in __ll_sub");
|
||||||
public:
|
public:
|
||||||
|
@ -190,8 +190,8 @@ public:
|
||||||
template <intmax_t _Xp, intmax_t _Yp>
|
template <intmax_t _Xp, intmax_t _Yp>
|
||||||
class __ll_sub<_Xp, _Yp, -1>
|
class __ll_sub<_Xp, _Yp, -1>
|
||||||
{
|
{
|
||||||
static const intmax_t min = numeric_limits<intmax_t>::min() + 1;
|
static const intmax_t min = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1;
|
||||||
static const intmax_t max = numeric_limits<intmax_t>::max();
|
static const intmax_t max = -min;
|
||||||
|
|
||||||
static_assert(_Xp <= max + _Yp, "overflow in __ll_sub");
|
static_assert(_Xp <= max + _Yp, "overflow in __ll_sub");
|
||||||
public:
|
public:
|
||||||
|
@ -201,9 +201,9 @@ public:
|
||||||
template <intmax_t _Xp, intmax_t _Yp>
|
template <intmax_t _Xp, intmax_t _Yp>
|
||||||
class __ll_mul
|
class __ll_mul
|
||||||
{
|
{
|
||||||
static const intmax_t nan = numeric_limits<intmax_t>::min();
|
static const intmax_t nan = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1));
|
||||||
static const intmax_t min = numeric_limits<intmax_t>::min() + 1;
|
static const intmax_t min = nan + 1;
|
||||||
static const intmax_t max = numeric_limits<intmax_t>::max();
|
static const intmax_t max = -min;
|
||||||
static const intmax_t __a_x = __static_abs<_Xp>::value;
|
static const intmax_t __a_x = __static_abs<_Xp>::value;
|
||||||
static const intmax_t __a_y = __static_abs<_Yp>::value;
|
static const intmax_t __a_y = __static_abs<_Yp>::value;
|
||||||
|
|
||||||
|
@ -237,9 +237,9 @@ public:
|
||||||
template <intmax_t _Xp, intmax_t _Yp>
|
template <intmax_t _Xp, intmax_t _Yp>
|
||||||
class __ll_div
|
class __ll_div
|
||||||
{
|
{
|
||||||
static const intmax_t nan = numeric_limits<intmax_t>::min();
|
static const intmax_t nan = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1));
|
||||||
static const intmax_t min = numeric_limits<intmax_t>::min() + 1;
|
static const intmax_t min = nan + 1;
|
||||||
static const intmax_t max = numeric_limits<intmax_t>::max();
|
static const intmax_t max = -min;
|
||||||
|
|
||||||
static_assert(_Xp != nan && _Yp != nan && _Yp != 0, "overflow in __ll_div");
|
static_assert(_Xp != nan && _Yp != nan && _Yp != 0, "overflow in __ll_div");
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -15,7 +15,6 @@ _warningFlags = [
|
||||||
'-Wall',
|
'-Wall',
|
||||||
'-Wextra',
|
'-Wextra',
|
||||||
'-Wshadow',
|
'-Wshadow',
|
||||||
'-Wshift-sign-overflow',
|
|
||||||
'-Wundef',
|
'-Wundef',
|
||||||
'-Wno-unused-command-line-argument',
|
'-Wno-unused-command-line-argument',
|
||||||
'-Wno-attributes',
|
'-Wno-attributes',
|
||||||
|
|
Loading…
Reference in New Issue