forked from mirrors/0ad
cppformat: Fix -Wundef build warnings from GCC.
This was SVN commit r16177.
This commit is contained in:
+10
-5
@@ -1,3 +1,8 @@
|
||||
/*
|
||||
* Slightly modified version of cppformat, by Wildfire Games, for 0 A.D.
|
||||
* Based on cppformat v0.11.0 from https://github.com/cppformat/cppformat
|
||||
*/
|
||||
|
||||
/*
|
||||
Formatting library for C++
|
||||
|
||||
@@ -54,7 +59,7 @@ using fmt::LongLong;
|
||||
using fmt::ULongLong;
|
||||
using fmt::internal::Arg;
|
||||
|
||||
#if _MSC_VER
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4127) // conditional expression is constant
|
||||
#endif
|
||||
@@ -430,12 +435,12 @@ int fmt::internal::safe_strerror(
|
||||
if (message == buffer && strlen(buffer) == buffer_size - 1)
|
||||
result = ERANGE;
|
||||
buffer = message;
|
||||
#elif __MINGW32__
|
||||
#elif defined(__MINGW32__)
|
||||
errno = 0;
|
||||
(void)buffer_size;
|
||||
buffer = strerror(error_code);
|
||||
result = errno;
|
||||
#elif _WIN32
|
||||
#elif defined(_WIN32)
|
||||
result = strerror_s(buffer, buffer_size, error_code);
|
||||
// If the buffer is full then the message is probably truncated.
|
||||
if (result == 0 && std::strlen(buffer) == buffer_size - 1)
|
||||
@@ -692,7 +697,7 @@ void fmt::BasicWriter<Char>::write_double(T value, const FormatSpec &spec) {
|
||||
Char fill = static_cast<Char>(spec.fill());
|
||||
for (;;) {
|
||||
std::size_t size = buffer_.capacity() - offset;
|
||||
#if _MSC_VER
|
||||
#ifdef _MSC_VER
|
||||
// MSVC's vsnprintf_s doesn't work with zero size, so reserve
|
||||
// space for at least one extra character to make the size non-zero.
|
||||
// Note that the buffer's capacity will increase by more than 1.
|
||||
@@ -1299,6 +1304,6 @@ template void fmt::internal::PrintfFormatter<wchar_t>::format(
|
||||
BasicWriter<wchar_t> &writer, BasicStringRef<wchar_t> format,
|
||||
const ArgList &args);
|
||||
|
||||
#if _MSC_VER
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
+12
-7
@@ -1,3 +1,8 @@
|
||||
/*
|
||||
* Slightly modified version of cppformat, by Wildfire Games, for 0 A.D.
|
||||
* Based on cppformat v0.11.0 from https://github.com/cppformat/cppformat
|
||||
*/
|
||||
|
||||
/*
|
||||
Formatting library for C++
|
||||
|
||||
@@ -39,7 +44,7 @@
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
#if _SECURE_SCL
|
||||
#if defined(_SECURE_SCL) && _SECURE_SCL
|
||||
# include <iterator>
|
||||
#endif
|
||||
|
||||
@@ -78,7 +83,7 @@
|
||||
// since version 2013.
|
||||
# define FMT_USE_VARIADIC_TEMPLATES \
|
||||
(FMT_HAS_FEATURE(cxx_variadic_templates) || \
|
||||
(FMT_GCC_VERSION >= 404 && __cplusplus >= 201103) || _MSC_VER >= 1800)
|
||||
(FMT_GCC_VERSION >= 404 && __cplusplus >= 201103) || (defined(_MSC_VER) && _MSC_VER >= 1800))
|
||||
#endif
|
||||
|
||||
#ifndef FMT_USE_RVALUE_REFERENCES
|
||||
@@ -89,7 +94,7 @@
|
||||
# else
|
||||
# define FMT_USE_RVALUE_REFERENCES \
|
||||
(FMT_HAS_FEATURE(cxx_rvalue_references) || \
|
||||
(FMT_GCC_VERSION >= 403 && __cplusplus >= 201103) || _MSC_VER >= 1600)
|
||||
(FMT_GCC_VERSION >= 403 && __cplusplus >= 201103) || (defined(_MSC_VER) && _MSC_VER >= 1600))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -98,7 +103,7 @@
|
||||
#endif
|
||||
|
||||
// Define FMT_USE_NOEXCEPT to make C++ Format use noexcept (C++11 feature).
|
||||
#if FMT_USE_NOEXCEPT || FMT_HAS_FEATURE(cxx_noexcept) || \
|
||||
#if (defined(FMT_USE_NOEXCEPT) && FMT_USE_NOEXCEPT) || FMT_HAS_FEATURE(cxx_noexcept) || \
|
||||
(FMT_GCC_VERSION >= 408 && __cplusplus >= 201103)
|
||||
# define FMT_NOEXCEPT(expr) noexcept(expr)
|
||||
#else
|
||||
@@ -225,7 +230,7 @@ namespace internal {
|
||||
// output buffer, itself to avoid dynamic memory allocation.
|
||||
enum { INLINE_BUFFER_SIZE = 500 };
|
||||
|
||||
#if _SECURE_SCL
|
||||
#if defined(_SECURE_SCL) && _SECURE_SCL
|
||||
// Use checked iterator to avoid warnings on MSVC.
|
||||
template <typename T>
|
||||
inline stdext::checked_array_iterator<T*> make_ptr(T *ptr, std::size_t size) {
|
||||
@@ -344,7 +349,7 @@ void Array<T, SIZE>::append(const T *begin, const T *end) {
|
||||
template <typename Char>
|
||||
class BasicCharTraits {
|
||||
public:
|
||||
#if _SECURE_SCL
|
||||
#if defined(_SECURE_SCL) && _SECURE_SCL
|
||||
typedef stdext::checked_array_iterator<Char*> CharPtr;
|
||||
#else
|
||||
typedef Char *CharPtr;
|
||||
@@ -1306,7 +1311,7 @@ class BasicWriter {
|
||||
|
||||
typedef typename internal::CharTraits<Char>::CharPtr CharPtr;
|
||||
|
||||
#if _SECURE_SCL
|
||||
#if defined(_SECURE_SCL) && _SECURE_SCL
|
||||
// Returns pointer value.
|
||||
static Char *get(CharPtr p) { return p.base(); }
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user