Remove code that only compiles for Visual Studio versions older than 2015 (#10065)

Summary:
There are currently some preprocessor checks that assume support for Visual Studio versions older than 2015 (i.e., 0 < _MSC_VER < 1900), although we don't support them any more.

We removed all code that only compiles on those older versions, except third-party/ files.

The ROCKSDB_NOEXCEPT symbol is now obsolete, since it now always gets replaced by noexcept. We removed it.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/10065

Reviewed By: pdillinger

Differential Revision: D36721901

Pulled By: guidotag

fbshipit-source-id: a2892d365ef53cce44a0a7d90dd6b72ee9b5e5f2
main
tagliavini 2 years ago committed by Facebook GitHub Bot
parent 91ba7837b7
commit 6c50082654
  1. 5
      db/c_test.c
  2. 24
      include/rocksdb/io_status.h
  3. 24
      include/rocksdb/status.h
  4. 2
      port/port_posix.h
  5. 18
      port/win/port_win.h
  6. 4
      port/win/win_jemalloc.cc
  7. 4
      table/format.h
  8. 7
      table/scoped_arena_iterator.h
  9. 6
      util/aligned_buffer.h
  10. 12
      util/compression.h
  11. 16
      utilities/backup/backup_engine.cc
  12. 5
      utilities/persistent_cache/volatile_tier_impl.h

@ -33,11 +33,6 @@ int geteuid() {
return result; return result;
} }
// VS < 2015
#if defined(_MSC_VER) && (_MSC_VER < 1900)
#define snprintf _snprintf
#endif
#endif #endif
const char* phase = ""; const char* phase = "";

@ -42,16 +42,8 @@ class IOStatus : public Status {
// Copy the specified status. // Copy the specified status.
IOStatus(const IOStatus& s); IOStatus(const IOStatus& s);
IOStatus& operator=(const IOStatus& s); IOStatus& operator=(const IOStatus& s);
IOStatus(IOStatus&& s) IOStatus(IOStatus&& s) noexcept;
#if !(defined _MSC_VER) || ((defined _MSC_VER) && (_MSC_VER >= 1900)) IOStatus& operator=(IOStatus&& s) noexcept;
noexcept
#endif
;
IOStatus& operator=(IOStatus&& s)
#if !(defined _MSC_VER) || ((defined _MSC_VER) && (_MSC_VER >= 1900))
noexcept
#endif
;
bool operator==(const IOStatus& rhs) const; bool operator==(const IOStatus& rhs) const;
bool operator!=(const IOStatus& rhs) const; bool operator!=(const IOStatus& rhs) const;
@ -194,19 +186,11 @@ inline IOStatus& IOStatus::operator=(const IOStatus& s) {
return *this; return *this;
} }
inline IOStatus::IOStatus(IOStatus&& s) inline IOStatus::IOStatus(IOStatus&& s) noexcept : IOStatus() {
#if !(defined _MSC_VER) || ((defined _MSC_VER) && (_MSC_VER >= 1900))
noexcept
#endif
: IOStatus() {
*this = std::move(s); *this = std::move(s);
} }
inline IOStatus& IOStatus::operator=(IOStatus&& s) inline IOStatus& IOStatus::operator=(IOStatus&& s) noexcept {
#if !(defined _MSC_VER) || ((defined _MSC_VER) && (_MSC_VER >= 1900))
noexcept
#endif
{
if (this != &s) { if (this != &s) {
#ifdef ROCKSDB_ASSERT_STATUS_CHECKED #ifdef ROCKSDB_ASSERT_STATUS_CHECKED
s.checked_ = true; s.checked_ = true;

@ -56,16 +56,8 @@ class Status {
// Copy the specified status. // Copy the specified status.
Status(const Status& s); Status(const Status& s);
Status& operator=(const Status& s); Status& operator=(const Status& s);
Status(Status&& s) Status(Status&& s) noexcept;
#if !(defined _MSC_VER) || ((defined _MSC_VER) && (_MSC_VER >= 1900)) Status& operator=(Status&& s) noexcept;
noexcept
#endif
;
Status& operator=(Status&& s)
#if !(defined _MSC_VER) || ((defined _MSC_VER) && (_MSC_VER >= 1900))
noexcept
#endif
;
bool operator==(const Status& rhs) const; bool operator==(const Status& rhs) const;
bool operator!=(const Status& rhs) const; bool operator!=(const Status& rhs) const;
@ -537,20 +529,12 @@ inline Status& Status::operator=(const Status& s) {
return *this; return *this;
} }
inline Status::Status(Status&& s) inline Status::Status(Status&& s) noexcept : Status() {
#if !(defined _MSC_VER) || ((defined _MSC_VER) && (_MSC_VER >= 1900))
noexcept
#endif
: Status() {
s.MarkChecked(); s.MarkChecked();
*this = std::move(s); *this = std::move(s);
} }
inline Status& Status::operator=(Status&& s) inline Status& Status::operator=(Status&& s) noexcept {
#if !(defined _MSC_VER) || ((defined _MSC_VER) && (_MSC_VER >= 1900))
noexcept
#endif
{
if (this != &s) { if (this != &s) {
s.MarkChecked(); s.MarkChecked();
MustCheck(); MustCheck();

@ -23,8 +23,6 @@
#define __declspec(S) #define __declspec(S)
#define ROCKSDB_NOEXCEPT noexcept
#undef PLATFORM_IS_LITTLE_ENDIAN #undef PLATFORM_IS_LITTLE_ENDIAN
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
#include <machine/endian.h> #include <machine/endian.h>

@ -70,20 +70,6 @@ extern const bool kDefaultToAdaptiveMutex;
namespace port { namespace port {
// VS < 2015
#if defined(_MSC_VER) && (_MSC_VER < 1900)
// VS 15 has snprintf
#define snprintf _snprintf
#define ROCKSDB_NOEXCEPT
#else // VS >= 2015 or MinGW
#define ROCKSDB_NOEXCEPT noexcept
#endif //_MSC_VER
// "Windows is designed to run on little-endian computer architectures." // "Windows is designed to run on little-endian computer architectures."
// https://docs.microsoft.com/en-us/windows/win32/sysinfo/registry-value-types // https://docs.microsoft.com/en-us/windows/win32/sysinfo/registry-value-types
constexpr bool kLittleEndian = true; constexpr bool kLittleEndian = true;
@ -230,8 +216,8 @@ extern void InitOnce(OnceType* once, void (*initializer)());
#ifdef ROCKSDB_JEMALLOC #ifdef ROCKSDB_JEMALLOC
// Separate inlines so they can be replaced if needed // Separate inlines so they can be replaced if needed
void* jemalloc_aligned_alloc(size_t size, size_t alignment) ROCKSDB_NOEXCEPT; void* jemalloc_aligned_alloc(size_t size, size_t alignment) noexcept;
void jemalloc_aligned_free(void* p) ROCKSDB_NOEXCEPT; void jemalloc_aligned_free(void* p) noexcept;
#endif #endif
inline void *cacheline_aligned_alloc(size_t size) { inline void *cacheline_aligned_alloc(size_t size) {

@ -41,10 +41,10 @@ ZSTD_customMem GetJeZstdAllocationOverrides() {
namespace ROCKSDB_NAMESPACE { namespace ROCKSDB_NAMESPACE {
namespace port { namespace port {
void* jemalloc_aligned_alloc(size_t size, size_t alignment) ROCKSDB_NOEXCEPT { void* jemalloc_aligned_alloc(size_t size, size_t alignment) noexcept {
return je_aligned_alloc(alignment, size); return je_aligned_alloc(alignment, size);
} }
void jemalloc_aligned_free(void* p) ROCKSDB_NOEXCEPT { je_free(p); } void jemalloc_aligned_free(void* p) noexcept { je_free(p); }
} // namespace port } // namespace port
} // namespace ROCKSDB_NAMESPACE } // namespace ROCKSDB_NAMESPACE

@ -307,9 +307,7 @@ struct BlockContents {
return usable_size() + sizeof(*this); return usable_size() + sizeof(*this);
} }
BlockContents(BlockContents&& other) ROCKSDB_NOEXCEPT { BlockContents(BlockContents&& other) noexcept { *this = std::move(other); }
*this = std::move(other);
}
BlockContents& operator=(BlockContents&& other) { BlockContents& operator=(BlockContents&& other) {
data = std::move(other.data); data = std::move(other.data);

@ -12,8 +12,7 @@
namespace ROCKSDB_NAMESPACE { namespace ROCKSDB_NAMESPACE {
class ScopedArenaIterator { class ScopedArenaIterator {
void reset(InternalIterator* iter) noexcept {
void reset(InternalIterator* iter) ROCKSDB_NOEXCEPT {
if (iter_ != nullptr) { if (iter_ != nullptr) {
iter_->~InternalIterator(); iter_->~InternalIterator();
} }
@ -28,12 +27,12 @@ class ScopedArenaIterator {
ScopedArenaIterator(const ScopedArenaIterator&) = delete; ScopedArenaIterator(const ScopedArenaIterator&) = delete;
ScopedArenaIterator& operator=(const ScopedArenaIterator&) = delete; ScopedArenaIterator& operator=(const ScopedArenaIterator&) = delete;
ScopedArenaIterator(ScopedArenaIterator&& o) ROCKSDB_NOEXCEPT { ScopedArenaIterator(ScopedArenaIterator&& o) noexcept {
iter_ = o.iter_; iter_ = o.iter_;
o.iter_ = nullptr; o.iter_ = nullptr;
} }
ScopedArenaIterator& operator=(ScopedArenaIterator&& o) ROCKSDB_NOEXCEPT { ScopedArenaIterator& operator=(ScopedArenaIterator&& o) noexcept {
reset(o.iter_); reset(o.iter_);
o.iter_ = nullptr; o.iter_ = nullptr;
return *this; return *this;

@ -69,11 +69,9 @@ public:
bufstart_(nullptr) { bufstart_(nullptr) {
} }
AlignedBuffer(AlignedBuffer&& o) ROCKSDB_NOEXCEPT { AlignedBuffer(AlignedBuffer&& o) noexcept { *this = std::move(o); }
*this = std::move(o);
}
AlignedBuffer& operator=(AlignedBuffer&& o) ROCKSDB_NOEXCEPT { AlignedBuffer& operator=(AlignedBuffer&& o) noexcept {
alignment_ = std::move(o.alignment_); alignment_ = std::move(o.alignment_);
buf_ = std::move(o.buf_); buf_ = std::move(o.buf_);
capacity_ = std::move(o.capacity_); capacity_ = std::move(o.capacity_);

@ -86,12 +86,11 @@ class ZSTDUncompressCachedData {
// Init from cache // Init from cache
ZSTDUncompressCachedData(const ZSTDUncompressCachedData& o) = delete; ZSTDUncompressCachedData(const ZSTDUncompressCachedData& o) = delete;
ZSTDUncompressCachedData& operator=(const ZSTDUncompressCachedData&) = delete; ZSTDUncompressCachedData& operator=(const ZSTDUncompressCachedData&) = delete;
ZSTDUncompressCachedData(ZSTDUncompressCachedData&& o) ROCKSDB_NOEXCEPT ZSTDUncompressCachedData(ZSTDUncompressCachedData&& o) noexcept
: ZSTDUncompressCachedData() { : ZSTDUncompressCachedData() {
*this = std::move(o); *this = std::move(o);
} }
ZSTDUncompressCachedData& operator=(ZSTDUncompressCachedData&& o) ZSTDUncompressCachedData& operator=(ZSTDUncompressCachedData&& o) noexcept {
ROCKSDB_NOEXCEPT {
assert(zstd_ctx_ == nullptr); assert(zstd_ctx_ == nullptr);
std::swap(zstd_ctx_, o.zstd_ctx_); std::swap(zstd_ctx_, o.zstd_ctx_);
std::swap(cache_idx_, o.cache_idx_); std::swap(cache_idx_, o.cache_idx_);
@ -137,10 +136,9 @@ class ZSTDUncompressCachedData {
ZSTDUncompressCachedData() {} ZSTDUncompressCachedData() {}
ZSTDUncompressCachedData(const ZSTDUncompressCachedData&) {} ZSTDUncompressCachedData(const ZSTDUncompressCachedData&) {}
ZSTDUncompressCachedData& operator=(const ZSTDUncompressCachedData&) = delete; ZSTDUncompressCachedData& operator=(const ZSTDUncompressCachedData&) = delete;
ZSTDUncompressCachedData(ZSTDUncompressCachedData&&) ZSTDUncompressCachedData(ZSTDUncompressCachedData&&) noexcept = default;
ROCKSDB_NOEXCEPT = default; ZSTDUncompressCachedData& operator=(ZSTDUncompressCachedData&&) noexcept =
ZSTDUncompressCachedData& operator=(ZSTDUncompressCachedData&&) default;
ROCKSDB_NOEXCEPT = default;
ZSTDNativeContext Get() const { return nullptr; } ZSTDNativeContext Get() const { return nullptr; }
int64_t GetCacheIndex() const { return -1; } int64_t GetCacheIndex() const { return -1; }
void CreateIfNeeded() {} void CreateIfNeeded() {}

@ -699,11 +699,11 @@ class BackupEngineImpl {
CopyOrCreateWorkItem(const CopyOrCreateWorkItem&) = delete; CopyOrCreateWorkItem(const CopyOrCreateWorkItem&) = delete;
CopyOrCreateWorkItem& operator=(const CopyOrCreateWorkItem&) = delete; CopyOrCreateWorkItem& operator=(const CopyOrCreateWorkItem&) = delete;
CopyOrCreateWorkItem(CopyOrCreateWorkItem&& o) ROCKSDB_NOEXCEPT { CopyOrCreateWorkItem(CopyOrCreateWorkItem&& o) noexcept {
*this = std::move(o); *this = std::move(o);
} }
CopyOrCreateWorkItem& operator=(CopyOrCreateWorkItem&& o) ROCKSDB_NOEXCEPT { CopyOrCreateWorkItem& operator=(CopyOrCreateWorkItem&& o) noexcept {
src_path = std::move(o.src_path); src_path = std::move(o.src_path);
dst_path = std::move(o.dst_path); dst_path = std::move(o.dst_path);
src_temperature = std::move(o.src_temperature); src_temperature = std::move(o.src_temperature);
@ -772,13 +772,13 @@ class BackupEngineImpl {
dst_path(""), dst_path(""),
dst_relative("") {} dst_relative("") {}
BackupAfterCopyOrCreateWorkItem(BackupAfterCopyOrCreateWorkItem&& o) BackupAfterCopyOrCreateWorkItem(
ROCKSDB_NOEXCEPT { BackupAfterCopyOrCreateWorkItem&& o) noexcept {
*this = std::move(o); *this = std::move(o);
} }
BackupAfterCopyOrCreateWorkItem& operator=( BackupAfterCopyOrCreateWorkItem& operator=(
BackupAfterCopyOrCreateWorkItem&& o) ROCKSDB_NOEXCEPT { BackupAfterCopyOrCreateWorkItem&& o) noexcept {
result = std::move(o.result); result = std::move(o.result);
shared = o.shared; shared = o.shared;
needed_to_copy = o.needed_to_copy; needed_to_copy = o.needed_to_copy;
@ -817,13 +817,13 @@ class BackupEngineImpl {
from_file(_from_file), from_file(_from_file),
to_file(_to_file), to_file(_to_file),
checksum_hex(_checksum_hex) {} checksum_hex(_checksum_hex) {}
RestoreAfterCopyOrCreateWorkItem(RestoreAfterCopyOrCreateWorkItem&& o) RestoreAfterCopyOrCreateWorkItem(
ROCKSDB_NOEXCEPT { RestoreAfterCopyOrCreateWorkItem&& o) noexcept {
*this = std::move(o); *this = std::move(o);
} }
RestoreAfterCopyOrCreateWorkItem& operator=( RestoreAfterCopyOrCreateWorkItem& operator=(
RestoreAfterCopyOrCreateWorkItem&& o) ROCKSDB_NOEXCEPT { RestoreAfterCopyOrCreateWorkItem&& o) noexcept {
result = std::move(o.result); result = std::move(o.result);
checksum_hex = std::move(o.checksum_hex); checksum_hex = std::move(o.checksum_hex);
return *this; return *this;

@ -74,9 +74,8 @@ class VolatileCacheTier : public PersistentCacheTier {
// Cache data abstraction // Cache data abstraction
// //
struct CacheData : LRUElement<CacheData> { struct CacheData : LRUElement<CacheData> {
explicit CacheData(CacheData&& rhs) ROCKSDB_NOEXCEPT explicit CacheData(CacheData&& rhs) noexcept
: key(std::move(rhs.key)), : key(std::move(rhs.key)), value(std::move(rhs.value)) {}
value(std::move(rhs.value)) {}
explicit CacheData(const std::string& _key, const std::string& _value = "") explicit CacheData(const std::string& _key, const std::string& _value = "")
: key(_key), value(_value) {} : key(_key), value(_value) {}

Loading…
Cancel
Save