diff --git a/include/rocksdb/comparator.h b/include/rocksdb/comparator.h index c8c720b2f..9c0694cc8 100644 --- a/include/rocksdb/comparator.h +++ b/include/rocksdb/comparator.h @@ -75,7 +75,7 @@ class Comparator : public Customizable { // // Names starting with "rocksdb." are reserved and should not be used // by any clients of this package. - virtual const char* Name() const override = 0; + const char* Name() const override = 0; // Advanced functions: these are used to reduce the space requirements // for internal data structures like index blocks. diff --git a/include/rocksdb/file_checksum.h b/include/rocksdb/file_checksum.h index e993690b4..0645299e1 100644 --- a/include/rocksdb/file_checksum.h +++ b/include/rocksdb/file_checksum.h @@ -85,7 +85,7 @@ class FileChecksumGenFactory : public Customizable { const FileChecksumGenContext& context) = 0; // Return the name of this FileChecksumGenFactory. - virtual const char* Name() const override = 0; + const char* Name() const override = 0; }; // FileChecksumList stores the checksum information of a list of files (e.g., diff --git a/include/rocksdb/memtablerep.h b/include/rocksdb/memtablerep.h index 64ebaf966..66332978d 100644 --- a/include/rocksdb/memtablerep.h +++ b/include/rocksdb/memtablerep.h @@ -311,7 +311,7 @@ class MemTableRepFactory : public Customizable { return CreateMemTableRep(key_cmp, allocator, slice_transform, logger); } - virtual const char* Name() const override = 0; + const char* Name() const override = 0; // Return true if the current MemTableRep supports concurrent inserts // Default: false diff --git a/include/rocksdb/sst_partitioner.h b/include/rocksdb/sst_partitioner.h index 9765f61ec..e2370132c 100644 --- a/include/rocksdb/sst_partitioner.h +++ b/include/rocksdb/sst_partitioner.h @@ -93,7 +93,7 @@ class SstPartitionerFactory : public Customizable { const SstPartitioner::Context& context) const = 0; // Returns a name that identifies this partitioner factory. - virtual const char* Name() const override = 0; + const char* Name() const override = 0; }; /* diff --git a/include/rocksdb/table_properties.h b/include/rocksdb/table_properties.h index a6813e9e8..e26b43d77 100644 --- a/include/rocksdb/table_properties.h +++ b/include/rocksdb/table_properties.h @@ -162,7 +162,7 @@ class TablePropertiesCollectorFactory : public Customizable { TablePropertiesCollectorFactory::Context context) = 0; // The name of the properties collector can be used for debugging purpose. - virtual const char* Name() const override = 0; + const char* Name() const override = 0; // Can be overridden by sub-classes to return the Name, followed by // configuration info that will // be logged to the info log when the diff --git a/options/customizable_test.cc b/options/customizable_test.cc index ea6e73fb2..2973f3c62 100644 --- a/options/customizable_test.cc +++ b/options/customizable_test.cc @@ -206,22 +206,31 @@ struct SimpleOptions { TestCustomizable* cp = nullptr; }; +static SimpleOptions dummy_simple_options; +template +int offset_of(T1 SimpleOptions::*member) { + return static_cast( + reinterpret_cast( + std::addressof(dummy_simple_options.*member)) - + reinterpret_cast(std::addressof(dummy_simple_options))); +} + static std::unordered_map simple_option_info = { #ifndef ROCKSDB_LITE {"bool", - {offsetof(struct SimpleOptions, b), OptionType::kBoolean, + {offset_of(&SimpleOptions::b), OptionType::kBoolean, OptionVerificationType::kNormal, OptionTypeFlags::kNone}}, {"unique", OptionTypeInfo::AsCustomUniquePtr( - offsetof(struct SimpleOptions, cu), OptionVerificationType::kNormal, + offset_of(&SimpleOptions::cu), OptionVerificationType::kNormal, OptionTypeFlags::kAllowNull)}, {"shared", OptionTypeInfo::AsCustomSharedPtr( - offsetof(struct SimpleOptions, cs), OptionVerificationType::kNormal, + offset_of(&SimpleOptions::cs), OptionVerificationType::kNormal, OptionTypeFlags::kAllowNull)}, {"pointer", OptionTypeInfo::AsCustomRawPtr( - offsetof(struct SimpleOptions, cp), OptionVerificationType::kNormal, + offset_of(&SimpleOptions::cp), OptionVerificationType::kNormal, OptionTypeFlags::kAllowNull)}, #endif // ROCKSDB_LITE };