Skip to content

Commit df5a413

Browse files
committed
zend_portability: Add ZEND_ATTRIBUTE_NODISCARD
1 parent b27d919 commit df5a413

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Zend/zend_portability.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,14 @@ char *alloca();
248248
# define ZEND_ATTRIBUTE_ALLOC_SIZE2(X,Y)
249249
#endif
250250

251+
#if __STDC_VERSION__ >= 202311L
252+
# define ZEND_ATTRIBUTE_NODISCARD [[nodiscard]]
253+
#elif __has_attribute(__warn_unused_result__)
254+
# define ZEND_ATTRIBUTE_NODISCARD __attribute__((__warn_unused_result__))
255+
#else
256+
# define ZEND_ATTRIBUTE_NODISCARD
257+
#endif
258+
251259
#if ZEND_GCC_VERSION >= 3000
252260
# define ZEND_ATTRIBUTE_CONST __attribute__((const))
253261
#else

0 commit comments

Comments
 (0)