File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -22,12 +22,23 @@ after_includes = """
2222/* NOTE: Compilation fails if you pass in a char* instead of a literal */ ((ddog_CharSlice){ .ptr = "" string, .len = sizeof(string) - 1 })
2323#endif
2424
25+ #if defined __GNUC__
26+ # define DDOG_GNUC_VERSION(major) __GNUC__ >= major
27+ #else
28+ # define DDOG_GNUC_VERSION(major) (0)
29+ #endif
30+
31+ #if defined __has_attribute
32+ # define DDOG_HAS_ATTRIBUTE(attribute, major) __has_attribute(attribute)
33+ #else
34+ # define DDOG_HAS_ATTRIBUTE(attribute, major) DDOG_GNUC_VERSION(major)
35+ #endif
36+
2537#if defined(__cplusplus) && (__cplusplus >= 201703L)
2638# define DDOG_CHECK_RETURN [[nodiscard]]
2739#elif defined(_Check_return_) /* SAL */
2840# define DDOG_CHECK_RETURN _Check_return_
29- #elif (defined(__has_attribute) && __has_attribute(warn_unused_result)) || \\
30- (defined(__GNUC__) && (__GNUC__ >= 4))
41+ #elif DDOG_HAS_ATTRIBUTE(warn_unused_result, 4)
3142# define DDOG_CHECK_RETURN __attribute__((__warn_unused_result__))
3243#else
3344# define DDOG_CHECK_RETURN
You can’t perform that action at this time.
0 commit comments