Skip to content

Commit

Permalink
Another try to make version_info compile with github clang 14
Browse files Browse the repository at this point in the history
  • Loading branch information
dragon-dreamer committed Dec 30, 2023
1 parent d2f2153 commit a11fb42
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pe_bliss2/include/pe_bliss2/resources/version_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

#include <compare>
#include <cstdint>
#if defined(__cpp_lib_format) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)
#include <version>
#if defined(__cpp_lib_format) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) && __cpp_lib_format >= 201907L
# include <format>
#else //__cpp_lib_format && !_LIBCPP_HAS_NO_INCOMPLETE_FORMAT
#else
# include <cstdio>
# include <cwchar>
#endif //__cpp_lib_format && !_LIBCPP_HAS_NO_INCOMPLETE_FORMAT
#endif
#include <functional>
#include <optional>
#include <string>
Expand Down Expand Up @@ -211,7 +212,7 @@ class [[nodiscard]] file_version_info
std::uint32_t ms, std::uint32_t ls)
{
const auto ver = version_from_components(ms, ls);
#if defined(__cpp_lib_format) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)
#if defined(__cpp_lib_format) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) && __cpp_lib_format >= 201907L
if constexpr (std::is_same_v<CharType, char>)
{
return std::format("{}.{}.{}.{}", ver.major,
Expand All @@ -222,7 +223,7 @@ class [[nodiscard]] file_version_info
return std::format(L"{}.{}.{}.{}", ver.major,
ver.minor, ver.build, ver.revision);
}
#else //__cpp_lib_format && !_LIBCPP_HAS_NO_INCOMPLETE_FORMAT
#else
CharType buf[64]{};
if constexpr (std::is_same_v<CharType, char>)
{
Expand All @@ -235,7 +236,7 @@ class [[nodiscard]] file_version_info
ver.major, ver.minor, ver.build, ver.revision);
}
return buf;
#endif //__cpp_lib_format
#endif
}
};

Expand Down

0 comments on commit a11fb42

Please sign in to comment.