Merge pull request #148 from wheremyfoodat/wheremyfoodat-patch-2

Fix GCC build
This commit is contained in:
wheremyfoodat 2023-07-28 19:50:50 +03:00 committed by GitHub
commit 9fe770c4e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,14 +2,12 @@
#include <cstdarg>
#include <fstream>
#include "compiler_builtins.hpp"
namespace Log {
// Our logger class
template <bool enabled>
class Logger {
public:
ALWAYS_INLINE void log(const char* fmt, ...) {
void log(const char* fmt, ...) {
if constexpr (!enabled) return;
std::va_list args;
@ -63,17 +61,17 @@ namespace Log {
// We need this because sadly due to the loggers taking variadic arguments, compilers will not properly
// Kill them fully even when they're disabled. The only way they will is if the function with varargs is totally empty
#define MAKE_LOG_FUNCTION_USER(functionName, logger) \
template <typename... Args> \
ALWAYS_INLINE void functionName(const char* fmt, Args&&... args) { \
Log::logger.log(fmt, args...); \
#define MAKE_LOG_FUNCTION_USER(functionName, logger) \
template <typename... Args> \
void functionName(const char* fmt, Args&&... args) { \
Log::logger.log(fmt, args...); \
}
#ifdef PANDA3DS_USER_BUILD
#define MAKE_LOG_FUNCTION(functionName, logger) \
template <typename... Args> \
ALWAYS_INLINE void functionName(const char* fmt, Args&&... args) {}
void functionName(const char* fmt, Args&&... args) {}
#else
#define MAKE_LOG_FUNCTION(functionName, logger) MAKE_LOG_FUNCTION_USER(functionName, logger)
#endif
}
}