Compare commits

...

14 Commits

Author SHA1 Message Date
8f5e07656e Remove an old mingw workaround (#2059) (#3975)
Backports fix from master branch as the code no longer compiles
on mingw64/gcc 14.1.0 without gnu extensions enabled.
2024-05-25 07:49:24 -07:00
3e8d2c57f3 Add CE6 support (#1749) 2020-07-07 09:29:16 -07:00
8ad1c12fb4 Make FMT_CTOR and FMT_WRAP1 macros work with bcc32 2019-03-31 07:21:28 -07:00
d2744bc848 Fix compatibility with bcc32 compiler
Resolve namespace issues
Add workaround for compile error on bool template argument of ArgArray struct
Squelch bcc32 warning on accessing the digits array
Squelch bcc32 warning on unused values
Fix warnings about redefinig macros and conditions always true
Disable "LConv" block for bcc32 compiler
Remove macro test for deprecated macro
Fix appveyor-build for cmake v3.13+
2019-03-27 10:10:18 -07:00
b6d435b9a6 Fix an MSVC warning (#798) 2018-07-04 05:42:59 -07:00
857b382fc3 Mark the whole class FormatError as FMT_API
Else on windows across DLLs the vtable is not visible which causes linking error
2018-05-09 06:12:31 -07:00
b6ac63faf0 Fix warnings when with master project set to hidden 2018-04-27 06:34:52 -07:00
1d6188404c Added optional INILINE_BUFFER_SIZE template param to BasicMemoryWriter (#716) 2018-04-21 17:18:13 -07:00
bdab94baf8 Merge branch '4.x' of github.com:fmtlib/fmt into 4.x 2018-04-12 06:07:55 -07:00
a9c0bb4b16 Fix a warning on msvc/clang (#703) 2018-04-12 06:07:16 -07:00
ea2cf449f7 Stop newer CMake's from warning about OLD policy 2018-04-11 09:48:36 -07:00
5c0d7ee157 Fix return that can't be reached 2018-04-11 09:31:10 -07:00
64440783ba Fix an issue with incorrect [[noreturn]] position in clang-cl (#701) 2018-04-08 11:56:47 -07:00
1ecdc1a3bb Fix compilation on gcc 4.4 (#692) 2018-03-23 08:39:24 -07:00
8 changed files with 130 additions and 66 deletions

View File

@ -3,11 +3,11 @@ message(STATUS "CMake version: ${CMAKE_VERSION}")
cmake_minimum_required(VERSION 2.8.12)
if (POLICY CMP0048) # Version variables
cmake_policy(SET CMP0048 OLD)
cmake_policy(SET CMP0048 NEW)
endif ()
if (POLICY CMP0063) # Visibility
cmake_policy(SET CMP0063 OLD)
cmake_policy(SET CMP0063 NEW)
endif (POLICY CMP0063)
# Determine if fmt is built as a subproject (using add_subdirectory)

View File

@ -30,7 +30,9 @@
#include <string.h>
#include <cctype>
#include <cerrno>
#if !defined(UNDER_CE)
# include <cerrno>
#endif
#include <climits>
#include <cmath>
#include <cstdarg>
@ -83,7 +85,10 @@ static inline fmt::internal::Null<> strerror_s(char *, std::size_t, ...) {
namespace fmt {
FMT_FUNC internal::RuntimeError::~RuntimeError() FMT_DTOR_NOEXCEPT {}
namespace internal {
FMT_FUNC RuntimeError::~RuntimeError() FMT_DTOR_NOEXCEPT {}
} // namespace internal
FMT_FUNC FormatError::~FormatError() FMT_DTOR_NOEXCEPT {}
FMT_FUNC SystemError::~SystemError() FMT_DTOR_NOEXCEPT {}
@ -95,7 +100,11 @@ namespace {
inline int fmt_snprintf(char *buffer, size_t size, const char *format, ...) {
va_list args;
va_start(args, format);
# if !defined(UNDER_CE)
int result = vsnprintf_s(buffer, size, _TRUNCATE, format, args);
# else
int result = _vsnprintf_s(buffer, size, _TRUNCATE, format, args);
# endif
va_end(args);
return result;
}
@ -105,7 +114,11 @@ inline int fmt_snprintf(char *buffer, size_t size, const char *format, ...) {
#if defined(_WIN32) && defined(__MINGW32__) && !defined(__NO_ISOCEXT)
# define FMT_SWPRINTF snwprintf
#else
# define FMT_SWPRINTF swprintf
# if defined(UNDER_CE)
# define FMT_SWPRINTF swprintf_s
# else
# define FMT_SWPRINTF swprintf
#endif
#endif // defined(_WIN32) && defined(__MINGW32__) && !defined(__NO_ISOCEXT)
const char RESET_COLOR[] = "\x1b[0m";
@ -134,11 +147,13 @@ int safe_strerror(
// A noop assignment operator to avoid bogus warnings.
void operator=(const StrError &) {}
#if !defined(UNDER_CE)
// Handle the result of XSI-compliant version of strerror_r.
int handle(int result) {
// glibc versions before 2.13 return result in errno.
return result == -1 ? errno : result;
}
#endif
// Handle the result of GNU-specific version of strerror_r.
int handle(char *message) {
@ -161,19 +176,23 @@ int safe_strerror(
ERANGE : result;
}
#ifdef __c2__
#ifdef __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
// Fallback to strerror if strerror_r and strerror_s are not available.
int fallback(internal::Null<>) {
#if !defined(UNDER_CE)
errno = 0;
buffer_ = strerror(error_code_);
return errno;
#else
return 0;
#endif
}
#ifdef __c2__
#ifdef __clang__
# pragma clang diagnostic pop
#endif
@ -231,8 +250,9 @@ FMT_FUNC void SystemError::init(
base = std::runtime_error(w.str());
}
namespace internal {
template <typename T>
int internal::CharTraits<char>::format_float(
int CharTraits<char>::format_float(
char *buffer, std::size_t size, const char *format,
unsigned width, int precision, T value) {
if (width == 0) {
@ -246,7 +266,7 @@ int internal::CharTraits<char>::format_float(
}
template <typename T>
int internal::CharTraits<wchar_t>::format_float(
int CharTraits<wchar_t>::format_float(
wchar_t *buffer, std::size_t size, const wchar_t *format,
unsigned width, int precision, T value) {
if (width == 0) {
@ -260,7 +280,7 @@ int internal::CharTraits<wchar_t>::format_float(
}
template <typename T>
const char internal::BasicData<T>::DIGITS[] =
const char BasicData<T>::DIGITS[] =
"0001020304050607080910111213141516171819"
"2021222324252627282930313233343536373839"
"4041424344454647484950515253545556575859"
@ -279,12 +299,12 @@ const char internal::BasicData<T>::DIGITS[] =
factor * 1000000000
template <typename T>
const uint32_t internal::BasicData<T>::POWERS_OF_10_32[] = {
const uint32_t BasicData<T>::POWERS_OF_10_32[] = {
0, FMT_POWERS_OF_10(1)
};
template <typename T>
const uint64_t internal::BasicData<T>::POWERS_OF_10_64[] = {
const uint64_t BasicData<T>::POWERS_OF_10_64[] = {
0,
FMT_POWERS_OF_10(1),
FMT_POWERS_OF_10(ULongLong(1000000000)),
@ -293,7 +313,7 @@ const uint64_t internal::BasicData<T>::POWERS_OF_10_64[] = {
ULongLong(1000000000) * ULongLong(1000000000) * 10
};
FMT_FUNC void internal::report_unknown_type(char code, const char *type) {
FMT_FUNC void report_unknown_type(char code, const char *type) {
(void)type;
if (std::isprint(static_cast<unsigned char>(code))) {
FMT_THROW(FormatError(
@ -306,7 +326,7 @@ FMT_FUNC void internal::report_unknown_type(char code, const char *type) {
#if FMT_USE_WINDOWS_H
FMT_FUNC internal::UTF8ToUTF16::UTF8ToUTF16(StringRef s) {
FMT_FUNC UTF8ToUTF16::UTF8ToUTF16(StringRef s) {
static const char ERROR_MSG[] = "cannot convert string from UTF-8 to UTF-16";
if (s.size() > INT_MAX)
FMT_THROW(WindowsError(ERROR_INVALID_PARAMETER, ERROR_MSG));
@ -323,14 +343,14 @@ FMT_FUNC internal::UTF8ToUTF16::UTF8ToUTF16(StringRef s) {
buffer_[length] = 0;
}
FMT_FUNC internal::UTF16ToUTF8::UTF16ToUTF8(WStringRef s) {
FMT_FUNC UTF16ToUTF8::UTF16ToUTF8(WStringRef s) {
if (int error_code = convert(s)) {
FMT_THROW(WindowsError(error_code,
"cannot convert string from UTF-16 to UTF-8"));
}
}
FMT_FUNC int internal::UTF16ToUTF8::convert(WStringRef s) {
FMT_FUNC int UTF16ToUTF8::convert(WStringRef s) {
if (s.size() > INT_MAX)
return ERROR_INVALID_PARAMETER;
int s_size = static_cast<int>(s.size());
@ -346,6 +366,7 @@ FMT_FUNC int internal::UTF16ToUTF8::convert(WStringRef s) {
buffer_[length] = 0;
return 0;
}
} // namespace internal
FMT_FUNC void WindowsError::init(
int err_code, CStringRef format_str, ArgList args) {
@ -356,7 +377,8 @@ FMT_FUNC void WindowsError::init(
base = std::runtime_error(w.str());
}
FMT_FUNC void internal::format_windows_error(
namespace internal {
FMT_FUNC void format_windows_error(
Writer &out, int error_code, StringRef message) FMT_NOEXCEPT {
FMT_TRY {
MemoryBuffer<wchar_t, INLINE_BUFFER_SIZE> buffer;
@ -384,7 +406,7 @@ FMT_FUNC void internal::format_windows_error(
}
#endif // FMT_USE_WINDOWS_H
} // namespace internal
FMT_FUNC void format_system_error(
Writer &out, int error_code, StringRef message) FMT_NOEXCEPT {
FMT_TRY {
@ -404,38 +426,37 @@ FMT_FUNC void format_system_error(
} FMT_CATCH(...) {}
fmt::format_error_code(out, error_code, message); // 'fmt::' is for bcc32.
}
} // namespace fmt
template <typename Char>
void internal::FixedBuffer<Char>::grow(std::size_t) {
void fmt::internal::FixedBuffer<Char>::grow(std::size_t) {
FMT_THROW(std::runtime_error("buffer overflow"));
}
FMT_FUNC internal::Arg internal::FormatterBase::do_get_arg(
FMT_FUNC fmt::internal::Arg fmt::internal::FormatterBase::do_get_arg(
unsigned arg_index, const char *&error) {
internal::Arg arg = args_[arg_index];
fmt::internal::Arg arg = args_[arg_index];
switch (arg.type) {
case internal::Arg::NONE:
case fmt::internal::Arg::NONE:
error = "argument index out of range";
break;
case internal::Arg::NAMED_ARG:
arg = *static_cast<const internal::Arg*>(arg.pointer);
case fmt::internal::Arg::NAMED_ARG:
arg = *static_cast<const fmt::internal::Arg*>(arg.pointer);
break;
default:
/*nothing*/;
}
return arg;
}
namespace fmt {
FMT_FUNC void report_system_error(
int error_code, fmt::StringRef message) FMT_NOEXCEPT {
// 'fmt::' is for bcc32.
int error_code, StringRef message) FMT_NOEXCEPT {
report_error(format_system_error, error_code, message);
}
#if FMT_USE_WINDOWS_H
FMT_FUNC void report_windows_error(
int error_code, fmt::StringRef message) FMT_NOEXCEPT {
// 'fmt::' is for bcc32.
int error_code, StringRef message) FMT_NOEXCEPT {
report_error(internal::format_windows_error, error_code, message);
}
#endif
@ -463,28 +484,29 @@ FMT_FUNC void print_colored(Color c, CStringRef format, ArgList args) {
template struct internal::BasicData<void>;
// Explicit instantiations for char.
namespace internal {
template void FixedBuffer<char>::grow(std::size_t);
template void internal::FixedBuffer<char>::grow(std::size_t);
template FMT_API int internal::CharTraits<char>::format_float(
template FMT_API int CharTraits<char>::format_float(
char *buffer, std::size_t size, const char *format,
unsigned width, int precision, double value);
template FMT_API int internal::CharTraits<char>::format_float(
template FMT_API int CharTraits<char>::format_float(
char *buffer, std::size_t size, const char *format,
unsigned width, int precision, long double value);
// Explicit instantiations for wchar_t.
template void internal::FixedBuffer<wchar_t>::grow(std::size_t);
template void FixedBuffer<wchar_t>::grow(std::size_t);
template FMT_API int internal::CharTraits<wchar_t>::format_float(
template FMT_API int CharTraits<wchar_t>::format_float(
wchar_t *buffer, std::size_t size, const wchar_t *format,
unsigned width, int precision, double value);
template FMT_API int internal::CharTraits<wchar_t>::format_float(
template FMT_API int CharTraits<wchar_t>::format_float(
wchar_t *buffer, std::size_t size, const wchar_t *format,
unsigned width, int precision, long double value);
} //namespace internal
#endif // FMT_HEADER_ONLY

View File

@ -130,6 +130,11 @@ typedef __int64 intmax_t;
# define FMT_HAS_GXX_CXX11 0
#endif
#ifdef __BORLANDC__
#pragma warn -8072 // disable "suspicious pointer arithmetic" warning on access of the digits array
#pragma warn -8004 // disable "assigned value that is never used" warning
#endif
#if defined(__INTEL_COMPILER)
# define FMT_ICC_VERSION __INTEL_COMPILER
#elif defined(__ICL)
@ -365,7 +370,7 @@ typedef __int64 intmax_t;
// otherwise support __builtin_clz and __builtin_clzll, so
// only define FMT_BUILTIN_CLZ using the MSVC intrinsics
// if the clz and clzll builtins are not available.
#if FMT_MSC_VER && !defined(FMT_BUILTIN_CLZLL) && !defined(_MANAGED)
#if FMT_MSC_VER && !defined(FMT_BUILTIN_CLZLL) && !defined(_MANAGED) && !defined(UNDER_CE)
# include <intrin.h> // _BitScanReverse, _BitScanReverse64
namespace fmt {
@ -710,12 +715,12 @@ typedef BasicCStringRef<char> CStringRef;
typedef BasicCStringRef<wchar_t> WCStringRef;
/** A formatting error such as invalid format string. */
class FormatError : public std::runtime_error {
class FMT_API FormatError : public std::runtime_error {
public:
explicit FormatError(CStringRef message)
: std::runtime_error(message.c_str()) {}
FormatError(const FormatError &ferr) : std::runtime_error(ferr) {}
FMT_API ~FormatError() FMT_DTOR_NOEXCEPT FMT_OVERRIDE;
~FormatError() FMT_DTOR_NOEXCEPT FMT_OVERRIDE;
};
namespace internal {
@ -1027,7 +1032,7 @@ struct IntTraits {
TypeSelector<std::numeric_limits<T>::digits <= 32>::Type MainType;
};
FMT_API FMT_NORETURN void report_unknown_type(char code, const char *type);
FMT_NORETURN FMT_API void report_unknown_type(char code, const char *type);
// Static data is placed in this class template to allow header-only
// configuration.
@ -1287,6 +1292,7 @@ struct ConvertToIntImpl2<T, true> {
template <typename T>
struct ConvertToInt {
enum {
#pragma warning(suppress: 4244)
enable_conversion = sizeof(fmt::internal::convert(get<T>())) == sizeof(Yes)
};
enum { value = ConvertToIntImpl2<T, enable_conversion>::value };
@ -1327,6 +1333,7 @@ template <typename T, T> struct LConvCheck {
LConvCheck(int) {}
};
#ifndef __BORLANDC__
// Returns the thousands separator for the current locale.
// We check if ``lconv`` contains ``thousands_sep`` because on Android
// ``lconv`` is stubbed as an empty struct.
@ -1335,6 +1342,7 @@ inline StringRef thousands_sep(
LConv *lc, LConvCheck<char *LConv::*, &LConv::thousands_sep> = 0) {
return lc->thousands_sep;
}
#endif
inline fmt::StringRef thousands_sep(...) { return ""; }
@ -2099,7 +2107,6 @@ void ArgMap<Char>::init(const ArgList &args) {
/*nothing*/;
}
}
return;
}
for (unsigned i = 0; i != ArgList::MAX_PACKED_ARGS; ++i) {
internal::Arg::Type arg_type = args.type(i);
@ -2138,6 +2145,8 @@ class ArgFormatterBase : public ArgVisitor<Impl, void> {
// workaround MSVC two-phase lookup issue
typedef internal::Arg Arg;
typedef Char CharType;
typedef BasicWriter<Char> WriterType;
protected:
BasicWriter<Char> &writer() { return writer_; }
@ -2182,8 +2191,8 @@ class ArgFormatterBase : public ArgVisitor<Impl, void> {
}
if (spec_.align_ == ALIGN_NUMERIC || spec_.flags_ != 0)
FMT_THROW(FormatError("invalid format specifier for char"));
typedef typename BasicWriter<Char>::CharPtr CharPtr;
Char fill = internal::CharTraits<Char>::cast(spec_.fill());
typedef typename WriterType::CharPtr CharPtr;
CharType fill = internal::CharTraits<CharType>::cast(spec_.fill());
CharPtr out = CharPtr();
const unsigned CHAR_SIZE = 1;
if (spec_.width_ > CHAR_SIZE) {
@ -2201,7 +2210,7 @@ class ArgFormatterBase : public ArgVisitor<Impl, void> {
} else {
out = writer_.grow_buffer(CHAR_SIZE);
}
*out = internal::CharTraits<Char>::cast(value);
*out = internal::CharTraits<CharType>::cast(value);
}
void visit_cstring(const char *value) {
@ -2403,6 +2412,7 @@ inline uint64_t make_type(const T &arg) {
return MakeValue< BasicFormatter<char> >::type(arg);
}
#ifndef __BORLANDC__
template <std::size_t N, bool/*IsPacked*/= (N < ArgList::MAX_PACKED_ARGS)>
struct ArgArray;
@ -2432,6 +2442,25 @@ struct ArgArray<N, false/*IsPacked*/> {
template <typename Formatter, typename T>
static Arg make(const T &value) { return MakeArg<Formatter>(value); }
};
#else
template <std::size_t N>
struct ArgArray {
typedef Value Type[N > 0 ? N : 1];
template <typename Formatter, typename T>
static Value make(const T & value) {
#ifdef __clang__
Value result = MakeValue<Formatter>(value);
// Workaround a bug in Apple LLVM version 4.2 (clang-425.0.28) of clang:
// https://github.com/fmtlib/fmt/issues/276
(void)result.custom.format;
return result;
#else
return MakeValue<Formatter>(value);
#endif
}
};
#endif
#if FMT_USE_VARIADIC_TEMPLATES
template <typename Arg, typename... Args>
@ -2468,6 +2497,8 @@ inline uint64_t make_type(FMT_GEN15(FMT_ARG_TYPE_DEFAULT)) {
arr[n] = fmt::internal::MakeValue< fmt::BasicFormatter<char> >(v##n)
# define FMT_ASSIGN_wchar_t(n) \
arr[n] = fmt::internal::MakeValue< fmt::BasicFormatter<wchar_t> >(v##n)
# define FMT_ASSIGN_Char(n) \
arr[n] = fmt::internal::MakeValue< fmt::BasicFormatter<Char> >(v##n)
#if FMT_USE_VARIADIC_TEMPLATES
// Defines a variadic function returning void.
@ -2501,9 +2532,10 @@ inline uint64_t make_type(FMT_GEN15(FMT_ARG_TYPE_DEFAULT)) {
# define FMT_WRAP1(func, arg_type, n) \
template <FMT_GEN(n, FMT_MAKE_TEMPLATE_ARG)> \
inline void func(arg_type arg1, FMT_GEN(n, FMT_MAKE_ARG)) { \
const fmt::internal::ArgArray<n>::Type array = {FMT_GEN(n, FMT_MAKE_REF)}; \
fmt::internal::ArgArray<n>::Type arr; \
FMT_GEN(n, FMT_ASSIGN_Char) ; \
func(arg1, fmt::ArgList( \
fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), array)); \
fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), arr)); \
}
// Emulates a variadic function returning void on a pre-C++11 compiler.
@ -2518,9 +2550,10 @@ inline uint64_t make_type(FMT_GEN15(FMT_ARG_TYPE_DEFAULT)) {
# define FMT_CTOR(ctor, func, arg0_type, arg1_type, n) \
template <FMT_GEN(n, FMT_MAKE_TEMPLATE_ARG)> \
ctor(arg0_type arg0, arg1_type arg1, FMT_GEN(n, FMT_MAKE_ARG)) { \
const fmt::internal::ArgArray<n>::Type array = {FMT_GEN(n, FMT_MAKE_REF)}; \
fmt::internal::ArgArray<n>::Type arr; \
FMT_GEN(n, FMT_ASSIGN_Char) ; \
func(arg0, arg1, fmt::ArgList( \
fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), array)); \
fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), arr)); \
}
// Emulates a variadic constructor on a pre-C++11 compiler.
@ -3116,7 +3149,7 @@ void BasicWriter<Char>::write_int(T value, Spec spec) {
case 'n': {
unsigned num_digits = internal::count_digits(abs_value);
fmt::StringRef sep = "";
#ifndef __ANDROID__
#if !defined(__ANDROID__) && !defined(UNDER_CE)
sep = internal::thousands_sep(std::localeconv());
#endif
unsigned size = static_cast<unsigned>(
@ -3321,10 +3354,10 @@ void BasicWriter<Char>::write_double(T value, const Spec &spec) {
accessed as a C string with ``out.c_str()``.
\endrst
*/
template <typename Char, typename Allocator = std::allocator<Char> >
template <typename Char, typename Allocator = std::allocator<Char>, std::size_t INLINE_BUFFER_SIZE = internal::INLINE_BUFFER_SIZE>
class BasicMemoryWriter : public BasicWriter<Char> {
private:
internal::MemoryBuffer<Char, internal::INLINE_BUFFER_SIZE, Allocator> buffer_;
internal::MemoryBuffer<Char, INLINE_BUFFER_SIZE, Allocator> buffer_;
public:
explicit BasicMemoryWriter(const Allocator& alloc = Allocator())
@ -4090,7 +4123,8 @@ ArgJoin<wchar_t, It> join(It first, It last, const BasicCStringRef<wchar_t>& sep
return ArgJoin<wchar_t, It>(first, last, sep);
}
#if FMT_HAS_GXX_CXX11
#if FMT_HAS_GXX_CXX11 && \
(!FMT_GCC_VERSION || FMT_GCC_VERSION >= 405 || __clang__)
template <typename Range>
auto join(const Range& range, const BasicCStringRef<char>& sep)
-> ArgJoin<char, decltype(std::begin(range))> {
@ -4212,4 +4246,9 @@ operator"" _a(const wchar_t *s, std::size_t) { return {s}; }
# define FMT_FUNC
#endif
#ifdef __BORLANDC__
#pragma warn .8072 // restore "suspicious pointer arithmetic" warning on access of the digits array
#pragma warn .8004 // restore "assigned value that is never used" warning
#endif
#endif // FMT_FORMAT_H_

View File

@ -64,6 +64,7 @@ template <typename T>
struct ConvertToIntImpl<T, true> {
// Convert to int only if T doesn't have an overloaded operator<<.
enum {
#pragma warning(suppress: 4244)
value = sizeof(convert(get<DummyStream>() << get<T>())) == sizeof(No)
};
};

View File

@ -26,10 +26,13 @@
# endif
# include <windows.h>
# include <io.h>
# define O_CREAT _O_CREAT
# define O_TRUNC _O_TRUNC
#include <algorithm>
# ifndef O_CREAT
# define O_CREAT _O_CREAT
# endif
# ifndef O_TRUNC
# define O_TRUNC _O_TRUNC
# endif
# ifndef S_IRUSR
# define S_IRUSR _S_IREAD
# endif
@ -56,7 +59,7 @@ typedef int RWResult;
// On Windows the count argument to read and write is unsigned, so convert
// it from size_t preventing integer overflow.
inline unsigned convert_rwcount(std::size_t count) {
return count <= UINT_MAX ? static_cast<unsigned>(count) : UINT_MAX;
return static_cast<unsigned>(std::min<std::size_t>(count, UINT_MAX));
}
#else
// Return type of read and write functions.
@ -99,7 +102,7 @@ int fmt::BufferedFile::fileno() const {
fmt::File::File(fmt::CStringRef path, int oflag) {
int mode = S_IRUSR | S_IWUSR;
#if defined(_WIN32) && !defined(__MINGW32__)
#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__BORLANDC__)
fd_ = -1;
FMT_POSIX_CALL(sopen_s(&fd_, path.c_str(), oflag, _SH_DENYNO, mode));
#else

View File

@ -10,11 +10,6 @@
#ifndef FMT_POSIX_H_
#define FMT_POSIX_H_
#if defined(__MINGW32__) || defined(__CYGWIN__)
// Workaround MinGW bug https://sourceforge.net/p/mingw/bugs/2024/.
# undef __STRICT_ANSI__
#endif
#include <errno.h>
#include <fcntl.h> // for O_RDONLY
#include <locale.h> // for locale_t
@ -46,6 +41,10 @@
# ifdef _WIN32
// Fix warnings about deprecated symbols.
# define FMT_POSIX_CALL(call) ::_##call
# if defined(__BORLANDC__) && !defined(_dup2)
// for some reason the borland headers do define _dup but not _dup2
# define _dup2 dup2
# endif
# else
# define FMT_POSIX_CALL(call) ::call
# endif

View File

@ -333,7 +333,7 @@ class PrintfFormatter : private internal::FormatterBase {
\endrst
*/
explicit PrintfFormatter(const ArgList &al, BasicWriter<Char> &w)
: FormatterBase(al), writer_(w) {}
: internal::FormatterBase(al), writer_(w) {}
/** Formats stored arguments and writes the output to the writer. */
void format(BasicCStringRef<Char> format_str);
@ -371,7 +371,7 @@ internal::Arg PrintfFormatter<Char, AF>::get_arg(const Char *s,
(void)s;
const char *error = FMT_NULL;
internal::Arg arg = arg_index == std::numeric_limits<unsigned>::max() ?
next_arg(error) : FormatterBase::get_arg(arg_index - 1, error);
next_arg(error) : internal::FormatterBase::get_arg(arg_index - 1, error);
if (error)
FMT_THROW(FormatError(!*s ? "invalid format string" : error));
return arg;

View File

@ -8,7 +8,7 @@ build = os.environ['BUILD']
config = os.environ['CONFIGURATION']
platform = os.environ.get('PLATFORM')
path = os.environ['PATH']
cmake_command = ['cmake', '-DFMT_PEDANTIC=ON', '-DCMAKE_BUILD_TYPE=' + config]
cmake_command = ['cmake', '-DFMT_PEDANTIC=ON', '-DCMAKE_BUILD_TYPE=' + config, '.']
if build == 'mingw':
cmake_command.append('-GMinGW Makefiles')
build_command = ['mingw32-make', '-j4']