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;
}
// VS < 2015
#if defined(_MSC_VER) && (_MSC_VER < 1900)
#define snprintf _snprintf
#endif
#endif
const char* phase = "";

@ -42,16 +42,8 @@ class IOStatus : public Status {
// Copy the specified status.
IOStatus(const IOStatus& s);
IOStatus& operator=(const IOStatus& s);
IOStatus(IOStatus&& s)
#if !(defined _MSC_VER) || ((defined _MSC_VER) && (_MSC_VER >= 1900))
noexcept
#endif
;
IOStatus& operator=(IOStatus&& s)
#if !(defined _MSC_VER) || ((defined _MSC_VER) && (_MSC_VER >= 1900))
noexcept
#endif
;
IOStatus(IOStatus&& s) noexcept;
IOStatus& operator=(IOStatus&& s) noexcept;
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;
}
inline IOStatus::IOStatus(IOStatus&& s)
#if !(defined _MSC_VER) || ((defined _MSC_VER) && (_MSC_VER >= 1900))
noexcept
#endif
: IOStatus() {
inline IOStatus::IOStatus(IOStatus&& s) noexcept : IOStatus() {
*this = std::move(s);
}
inline IOStatus& IOStatus::operator=(IOStatus&& s)
#if !(defined _MSC_VER) || ((defined _MSC_VER) && (_MSC_VER >= 1900))
noexcept
#endif
{
inline IOStatus& IOStatus::operator=(IOStatus&& s) noexcept {
if (this != &s) {
#ifdef ROCKSDB_ASSERT_STATUS_CHECKED
s.checked_ = true;

@ -56,16 +56,8 @@ class Status {
// Copy the specified status.
Status(const Status& s);
Status& operator=(const Status& s);
Status(Status&& s)
#if !(defined _MSC_VER) || ((defined _MSC_VER) && (_MSC_VER >= 1900))
noexcept
#endif
;
Status& operator=(Status&& s)
#if !(defined _MSC_VER) || ((defined _MSC_VER) && (_MSC_VER >= 1900))
noexcept
#endif
;
Status(Status&& s) noexcept;
Status& operator=(Status&& s) noexcept;
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;
}
inline Status::Status(Status&& s)
#if !(defined _MSC_VER) || ((defined _MSC_VER) && (_MSC_VER >= 1900))
noexcept
#endif
: Status() {
inline Status::Status(Status&& s) noexcept : Status() {
s.MarkChecked();
*this = std::move(s);
}
inline Status& Status::operator=(Status&& s)
#if !(defined _MSC_VER) || ((defined _MSC_VER) && (_MSC_VER >= 1900))
noexcept
#endif
{
inline Status& Status::operator=(Status&& s) noexcept {
if (this != &s) {
s.MarkChecked();
MustCheck();

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

@ -70,20 +70,6 @@ extern const bool kDefaultToAdaptiveMutex;
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."
// https://docs.microsoft.com/en-us/windows/win32/sysinfo/registry-value-types
constexpr bool kLittleEndian = true;
@ -230,8 +216,8 @@ extern void InitOnce(OnceType* once, void (*initializer)());
#ifdef ROCKSDB_JEMALLOC
// Separate inlines so they can be replaced if needed
void* jemalloc_aligned_alloc(size_t size, size_t alignment) ROCKSDB_NOEXCEPT;
void jemalloc_aligned_free(void* p) ROCKSDB_NOEXCEPT;
void* jemalloc_aligned_alloc(size_t size, size_t alignment) noexcept;
void jemalloc_aligned_free(void* p) noexcept;
#endif
inline void *cacheline_aligned_alloc(size_t size) {

@ -41,10 +41,10 @@ ZSTD_customMem GetJeZstdAllocationOverrides() {
namespace ROCKSDB_NAMESPACE {
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);
}
void jemalloc_aligned_free(void* p) ROCKSDB_NOEXCEPT { je_free(p); }
void jemalloc_aligned_free(void* p) noexcept { je_free(p); }
} // namespace port
} // namespace ROCKSDB_NAMESPACE

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

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

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

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

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

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

Loading…
Cancel
Save