Commit 8fe79ff1 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by facebook-github-bot-4

CodeMod: Drop FOLLY_OVERRIDE and FOLLY_FINAL

Summary: [Folly] CodeMod: Drop `FOLLY_OVERRIDE` and `FOLLY_FINAL`. These were to support GCC 4.6 and earlier, and MSVC 2008 and earlier.

Reviewed By: @philippv

Differential Revision: D2438309
parent e2c2baad
......@@ -172,21 +172,6 @@
namespace std { typedef ::max_align_t max_align_t; }
#endif
/* Define macro wrappers for C++11's "final" and "override" keywords, which
* are supported in gcc 4.7 but not gcc 4.6. */
#if !defined(FOLLY_FINAL) && !defined(FOLLY_OVERRIDE)
# if defined(__clang__) || __GNUC_PREREQ(4, 7)
# define FOLLY_FINAL final
# define FOLLY_OVERRIDE override
# elif defined(_MSC_VER) && _MSC_VER >= 1600
# define FOLLY_FINAL final
# define FOLLY_OVERRIDE override
# else
# define FOLLY_FINAL /**/
# define FOLLY_OVERRIDE /**/
# endif
#endif
/* Platform specific TLS support
* gcc implements __thread
* msvc implements __declspec(thread)
......
......@@ -215,7 +215,7 @@ class CalledProcessError : public SubprocessError {
public:
explicit CalledProcessError(ProcessReturnCode rc);
~CalledProcessError() throw() = default;
const char* what() const throw() FOLLY_OVERRIDE { return what_.c_str(); }
const char* what() const throw() override { return what_.c_str(); }
ProcessReturnCode returnCode() const { return returnCode_; }
private:
ProcessReturnCode returnCode_;
......@@ -229,7 +229,7 @@ class SubprocessSpawnError : public SubprocessError {
public:
SubprocessSpawnError(const char* executable, int errCode, int errnoValue);
~SubprocessSpawnError() throw() = default;
const char* what() const throw() FOLLY_OVERRIDE { return what_.c_str(); }
const char* what() const throw() override { return what_.c_str(); }
int errnoValue() const { return errnoValue_; }
private:
......
......@@ -101,16 +101,16 @@ namespace {
/**
* No compression
*/
class NoCompressionCodec FOLLY_FINAL : public Codec {
class NoCompressionCodec final : public Codec {
public:
static std::unique_ptr<Codec> create(int level, CodecType type);
explicit NoCompressionCodec(int level, CodecType type);
private:
std::unique_ptr<IOBuf> doCompress(const IOBuf* data) FOLLY_OVERRIDE;
std::unique_ptr<IOBuf> doCompress(const IOBuf* data) override;
std::unique_ptr<IOBuf> doUncompress(
const IOBuf* data,
uint64_t uncompressedLength) FOLLY_OVERRIDE;
uint64_t uncompressedLength) override;
};
std::unique_ptr<Codec> NoCompressionCodec::create(int level, CodecType type) {
......@@ -182,21 +182,21 @@ inline uint64_t decodeVarintFromCursor(folly::io::Cursor& cursor) {
/**
* LZ4 compression
*/
class LZ4Codec FOLLY_FINAL : public Codec {
class LZ4Codec final : public Codec {
public:
static std::unique_ptr<Codec> create(int level, CodecType type);
explicit LZ4Codec(int level, CodecType type);
private:
bool doNeedsUncompressedLength() const FOLLY_OVERRIDE;
uint64_t doMaxUncompressedLength() const FOLLY_OVERRIDE;
bool doNeedsUncompressedLength() const override;
uint64_t doMaxUncompressedLength() const override;
bool encodeSize() const { return type() == CodecType::LZ4_VARINT_SIZE; }
std::unique_ptr<IOBuf> doCompress(const IOBuf* data) FOLLY_OVERRIDE;
std::unique_ptr<IOBuf> doCompress(const IOBuf* data) override;
std::unique_ptr<IOBuf> doUncompress(
const IOBuf* data,
uint64_t uncompressedLength) FOLLY_OVERRIDE;
uint64_t uncompressedLength) override;
bool highCompression_;
};
......@@ -325,12 +325,12 @@ std::unique_ptr<IOBuf> LZ4Codec::doUncompress(
/**
* Implementation of snappy::Source that reads from a IOBuf chain.
*/
class IOBufSnappySource FOLLY_FINAL : public snappy::Source {
class IOBufSnappySource final : public snappy::Source {
public:
explicit IOBufSnappySource(const IOBuf* data);
size_t Available() const FOLLY_OVERRIDE;
const char* Peek(size_t* len) FOLLY_OVERRIDE;
void Skip(size_t n) FOLLY_OVERRIDE;
size_t Available() const override;
const char* Peek(size_t* len) override;
void Skip(size_t n) override;
private:
size_t available_;
io::Cursor cursor_;
......@@ -357,17 +357,17 @@ void IOBufSnappySource::Skip(size_t n) {
available_ -= n;
}
class SnappyCodec FOLLY_FINAL : public Codec {
class SnappyCodec final : public Codec {
public:
static std::unique_ptr<Codec> create(int level, CodecType type);
explicit SnappyCodec(int level, CodecType type);
private:
uint64_t doMaxUncompressedLength() const FOLLY_OVERRIDE;
std::unique_ptr<IOBuf> doCompress(const IOBuf* data) FOLLY_OVERRIDE;
uint64_t doMaxUncompressedLength() const override;
std::unique_ptr<IOBuf> doCompress(const IOBuf* data) override;
std::unique_ptr<IOBuf> doUncompress(
const IOBuf* data,
uint64_t uncompressedLength) FOLLY_OVERRIDE;
uint64_t uncompressedLength) override;
};
std::unique_ptr<Codec> SnappyCodec::create(int level, CodecType type) {
......@@ -443,16 +443,16 @@ std::unique_ptr<IOBuf> SnappyCodec::doUncompress(const IOBuf* data,
/**
* Zlib codec
*/
class ZlibCodec FOLLY_FINAL : public Codec {
class ZlibCodec final : public Codec {
public:
static std::unique_ptr<Codec> create(int level, CodecType type);
explicit ZlibCodec(int level, CodecType type);
private:
std::unique_ptr<IOBuf> doCompress(const IOBuf* data) FOLLY_OVERRIDE;
std::unique_ptr<IOBuf> doCompress(const IOBuf* data) override;
std::unique_ptr<IOBuf> doUncompress(
const IOBuf* data,
uint64_t uncompressedLength) FOLLY_OVERRIDE;
uint64_t uncompressedLength) override;
std::unique_ptr<IOBuf> addOutputBuffer(z_stream* stream, uint32_t length);
bool doInflate(z_stream* stream, IOBuf* head, uint32_t bufferLength);
......@@ -684,21 +684,21 @@ std::unique_ptr<IOBuf> ZlibCodec::doUncompress(const IOBuf* data,
/**
* LZMA2 compression
*/
class LZMA2Codec FOLLY_FINAL : public Codec {
class LZMA2Codec final : public Codec {
public:
static std::unique_ptr<Codec> create(int level, CodecType type);
explicit LZMA2Codec(int level, CodecType type);
private:
bool doNeedsUncompressedLength() const FOLLY_OVERRIDE;
uint64_t doMaxUncompressedLength() const FOLLY_OVERRIDE;
bool doNeedsUncompressedLength() const override;
uint64_t doMaxUncompressedLength() const override;
bool encodeSize() const { return type() == CodecType::LZMA2_VARINT_SIZE; }
std::unique_ptr<IOBuf> doCompress(const IOBuf* data) FOLLY_OVERRIDE;
std::unique_ptr<IOBuf> doCompress(const IOBuf* data) override;
std::unique_ptr<IOBuf> doUncompress(
const IOBuf* data,
uint64_t uncompressedLength) FOLLY_OVERRIDE;
uint64_t uncompressedLength) override;
std::unique_ptr<IOBuf> addOutputBuffer(lzma_stream* stream, size_t length);
bool doInflate(lzma_stream* stream, IOBuf* head, size_t bufferLength);
......
......@@ -28,7 +28,7 @@ class Base {
class Derived : public Base {
public:
int foo() const FOLLY_FINAL { return 2; }
int foo() const final { return 2; }
};
// A compiler that supports final will likely inline the call to p->foo()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment