Loading...
Searching...
No Matches
1#ifndef PROTON_ANNOTATIONS_H
2#define PROTON_ANNOTATIONS_H 1
53 #ifdef _USE_ATTRIBUTES_FOR_SAL
54 #undef _USE_ATTRIBUTES_FOR_SAL
57 #define _USE_ATTRIBUTES_FOR_SAL 1
60 #define PN_PRINTF_FORMAT _Printf_format_string_
61 #define PN_PRINTF_FORMAT_ATTR(format_param, dots_param)
63#elif defined(__GNUC__)
65 #define PN_PRINTF_FORMAT
66 #define PN_PRINTF_FORMAT_ATTR(format_param, dots_param) \
67 __attribute__((__format__(__printf__, format_param, dots_param)))
71 #define PN_PRINTF_FORMAT
72 #define PN_PRINTF_FORMAT_ATTR(format_param, dots_param)
78#if defined(__has_cpp_attribute)
79 #if __has_cpp_attribute(nodiscard)
80 #define PN_NODISCARD [[nodiscard]]
83#if !defined PN_NODISCARD
84 #if defined(_MSC_VER) && (_MSC_VER >= 1700)
85 #define PN_NODISCARD _Check_return_
86 #elif defined(__GNUC__)
87 #define PN_NODISCARD __attribute__((__warn_unused_result__))
94#if defined __cplusplus && defined __has_cpp_attribute
95 #if __has_cpp_attribute(fallthrough) && __cplusplus >= __has_cpp_attribute(fallthrough)
96 #define PN_FALLTHROUGH [[fallthrough]]
98#elif defined __STDC_VERSION__ && defined __has_c_attribute
99 #if __has_c_attribute(fallthrough) && __STDC_VERSION__ >= __has_c_attribute(fallthrough)
100 #define PN_FALLTHROUGH [[fallthrough]]
103#if !defined PN_FALLTHROUGH && defined __has_attribute
104 #if __has_attribute(__fallthrough__)
105 #define PN_FALLTHROUGH __attribute__((__fallthrough__))
108#if !defined PN_FALLTHROUGH
109 #define PN_FALLTHROUGH (void)0
113#if defined(__GNUC__) || defined(__clang__)
115 #define PN_PUSH_WARNING _Pragma("GCC diagnostic push")
116 #define PN_POP_WARNING _Pragma("GCC diagnostic pop")
117 #define PN_GNU_DISABLE_WARNING_INTERNAL2(warningName) #warningName
118 #define PN_GNU_DISABLE_WARNING(warningName) _Pragma(PN_GNU_DISABLE_WARNING_INTERNAL2(GCC diagnostic ignored warningName))
120 #define PN_CLANG_DISABLE_WARNING(warningName) PN_GNU_DISABLE_WARNING(warningName)
121 #define PN_GCC_DISABLE_WARNING(warningName)
123 #define PN_CLANG_DISABLE_WARNING(warningName)
124 #define PN_GCC_DISABLE_WARNING(warningName) PN_GNU_DISABLE_WARNING(warningName)
126 #define PN_MSVC_DISABLE_WARNING(warningNumber)
127#elif defined(_MSC_VER)
128 #define PN_PUSH_WARNING __pragma(warning(push))
129 #define PN_POP_WARNING __pragma(warning(pop))
131 #define PN_GNU_DISABLE_WARNING(warningName)
132 #define PN_GCC_DISABLE_WARNING(warningName)
133 #define PN_CLANG_DISABLE_WARNING(warningName)
134 #define PN_MSVC_DISABLE_WARNING(warningNumber) __pragma(warning(disable : warningNumber))
136 #define PN_PUSH_WARNING
137 #define PN_POP_WARNING
138 #define PN_GNU_DISABLE_WARNING(warningName)
139 #define PN_GCC_DISABLE_WARNING(warningName)
140 #define PN_CLANG_DISABLE_WARNING(warningName)
141 #define PN_MSVC_DISABLE_WARNING(warningNumber)