diff options
author | Jeffrey <jeffryan@tamu.edu> | 2022-03-07 20:00:51 -0600 |
---|---|---|
committer | Jeffrey <jeffryan@tamu.edu> | 2022-04-18 09:55:21 -0500 |
commit | 87ec36cacfd408cfe7405f804b35e29aefd209b4 (patch) | |
tree | 30b7044877a934bda97ff1c12a2cf11b04c93bf4 /contrib/epee/include/storages | |
parent | Merge functionality of misc_os_dependent into time_helper.h (diff) | |
download | monero-87ec36cacfd408cfe7405f804b35e29aefd209b4.tar.xz |
Refactor out pragma_comp_defs
Relevant commits on the old cleanup PR:
36933c7f5c7778e2d7fbfea5361c11fb41070467
21e43de0f300ee47b7e597098908601bf591950b
3c678bb1cedfd7b865ac2e7aaf014de4bfb3eb3d
Diffstat (limited to 'contrib/epee/include/storages')
-rw-r--r-- | contrib/epee/include/storages/portable_storage_to_bin.h | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/contrib/epee/include/storages/portable_storage_to_bin.h b/contrib/epee/include/storages/portable_storage_to_bin.h index b82cf532b..be4033dd8 100644 --- a/contrib/epee/include/storages/portable_storage_to_bin.h +++ b/contrib/epee/include/storages/portable_storage_to_bin.h @@ -28,7 +28,6 @@ #pragma once -#include "pragma_comp_defs.h" #include "misc_language.h" #include "portable_storage_base.h" #include "portable_storage_bin_utils.h" @@ -49,12 +48,7 @@ namespace epee return sizeof(pack_value); } - PRAGMA_WARNING_PUSH - PRAGMA_GCC("GCC diagnostic ignored \"-Wstrict-aliasing\"") -#ifdef __clang__ - PRAGMA_GCC("GCC diagnostic ignored \"-Wtautological-constant-out-of-range-compare\"") -#endif - template<class t_stream> + template<class t_stream> size_t pack_varint(t_stream& strm, size_t val) { //the first two bits always reserved for size information @@ -70,13 +64,13 @@ namespace epee return pack_varint_t<uint32_t>(strm, PORTABLE_RAW_SIZE_MARK_DWORD, val); }else { - CHECK_AND_ASSERT_THROW_MES(val <= 4611686018427387903, "failed to pack varint - too big amount = " << val); + // Same as checking val <= 4611686018427387903 except that it's portable for 32-bit size_t + CHECK_AND_ASSERT_THROW_MES(!(val >> 31 >> 31), "failed to pack varint - too big amount = " << val); return pack_varint_t<uint64_t>(strm, PORTABLE_RAW_SIZE_MARK_INT64, val); } } - PRAGMA_WARNING_POP - template<class t_stream> + template<class t_stream> bool put_string(t_stream& strm, const std::string& v) { pack_varint(strm, v.size()); |