Improve compatibility with bcc32
This commit is contained in:
parent
b53994fd0d
commit
e5d599875c
@ -1285,13 +1285,15 @@ void fmt::BasicFormatter<Char>::format(BasicCStringRef<Char> format_str) {
|
|||||||
|
|
||||||
FMT_FUNC void fmt::report_system_error(
|
FMT_FUNC void fmt::report_system_error(
|
||||||
int error_code, fmt::StringRef message) FMT_NOEXCEPT {
|
int error_code, fmt::StringRef message) FMT_NOEXCEPT {
|
||||||
report_error(internal::format_system_error, error_code, message);
|
// 'fmt::' is for bcc32.
|
||||||
|
fmt::report_error(internal::format_system_error, error_code, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FMT_USE_WINDOWS_H
|
#if FMT_USE_WINDOWS_H
|
||||||
FMT_FUNC void fmt::report_windows_error(
|
FMT_FUNC void fmt::report_windows_error(
|
||||||
int error_code, fmt::StringRef message) FMT_NOEXCEPT {
|
int error_code, fmt::StringRef message) FMT_NOEXCEPT {
|
||||||
report_error(internal::format_windows_error, error_code, message);
|
// 'fmt::' is for bcc32.
|
||||||
|
fmt::report_error(internal::format_windows_error, error_code, message);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
24
format.h
24
format.h
@ -927,19 +927,20 @@ struct WCharHelper<T, wchar_t> {
|
|||||||
typedef Null<T> Unsupported;
|
typedef Null<T> Unsupported;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef char Yes[1];
|
||||||
|
typedef char No[2];
|
||||||
|
|
||||||
|
// These are non-members to workaround an overload resolution bug in bcc32.
|
||||||
|
Yes &convert(fmt::ULongLong);
|
||||||
|
No &convert(...);
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class IsConvertibleToInt {
|
class IsConvertibleToInt {
|
||||||
protected:
|
protected:
|
||||||
typedef char yes[1];
|
|
||||||
typedef char no[2];
|
|
||||||
|
|
||||||
static const T &get();
|
static const T &get();
|
||||||
|
|
||||||
static yes &convert(fmt::ULongLong);
|
|
||||||
static no &convert(...);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum { value = (sizeof(convert(get())) == sizeof(yes)) };
|
enum { value = (sizeof(convert(get())) == sizeof(Yes)) };
|
||||||
};
|
};
|
||||||
|
|
||||||
#define FMT_CONVERTIBLE_TO_INT(Type) \
|
#define FMT_CONVERTIBLE_TO_INT(Type) \
|
||||||
@ -1099,7 +1100,7 @@ class MakeValue : public Arg {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
MakeValue(const T &value,
|
MakeValue(const T &value,
|
||||||
typename EnableIf<!IsConvertibleToInt<T>::value, int>::type = 0) {
|
typename EnableIf<IsConvertibleToInt<T>::value == 0, int>::type = 0) {
|
||||||
custom.value = &value;
|
custom.value = &value;
|
||||||
custom.format = &format_custom_arg<T>;
|
custom.format = &format_custom_arg<T>;
|
||||||
}
|
}
|
||||||
@ -1765,8 +1766,8 @@ inline uint64_t make_type(FMT_GEN15(FMT_ARG_TYPE_DEFAULT)) {
|
|||||||
# define FMT_MAKE_TEMPLATE_ARG(n) typename T##n
|
# define FMT_MAKE_TEMPLATE_ARG(n) typename T##n
|
||||||
# define FMT_MAKE_ARG_TYPE(n) T##n
|
# define FMT_MAKE_ARG_TYPE(n) T##n
|
||||||
# define FMT_MAKE_ARG(n) const T##n &v##n
|
# define FMT_MAKE_ARG(n) const T##n &v##n
|
||||||
# define FMT_MAKE_REF_char(n) fmt::internal::MakeValue<char>(v##n)
|
# define FMT_ASSIGN_char(n) arr[n] = fmt::internal::MakeValue<char>(v##n)
|
||||||
# define FMT_MAKE_REF_wchar_t(n) fmt::internal::MakeValue<wchar_t>(v##n)
|
# define FMT_ASSIGN_wchar_t(n) arr[n] = fmt::internal::MakeValue<wchar_t>(v##n)
|
||||||
|
|
||||||
#if FMT_USE_VARIADIC_TEMPLATES
|
#if FMT_USE_VARIADIC_TEMPLATES
|
||||||
// Defines a variadic function returning void.
|
// Defines a variadic function returning void.
|
||||||
@ -2985,7 +2986,8 @@ void arg(WStringRef, const internal::NamedArg<Char>&) FMT_DELETED_OR_UNDEFINED;
|
|||||||
template <FMT_GEN(n, FMT_MAKE_TEMPLATE_ARG)> \
|
template <FMT_GEN(n, FMT_MAKE_TEMPLATE_ARG)> \
|
||||||
inline ReturnType func(FMT_FOR_EACH(FMT_ADD_ARG_NAME, __VA_ARGS__), \
|
inline ReturnType func(FMT_FOR_EACH(FMT_ADD_ARG_NAME, __VA_ARGS__), \
|
||||||
FMT_GEN(n, FMT_MAKE_ARG)) { \
|
FMT_GEN(n, FMT_MAKE_ARG)) { \
|
||||||
fmt::internal::ArgArray<n>::Type arr = {FMT_GEN(n, FMT_MAKE_REF_##Char)}; \
|
fmt::internal::ArgArray<n>::Type arr; \
|
||||||
|
FMT_GEN(n, FMT_ASSIGN_##Char); \
|
||||||
call(FMT_FOR_EACH(FMT_GET_ARG_NAME, __VA_ARGS__), fmt::ArgList( \
|
call(FMT_FOR_EACH(FMT_GET_ARG_NAME, __VA_ARGS__), fmt::ArgList( \
|
||||||
fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), arr)); \
|
fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), arr)); \
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user