mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 18:57:34 +02:00
Rename None to Null because of conflict with an xlib.h macro
This commit is contained in:
12
format.cc
12
format.cc
@ -95,11 +95,11 @@ using fmt::internal::Arg;
|
|||||||
|
|
||||||
// Dummy implementations of strerror_r and strerror_s called if corresponding
|
// Dummy implementations of strerror_r and strerror_s called if corresponding
|
||||||
// system functions are not available.
|
// system functions are not available.
|
||||||
static inline fmt::internal::None<> strerror_r(int, char *, ...) {
|
static inline fmt::internal::Null<> strerror_r(int, char *, ...) {
|
||||||
return fmt::internal::None<>();
|
return fmt::internal::Null<>();
|
||||||
}
|
}
|
||||||
static inline fmt::internal::None<> strerror_s(char *, std::size_t, ...) {
|
static inline fmt::internal::Null<> strerror_s(char *, std::size_t, ...) {
|
||||||
return fmt::internal::None<>();
|
return fmt::internal::Null<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace fmt {
|
namespace fmt {
|
||||||
@ -185,7 +185,7 @@ int safe_strerror(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle the case when strerror_r is not available.
|
// Handle the case when strerror_r is not available.
|
||||||
int handle(fmt::internal::None<>) {
|
int handle(fmt::internal::Null<>) {
|
||||||
return fallback(strerror_s(buffer_, buffer_size_, error_code_));
|
return fallback(strerror_s(buffer_, buffer_size_, error_code_));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ int safe_strerror(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fallback to strerror if strerror_r and strerror_s are not available.
|
// Fallback to strerror if strerror_r and strerror_s are not available.
|
||||||
int fallback(fmt::internal::None<>) {
|
int fallback(fmt::internal::Null<>) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
buffer_ = strerror(error_code_);
|
buffer_ = strerror(error_code_);
|
||||||
return errno;
|
return errno;
|
||||||
|
6
format.h
6
format.h
@ -833,20 +833,20 @@ template <typename Char>
|
|||||||
struct NamedArg;
|
struct NamedArg;
|
||||||
|
|
||||||
template <typename T = void>
|
template <typename T = void>
|
||||||
struct None {};
|
struct Null {};
|
||||||
|
|
||||||
// A helper class template to enable or disable overloads taking wide
|
// A helper class template to enable or disable overloads taking wide
|
||||||
// characters and strings in MakeValue.
|
// characters and strings in MakeValue.
|
||||||
template <typename T, typename Char>
|
template <typename T, typename Char>
|
||||||
struct WCharHelper {
|
struct WCharHelper {
|
||||||
typedef None<T> Supported;
|
typedef Null<T> Supported;
|
||||||
typedef T Unsupported;
|
typedef T Unsupported;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct WCharHelper<T, wchar_t> {
|
struct WCharHelper<T, wchar_t> {
|
||||||
typedef T Supported;
|
typedef T Supported;
|
||||||
typedef None<T> Unsupported;
|
typedef Null<T> Unsupported;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -42,6 +42,9 @@
|
|||||||
|
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
|
|
||||||
|
// Test that the library compiles if None is defined to 0 as done by xlib.h.
|
||||||
|
#define None 0
|
||||||
|
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "mock-allocator.h"
|
#include "mock-allocator.h"
|
||||||
|
Reference in New Issue
Block a user