File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 52
52
# define csnip_cext_import
53
53
#endif
54
54
55
+ /** More portable version of C23's [[nodiscard]].
56
+ *
57
+ * For the common pre-C23 compilers, it uses a compiler-specific
58
+ * alternative.
59
+ */
60
+ #if __STDC_VERSION >= 202311L
61
+ # define csnip_cext_nodiscard [[nodiscard]]
62
+ #elif defined(__GNUC__ ) || defined(__clang__ )
63
+ # define csnip_cext_nodiscard __attribute__((warn_unused_result))
64
+ #elif defined(_MSC_VER )
65
+ # define csnip_cext_nodiscard _Check_return_
66
+ #else
67
+ # define csnip_cext_nodiscard /* nothing */
68
+ #endif
69
+
55
70
/**@}*/
56
71
57
72
#endif /* CSNIP_CEXT_H */
60
75
#define cext_unused csnip_cext_unused
61
76
#define cext_export csnip_cext_export
62
77
#define cext_import csnip_cext_import
78
+ #define cext_nodiscard csnip_cext_nodiscard
63
79
#define CSNIP_CEXT_HAVE_SHORT_NAMES
64
80
#endif /* CSNIP_SHORT_NAMES && !CSNIP_CEXT_HAVE_SHORT_NAMES */
You can’t perform that action at this time.
0 commit comments