comparison th_types.h @ 746:a557d1b2a356

Move TH_ATTR_PRINTF_FMT macro definition to th_types.h and improve the preprocessor checks. Apparently newer versions (not sure since which version exactly) seem to work fine with the attribute defined. Enabling for MinGW GCC >= 12 for now, though it may have worked earlier.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 21 Dec 2022 13:19:02 +0200
parents 31bc1ed07cf5
children 57ccf6402d2a
comparison
equal deleted inserted replaced
745:0c90dd46c49f 746:a557d1b2a356
16 16
17 // Meh, this is a hack due to the crap non-portability of 64bit 17 // Meh, this is a hack due to the crap non-portability of 64bit
18 // printf PRI* type specifiers/modifiers 18 // printf PRI* type specifiers/modifiers
19 #if !defined(TH_USE_BONK_TYPES) && (defined(__MINGW32__) || defined(__MINGW64__)) 19 #if !defined(TH_USE_BONK_TYPES) && (defined(__MINGW32__) || defined(__MINGW64__))
20 # define __USE_MINGW_ANSI_STDIO 1 20 # define __USE_MINGW_ANSI_STDIO 1
21 #endif
22
23
24 // Older MinGW-w64 versions do not play well with certain PRI* and type
25 // checking of printf() format specifiers, so .. only define the attribute
26 // macro for GCC/clang and new enough MinGW-w64.
27 #if (defined(__GNUC__) || defined(__clang__)) && (!defined(__MINGW64__) || __GNUC__ >= 12)
28 # define TH_ATTR_PRINTF_FMT(xstart, xend) __attribute__ ((__format__ (__printf__, (xstart), (xend))))
29 #else
30 # define TH_ATTR_PRINTF_FMT(xstart, xend)
21 #endif 31 #endif
22 32
23 33
24 // Check for system type 34 // Check for system type
25 #if defined(__WIN64) || defined(_WIN64) || defined(__WIN32) || defined(_WIN32) 35 #if defined(__WIN64) || defined(_WIN64) || defined(__WIN32) || defined(_WIN32)