diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h index caf4175107a..ef3043c32ce 100644 --- a/src/common/cbasetypes.h +++ b/src/common/cbasetypes.h @@ -339,14 +339,21 @@ typedef uintptr_t uintptr; #if defined(__GNUC__) && !defined(__clang__) #define GCCATTR(str) __attribute__ (str) #else // defined(__GNUC__) && !defined(__clang__) -#define GCCATTR(str) +#define GCCATTR(str) +#endif // defined(__GNUC__) && !defined(__clang__) + +// attribute for gcc only +#if defined(__GNUC__) && !defined(__clang__) && (GCC_VERSION >= 100000) +#define GCC10ATTR(str) __attribute__ (str) +#else // defined(__GNUC__) && !defined(__clang__) +#define GCC10ATTR(str) #endif // defined(__GNUC__) && !defined(__clang__) // attribute for gcc only #if defined(__GNUC__) && !defined(__clang__) && (GCC_VERSION >= 110000) #define GCC11ATTR(str) __attribute__ (str) #else // defined(__GNUC__) && !defined(__clang__) -#define GCC11ATTR(str) +#define GCC11ATTR(str) #endif // defined(__GNUC__) && !defined(__clang__) // fallthrough attribute only enabled on gcc >= 7.0 diff --git a/src/common/strlib.h b/src/common/strlib.h index 6385ddb7c8f..a6ecbc1a628 100644 --- a/src/common/strlib.h +++ b/src/common/strlib.h @@ -111,28 +111,28 @@ struct StringBuf { typedef struct StringBuf StringBuf; struct strlib_interface { - char *(*jstrescape) (char* pt) GCCATTR ((access (read_only, 1))); - char *(*jstrescapecpy) (char* pt, const char* spt) GCCATTR ((access (write_only, 1), access (read_only, 2))); - int (*jmemescapecpy) (char* pt, const char* spt, int size) GCCATTR ((access (write_only, 1), access (read_only, 2, 3))); - int (*remove_control_chars_) (char* str) GCCATTR ((access (read_write, 1))); - char *(*trim_) (char* str) GCCATTR ((access (read_write, 1))); - char *(*normalize_name_) (char* str, const char* delims) GCCATTR ((access (read_write, 1), access (read_only, 2))); - const char *(*stristr_) (const char *haystack, const char *needle) GCCATTR ((access (read_only, 1), access (read_only, 2))); + char *(*jstrescape) (char* pt) GCC10ATTR ((access (read_only, 1))); + char *(*jstrescapecpy) (char* pt, const char* spt) GCC10ATTR ((access (write_only, 1), access (read_only, 2))); + int (*jmemescapecpy) (char* pt, const char* spt, int size) GCC10ATTR ((access (write_only, 1), access (read_only, 2, 3))); + int (*remove_control_chars_) (char* str) GCC10ATTR ((access (read_write, 1))); + char *(*trim_) (char* str) GCC10ATTR ((access (read_write, 1))); + char *(*normalize_name_) (char* str, const char* delims) GCC10ATTR ((access (read_write, 1), access (read_only, 2))); + const char *(*stristr_) (const char *haystack, const char *needle) GCC10ATTR ((access (read_only, 1), access (read_only, 2))); /* only used when '!(defined(WIN32) && defined(_MSC_VER)) && !defined(HAVE_STRNLEN)', needs to be defined at all times however */ - size_t (*strnlen_) (const char* string, size_t maxlen) GCCATTR ((access (read_only, 1, 2))); + size_t (*strnlen_) (const char* string, size_t maxlen) GCC10ATTR ((access (read_only, 1, 2))); /* only used when 'WIN32' */ - char * (*strtok_r_) (char *s1, const char *s2, char **lasts) GCCATTR ((access (read_write, 1), access (read_only, 2), access (read_write, 3))); + char * (*strtok_r_) (char *s1, const char *s2, char **lasts) GCC10ATTR ((access (read_write, 1), access (read_only, 2), access (read_write, 3))); - int (*e_mail_check_) (char* email) GCCATTR ((access (read_write, 1))); - int (*config_switch_) (const char* str) GCCATTR ((access (read_only, 1))); + int (*e_mail_check_) (char* email) GCC10ATTR ((access (read_write, 1))); + int (*config_switch_) (const char* str) GCC10ATTR ((access (read_only, 1))); /// strncpy that always null-terminates the string - char *(*safestrncpy_) (char* dst, const char* src, size_t n) GCCATTR ((access (write_only, 1, 3), access (read_only, 2))); + char *(*safestrncpy_) (char* dst, const char* src, size_t n) GCC10ATTR ((access (write_only, 1, 3), access (read_only, 2))); /// doesn't crash on null pointer - size_t (*safestrnlen_) (const char* string, size_t maxlen) GCCATTR ((access (read_only, 1, 2))); + size_t (*safestrnlen_) (const char* string, size_t maxlen) GCC10ATTR ((access (read_only, 1, 2))); /// Works like snprintf, but always null-terminates the buffer. /// Returns the size of the string (without null-terminator) @@ -141,26 +141,26 @@ struct strlib_interface { /// Returns the line of the target position in the string. /// Lines start at 1. - int (*strline_) (const char* str, size_t pos) GCCATTR ((access (read_only, 1))); + int (*strline_) (const char* str, size_t pos) GCC10ATTR ((access (read_only, 1))); /// Produces the hexadecimal representation of the given input. /// The output buffer must be at least count*2+1 in size. /// Returns true on success, false on failure. - bool (*bin2hex_) (char *output, const unsigned char *input, size_t count) GCCATTR ((access (write_only, 1), access (read_only, 2, 3))); + bool (*bin2hex_) (char *output, const unsigned char *input, size_t count) GCC10ATTR ((access (write_only, 1), access (read_only, 2, 3))); }; struct stringbuf_interface { StringBuf* (*Malloc) (void); - void (*Init) (StringBuf* self) GCCATTR ((access (write_only, 1))); - int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))) GCCATTR ((access(read_write, 1))); + void (*Init) (StringBuf* self) GCC10ATTR ((access (write_only, 1))); + int (*Printf) (StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))) GCC10ATTR ((access(read_write, 1))); int (*Vprintf) (StringBuf* self, const char* fmt, va_list args) __attribute__((format(printf, 2, 0))); - int (*Append) (StringBuf* self, const StringBuf *sbuf) GCCATTR ((access (read_write, 1), access (read_only, 2))); - int (*AppendStr) (StringBuf* self, const char* str) GCCATTR ((access (read_write, 1), access (read_only, 2))); - int (*Length) (StringBuf* self) GCCATTR ((access (read_only, 1))); - char* (*Value) (StringBuf* self) GCCATTR ((access (read_write, 1))); - void (*Clear) (StringBuf* self) GCCATTR ((access (read_write, 1))); - void (*Destroy) (StringBuf* self) GCCATTR ((access (read_write, 1))); - void (*Free) (StringBuf* self) GCCATTR ((access (read_write, 1))); + int (*Append) (StringBuf* self, const StringBuf *sbuf) GCC10ATTR ((access (read_write, 1), access (read_only, 2))); + int (*AppendStr) (StringBuf* self, const char* str) GCC10ATTR ((access (read_write, 1), access (read_only, 2))); + int (*Length) (StringBuf* self) GCC10ATTR ((access (read_only, 1))); + char* (*Value) (StringBuf* self) GCC10ATTR ((access (read_write, 1))); + void (*Clear) (StringBuf* self) GCC10ATTR ((access (read_write, 1))); + void (*Destroy) (StringBuf* self) GCC10ATTR ((access (read_write, 1))); + void (*Free) (StringBuf* self) GCC10ATTR ((access (read_write, 1))); }; struct sv_interface { diff --git a/src/map/HPMmap.c b/src/map/HPMmap.c index 2d6f9e47e93..8afbb48ecea 100644 --- a/src/map/HPMmap.c +++ b/src/map/HPMmap.c @@ -61,6 +61,7 @@ #include "map/date.h" #include "map/duel.h" #include "map/elemental.h" +#include "map/grader.h" #include "map/guild.h" #include "map/homunculus.h" #include "map/instance.h" diff --git a/src/plugins/HPMHooking.c b/src/plugins/HPMHooking.c index ba924664642..5b633538650 100644 --- a/src/plugins/HPMHooking.c +++ b/src/plugins/HPMHooking.c @@ -87,6 +87,7 @@ PRAGMA_GCC5(GCC diagnostic ignored "-Wsuggest-attribute=format") #include "map/clif.h" #include "map/duel.h" #include "map/elemental.h" +#include "map/grader.h" #include "map/guild.h" #include "map/homunculus.h" #include "map/instance.h"