summaryrefslogtreecommitdiff
path: root/src/localconsts.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/localconsts.h')
-rw-r--r--src/localconsts.h44
1 files changed, 39 insertions, 5 deletions
diff --git a/src/localconsts.h b/src/localconsts.h
index a120ed9d7..ad0744246 100644
--- a/src/localconsts.h
+++ b/src/localconsts.h
@@ -1,9 +1,9 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* Copyright (C) 2011-2020 The ManaPlus Developers
- * Copyright (C) 2020-2023 The ManaVerse Developers
+ * Copyright (C) 2020-2025 The ManaVerse Developers
*
- * This file is part of The ManaPlus Client.
+ * This file is part of The ManaVerse Client.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -171,6 +171,40 @@
#define gnu_printf printf
#endif // __clang__
+/*
+ * A_FORMAT_PRINTF: Proxy for printf-like attribute tagging,
+ * All argument positions start indexed by 1
+ *
+ * isMember true if member function. The below will shift by one
+ * if required by toolchain.
+ * fmtIndex: position of format string in argument list
+ * firstArgIndex: position of first optional argument to format.
+ */
+#ifdef BAD_CILKPLUS
+#define A_FORMAT_MEMBER_SHIFT 0
+#else
+#define A_FORMAT_MEMBER_SHIFT 1
+#endif
+
+// idk how to clean this up
+#ifdef __GNUC__
+ #ifdef __OpenBSD__
+ #define A_FORMAT_PRINTF_FUNC printf
+ #else
+ #define A_FORMAT_PRINTF_FUNC gnu_printf
+ #endif
+#else
+ #define A_FORMAT_PRINTF_FUNC gnu_printf
+#endif
+
+#define A_FORMAT_PRINTF(isMember, fmtIndex, firstArgIndex) \
+ __attribute__((__format__( \
+ A_FORMAT_PRINTF_FUNC, \
+ ((fmtIndex) + ((isMember) ? A_FORMAT_MEMBER_SHIFT : 0)), \
+ ((firstArgIndex) + ((isMember) ? A_FORMAT_MEMBER_SHIFT : 0)) \
+ )))
+
+
#ifdef ADVGCC
#define const2 const
@@ -362,8 +396,8 @@ PRAGMA45(GCC diagnostic pop)
#ifdef DYECMD
#undef USE_FUZZER
#endif // DYECMD
-#include "utils/perfomance.h"
-UTILS_PERFOMANCE_H // guard for protect previous include
+#include "utils/performance.h"
+UTILS_PERFORMANCE_H // guard for protect previous include
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif // HAVE_CONFIG_H