39 #if !defined (PLIBSYS_H_INSIDE) && !defined (PLIBSYS_COMPILATION) 40 # error "Header files shouldn't be included directly, consider using <plibsys.h> instead." 43 #ifndef PLIBSYS_HEADER_PMACROS_H 44 #define PLIBSYS_HEADER_PMACROS_H 53 #ifndef __has_attribute 54 # define __has_attribute(x) 0 58 # define __has_builtin(x) 0 68 #if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) || \ 69 __has_attribute(warn_unused_result) 70 # define P_GNUC_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) 72 # define P_GNUC_WARN_UNUSED_RESULT 109 #if defined(P_CC_MSVC) || defined(P_CC_BORLAND) || defined(P_CC_WATCOM) || \ 110 defined(P_OS_OS2) || (defined(P_OS_BEOS) && !defined(P_CC_GNU)) || \ 111 (defined(P_OS_WIN) && defined(P_CC_PGI)) || \ 112 ((defined(P_OS_WIN) || defined(P_OS_CYGWIN) || defined(P_OS_MSYS)) && defined(P_CC_GNU)) 113 # define P_LIB_GLOBAL_API __declspec(dllexport) 114 # define P_LIB_INTERNAL_API 115 #elif ((__GNUC__ >= 4) && !defined(P_OS_SOLARIS) && !defined(P_OS_HPUX) && !defined(P_OS_AIX)) || \ 116 (defined(P_CC_SUN) && __SUNPRO_C >= 0x590) || \ 117 (defined(P_CC_SUN) && __SUNPRO_CC >= 0x5110) || \ 118 (defined(P_CC_XLC) && __xlC__ >= 0x0D01) || \ 119 (defined(P_CC_HP) && __HP_aCC >= 0x061500) || \ 120 (defined(P_CC_HP) && __HP_cc >= 0x061500) || \ 121 __has_attribute(visibility) 122 # define P_LIB_GLOBAL_API __attribute__ ((visibility ("default"))) 123 # define P_LIB_INTERNAL_API __attribute__ ((visibility ("hidden"))) 124 #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) 125 # define P_LIB_GLOBAL_API __global 126 # define P_LIB_INTERNAL_API __hidden 128 # define P_LIB_GLOBAL_API 129 # define P_LIB_INTERNAL_API 138 #define P_LIB_API P_LIB_GLOBAL_API 149 #if defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) 150 # define P_NO_RETURN _Noreturn 151 #elif defined(P_CC_MSVC) || (defined(P_CC_BORLAND) && __BORLANDC__ >= 0x0550) 152 # define P_NO_RETURN __declspec(noreturn) 153 #elif __has_attribute(noreturn) || \ 154 defined(P_CC_GNU) || \ 155 (defined(P_CC_SUN) && __SUNPRO_C >= 0x5110) || \ 156 (defined(P_CC_SUN) && __SUNPRO_CC >= 0x5110) 157 # define P_NO_RETURN __attribute__((noreturn)) 176 #if (defined(P_CC_GNU) && (__GNUC__ > 2 && __GNUC_MINOR__ > 0)) || \ 177 (defined(P_CC_INTEL) && __INTEL_COMPILER >= 800) || \ 178 (defined(P_CC_XLC) && __xlC__ >= 0x0900) || \ 179 __has_builtin(__builtin_expect) 180 # define P_LIKELY(x) __builtin_expect(!!(x), 1) 181 # define P_UNLIKELY(x) __builtin_expect(!!(x), 0) 183 # define P_LIKELY(x) (x) 184 # define P_UNLIKELY(x) (x) 192 #define P_UNUSED(a) ((void) a) 200 #define P_WARNING(msg) printf ("** Warning: %s **\n", msg) 208 #define P_ERROR(msg) printf ("** Error: %s **\n", msg) 216 #define P_DEBUG(msg) printf ("** Debug: %s **\n", msg) 219 # define PLIBSYS_VERSION_MAJOR 220 # define PLIBSYS_VERSION_MINOR 221 # define PLIBSYS_VERSION_PATCH 222 # define PLIBSYS_VERSION_STR 223 # define PLIBSYS_VERSION 279 #define PLIBSYS_VERSION_CHECK(major, minor, patch) ((major << 16) | (minor << 8) | (patch)) 295 # define P_BEGIN_DECLS extern "C" { 296 # define P_END_DECLS } 298 # define P_BEGIN_DECLS
Compiler detection macros.