Skip to content

Commit ae54bf8

Browse files
Add VA_ARGS expansion for Clang support. Remove user-defined copy constructor (implicitly defined, unnecessary and destroys the implicit copy operator when compiling with pedantic warnings on newer compilers.
1 parent 231b31a commit ae54bf8

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/include/millennium/backend_init.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ class BackendCallbacks : public Singleton<BackendCallbacks>
8383
PluginTypeSchema(const std::string& name, eBackendLoadEvents ev) : pluginName(name), event(ev)
8484
{
8585
}
86-
PluginTypeSchema(const PluginTypeSchema& other) : pluginName(other.pluginName), event(other.event)
87-
{
88-
}
8986
};
9087

9188
using EventCallback = std::function<void()>;

src/include/millennium/logger.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,16 @@ extern OutputLogger Logger;
102102
#endif
103103

104104
#ifndef LOG_ERROR
105-
#define LOG_ERROR(fmt, ...) Logger.ErrorTrace(fmt, __FILE__, __LINE__, PRETTY_FUNCTION, ##__VA_ARGS__)
105+
#define LOG_ERROR(...) Logger.ErrorTrace(FIRST(__VA_ARGS__), __FILE__, __LINE__, PRETTY_FUNCTION REST(__VA_ARGS__))
106+
#define FIRST(...) FIRST_HELPER(__VA_ARGS__, throwaway)
107+
#define FIRST_HELPER(first, ...) first
108+
#define REST(...) REST_HELPER(NUM(__VA_ARGS__), __VA_ARGS__)
109+
#define REST_HELPER(qty, ...) REST_HELPER2(qty, __VA_ARGS__)
110+
#define REST_HELPER2(qty, ...) REST_HELPER_##qty(__VA_ARGS__)
111+
#define REST_HELPER_ONE(first)
112+
#define REST_HELPER_TWOORMORE(first, ...) , __VA_ARGS__
113+
#define NUM(...) \
114+
SELECT_10TH(__VA_ARGS__, TWOORMORE, TWOORMORE, TWOORMORE, TWOORMORE,\
115+
TWOORMORE, TWOORMORE, TWOORMORE, TWOORMORE, ONE, throwaway)
116+
#define SELECT_10TH(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, ...) a10
106117
#endif

0 commit comments

Comments
 (0)