Enable C++20 and re-enable MSVC build

Also switched to standard-conforming __VA_OPT__ for logging.
This commit is contained in:
Pengfei
2021-06-26 17:26:51 +08:00
parent e6d67f3aee
commit 3d3b51bb98
5 changed files with 19 additions and 11 deletions
+2 -2
View File
@@ -39,7 +39,7 @@ if (MSVC)
# /Zc:externConstexpr - Allow extern constexpr variables to have external linkage, like the standard mandates
# /Zc:inline - Let codegen omit inline functions in object files
# /Zc:throwingNew - Let codegen assume `operator new` (without std::nothrow) will never return null
# /experimental:preprocessor - Work around bugs within MSVC's crappy preprocessor
# /Zc:preprocessor - Use std-conforming MSVC preprocessor
add_compile_options(
/W4
/w34263
@@ -60,7 +60,7 @@ if (MSVC)
/Zc:externConstexpr
/Zc:inline
/Zc:throwingNew
/experimental:preprocessor
/Zc:preprocessor
)
# /GS- - No stack buffer overflow checks
+1 -2
View File
@@ -15,12 +15,11 @@
std::uint64_t GetLoggingTime();
std::string StandardizeLogClass(const std::string& log_class);
// TODO: Use a standard variant of ##__VA_ARGS__?
#define LOG_PRINT(log_class, level, text_style, file, line, func, format, ...) \
{ \
fmt::print(stderr, text_style, "[{:12.6f}] {} <{}> {}:{}:{}: " format "\n", \
GetLoggingTime() / 1000000.0, StandardizeLogClass(log_class), level, file, \
line, func, ##__VA_ARGS__); \
line, func __VA_OPT__(, ) __VA_ARGS__); \
fflush(stderr); \
}
+2 -1
View File
@@ -23,7 +23,8 @@ struct ArchiveFormatInfo {
u32_le number_files; ///< The pre-defined number of files in the archive.
u8 duplicate_data; ///< Whether the archive should duplicate the data.
};
static_assert(std::is_pod<ArchiveFormatInfo>::value, "ArchiveFormatInfo is not POD");
static_assert(std::is_standard_layout_v<ArchiveFormatInfo> && std::is_trivial_v<ArchiveFormatInfo>,
"ArchiveFormatInfo is not POD");
union TableOffset {
// This has different meanings for different savegame layouts