mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-24 21:16:56 +00:00
Get rid of old compat macros
This commit is contained in:
parent
be887d9269
commit
fced79b0ee
34
fmt/format.h
34
fmt/format.h
@ -165,24 +165,11 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// A macro to disallow the copy constructor and operator= functions
|
// A macro to disallow the copy construction and assignment.
|
||||||
// This should be used in the private: declarations for a class
|
#define FMT_DISALLOW_COPY_AND_ASSIGN(TypeName) \
|
||||||
#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) \
|
|
||||||
TypeName(const TypeName&) = delete; \
|
TypeName(const TypeName&) = delete; \
|
||||||
TypeName& operator=(const TypeName&) = delete
|
TypeName& operator=(const TypeName&) = delete
|
||||||
#else
|
#define FMT_DELETED_OR_UNDEFINED = delete
|
||||||
# define FMT_DELETED_OR_UNDEFINED
|
|
||||||
# define FMT_DISALLOW_COPY_AND_ASSIGN(TypeName) \
|
|
||||||
TypeName(const TypeName&); \
|
|
||||||
TypeName& operator=(const TypeName&)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef FMT_USE_USER_DEFINED_LITERALS
|
#ifndef FMT_USE_USER_DEFINED_LITERALS
|
||||||
// All compilers which support UDLs also support variadic templates. This
|
// All compilers which support UDLs also support variadic templates. This
|
||||||
@ -1447,27 +1434,12 @@ basic_arg<Context> make_arg(const T &value) {
|
|||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FMT_CONCAT(a, b) a##b
|
|
||||||
|
|
||||||
#if FMT_GCC_VERSION >= 407
|
#if FMT_GCC_VERSION >= 407
|
||||||
# define FMT_UNUSED __attribute__((unused))
|
# define FMT_UNUSED __attribute__((unused))
|
||||||
#else
|
#else
|
||||||
# define FMT_UNUSED
|
# define FMT_UNUSED
|
||||||
#endif
|
#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 <typename Context>
|
template <typename Context>
|
||||||
struct named_arg : basic_arg<Context> {
|
struct named_arg : basic_arg<Context> {
|
||||||
typedef typename Context::char_type Char;
|
typedef typename Context::char_type Char;
|
||||||
|
@ -144,7 +144,7 @@ long long fmt::File::size() const {
|
|||||||
Stat file_stat = Stat();
|
Stat file_stat = Stat();
|
||||||
if (FMT_POSIX_CALL(fstat(fd_, &file_stat)) == -1)
|
if (FMT_POSIX_CALL(fstat(fd_, &file_stat)) == -1)
|
||||||
throw system_error(errno, "cannot get file attributes");
|
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 type of File::size is not large enough");
|
||||||
return file_stat.st_size;
|
return file_stat.st_size;
|
||||||
#endif
|
#endif
|
||||||
|
@ -218,12 +218,6 @@ void write_file(fmt::cstring_view filename, fmt::string_view content) {
|
|||||||
f.print("{}", 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) {
|
TEST(UtilTest, GetPageSize) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
SYSTEM_INFO si = {};
|
SYSTEM_INFO si = {};
|
||||||
|
Loading…
Reference in New Issue
Block a user