diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-06-03 15:26:15 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-06-04 22:34:20 +0200 |
commit | 34ae919f23b7d89844358afea23c73dc6469faf3 (patch) | |
tree | cf34ca843adc1c4f49058b54dc138dcc17f18ade /src/corelib/global | |
parent | 37cfc3c6d2e3b290c7fc41cd7545283d24e4433c (diff) |
Enforce two's complement integers
C++20 will make this true for everyone, but as far as Qt goes,
this has to apply to all platforms even before that.
Just add another couple of checks to the list.
Change-Id: I0251ce431d4584380cfd3fc3e4b36f1dbdbf9df2
Pick-to: 5.15
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/global')
-rw-r--r-- | src/corelib/global/qglobal.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 2b2a03cc76..798e445ee4 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -145,6 +145,10 @@ Q_STATIC_ASSERT_X(QT_POINTER_SIZE == sizeof(void *), "QT_POINTER_SIZE defined in Q_STATIC_ASSERT_X(sizeof(float) == 4, "Qt assumes that float is 32 bits"); Q_STATIC_ASSERT_X(sizeof(char16_t) == 2, "Qt assumes that char16_t is 16 bits"); Q_STATIC_ASSERT_X(sizeof(char32_t) == 4, "Qt assumes that char32_t is 32 bits"); +Q_STATIC_ASSERT_X(std::numeric_limits<int>::radix == 2, + "Qt assumes binary integers"); +Q_STATIC_ASSERT_X((std::numeric_limits<int>::max() + std::numeric_limits<int>::lowest()) == -1, + "Qt assumes two's complement integers"); // While we'd like to check for __STDC_IEC_559__, as per ISO/IEC 9899:2011 // Annex F (C11, normative for C++11), there are a few corner cases regarding |