#define COMMON_H
#include <stdarg.h>
+#include <assert.h>
#include "qtypes.h"
#include "qdefs.h"
char *va(char *buf, size_t buflen, const char *format, ...) DP_FUNC_PRINTF(3);
// does a varargs printf into provided buffer, returns buffer (so it can be called in-line unlike dpsnprintf)
+// GCC with -Werror=c++-compat will error out if static_assert is used even though the macro is valid C11...
+#ifndef __cplusplus
+#define DP_STATIC_ASSERT(expr, str) _Static_assert(expr, str)
+#else
+#define DP_STATIC_ASSERT(expr, str) static_assert(expr, str)
+#endif
// snprintf and vsnprintf are NOT portable. Use their DP counterparts instead
#ifdef snprintf
-#include "darkplaces.h"
-
#ifdef WIN32
#include <io.h>
#include "conio.h"
#include <signal.h>
+/*
+ * Include this BEFORE darkplaces.h because it breaks wrapping
+ * _Static_assert. Cloudwalk has no idea how or why so don't ask.
+ */
#include <SDL.h>
+#include "darkplaces.h"
+
#ifdef WIN32
#ifdef _MSC_VER
#pragma comment(lib, "sdl2.lib")