mirror of
https://github.com/fmtlib/fmt.git
synced 2025-09-25 14:10:55 +02:00
Suppress a false positive in clang-tidy
This commit is contained in:
@@ -1583,7 +1583,7 @@ template <typename F> class apple_file : public file_base<F> {
|
|||||||
void init_buffer() {
|
void init_buffer() {
|
||||||
if (this->file_->_p) return;
|
if (this->file_->_p) return;
|
||||||
// Force buffer initialization by placing and removing a char in a buffer.
|
// Force buffer initialization by placing and removing a char in a buffer.
|
||||||
putc_unlocked(0, this->file_);
|
if (!FMT_CLANG_ANALYZER) putc_unlocked(0, this->file_);
|
||||||
--this->file_->_p;
|
--this->file_->_p;
|
||||||
++this->file_->_w;
|
++this->file_->_w;
|
||||||
}
|
}
|
||||||
|
@@ -173,6 +173,12 @@ template <typename T> struct iterator_traits<fmt::basic_appender<T>> {
|
|||||||
# define FMT_THROW(x) ::fmt::assert_fail(__FILE__, __LINE__, (x).what())
|
# define FMT_THROW(x) ::fmt::assert_fail(__FILE__, __LINE__, (x).what())
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __clang_analyzer__
|
||||||
|
# define FMT_CLANG_ANALYZER 1
|
||||||
|
#else
|
||||||
|
# define FMT_CLANG_ANALYZER 0
|
||||||
|
#endif
|
||||||
|
|
||||||
// Defining FMT_REDUCE_INT_INSTANTIATIONS to 1, will reduce the number of
|
// Defining FMT_REDUCE_INT_INSTANTIATIONS to 1, will reduce the number of
|
||||||
// integer formatter template instantiations to just one by only using the
|
// integer formatter template instantiations to just one by only using the
|
||||||
// largest integer type. This results in a reduction in binary size but will
|
// largest integer type. This results in a reduction in binary size but will
|
||||||
@@ -4213,21 +4219,26 @@ class format_int {
|
|||||||
inline auto str() const -> std::string { return {str_, size()}; }
|
inline auto str() const -> std::string { return {str_, size()}; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#define FMT_STRING_IMPL(s, base) \
|
#if FMT_CLANG_ANALYZER
|
||||||
[] { \
|
# define FMT_STRING_IMPL(s, base) s
|
||||||
/* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \
|
#else
|
||||||
/* Use a macro-like name to avoid shadowing warnings. */ \
|
# define FMT_STRING_IMPL(s, base) \
|
||||||
struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \
|
[] { \
|
||||||
using char_type = fmt::remove_cvref_t<decltype(s[0])>; \
|
/* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \
|
||||||
constexpr explicit operator fmt::basic_string_view<char_type>() const { \
|
/* Use a macro-like name to avoid shadowing warnings. */ \
|
||||||
return fmt::detail::compile_string_to_view<char_type>(s); \
|
struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \
|
||||||
} \
|
using char_type = fmt::remove_cvref_t<decltype(s[0])>; \
|
||||||
}; \
|
constexpr explicit operator fmt::basic_string_view<char_type>() \
|
||||||
using FMT_STRING_VIEW = \
|
const { \
|
||||||
fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \
|
return fmt::detail::compile_string_to_view<char_type>(s); \
|
||||||
fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \
|
} \
|
||||||
return FMT_COMPILE_STRING(); \
|
}; \
|
||||||
}()
|
using FMT_STRING_VIEW = \
|
||||||
|
fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \
|
||||||
|
fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \
|
||||||
|
return FMT_COMPILE_STRING(); \
|
||||||
|
}()
|
||||||
|
#endif // FMT_CLANG_ANALYZER
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a legacy compile-time format string from a string literal `s`.
|
* Constructs a legacy compile-time format string from a string literal `s`.
|
||||||
|
Reference in New Issue
Block a user