diff --git a/fmt/format.h b/fmt/format.h index 5fb9611b..da1ef297 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -165,24 +165,11 @@ # endif #endif -// A macro to disallow the copy constructor and operator= functions -// This should be used in the private: declarations for a class -#ifndef FMT_USE_DELETED_FUNCTIONS -# define FMT_USE_DELETED_FUNCTIONS 0 -#endif - -#if FMT_USE_DELETED_FUNCTIONS || FMT_HAS_FEATURE(cxx_deleted_functions) || \ - FMT_GCC_VERSION >= 404 || FMT_MSC_VER >= 1800 -# define FMT_DELETED_OR_UNDEFINED = delete -# define FMT_DISALLOW_COPY_AND_ASSIGN(TypeName) \ +// A macro to disallow the copy construction and assignment. +#define FMT_DISALLOW_COPY_AND_ASSIGN(TypeName) \ TypeName(const TypeName&) = delete; \ TypeName& operator=(const TypeName&) = delete -#else -# define FMT_DELETED_OR_UNDEFINED -# define FMT_DISALLOW_COPY_AND_ASSIGN(TypeName) \ - TypeName(const TypeName&); \ - TypeName& operator=(const TypeName&) -#endif +#define FMT_DELETED_OR_UNDEFINED = delete #ifndef FMT_USE_USER_DEFINED_LITERALS // All compilers which support UDLs also support variadic templates. This @@ -1447,27 +1434,12 @@ basic_arg make_arg(const T &value) { return arg; } -#define FMT_CONCAT(a, b) a##b - #if FMT_GCC_VERSION >= 407 # define FMT_UNUSED __attribute__((unused)) #else # define FMT_UNUSED #endif -#ifndef FMT_USE_STATIC_ASSERT -# define FMT_USE_STATIC_ASSERT 0 -#endif - -#if FMT_USE_STATIC_ASSERT || FMT_HAS_FEATURE(cxx_static_assert) || \ - FMT_GCC_VERSION >= 403 || _MSC_VER >= 1600 -# define FMT_STATIC_ASSERT(cond, message) static_assert(cond, message) -#else -# define FMT_CONCAT_(a, b) FMT_CONCAT(a, b) -# define FMT_STATIC_ASSERT(cond, message) \ - typedef int FMT_CONCAT_(Assert, __LINE__)[(cond) ? 1 : -1] FMT_UNUSED -#endif - template struct named_arg : basic_arg { typedef typename Context::char_type Char; diff --git a/fmt/posix.cc b/fmt/posix.cc index 59e92539..1d473d22 100644 --- a/fmt/posix.cc +++ b/fmt/posix.cc @@ -144,7 +144,7 @@ long long fmt::File::size() const { Stat file_stat = Stat(); if (FMT_POSIX_CALL(fstat(fd_, &file_stat)) == -1) throw system_error(errno, "cannot get file attributes"); - FMT_STATIC_ASSERT(sizeof(long long) >= sizeof(file_stat.st_size), + static_assert(sizeof(long long) >= sizeof(file_stat.st_size), "return type of File::size is not large enough"); return file_stat.st_size; #endif diff --git a/test/posix-mock-test.cc b/test/posix-mock-test.cc index ece17e8d..c132e1e7 100644 --- a/test/posix-mock-test.cc +++ b/test/posix-mock-test.cc @@ -218,12 +218,6 @@ void write_file(fmt::cstring_view filename, fmt::string_view content) { f.print("{}", content); } -TEST(UtilTest, StaticAssert) { - FMT_STATIC_ASSERT(true, "success"); - // Static assertion failure is tested in compile-test because it causes - // a compile-time error. -} - TEST(UtilTest, GetPageSize) { #ifdef _WIN32 SYSTEM_INFO si = {};