]> granicus.if.org Git - php/commitdiff
Make ATTRIBUTE_UNUSED more portable
authorNikita Popov <nikita.ppv@gmail.com>
Wed, 12 Jun 2019 12:29:23 +0000 (14:29 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 12 Jun 2019 12:29:23 +0000 (14:29 +0200)
Zend/zend_portability.h

index 009be97d968647554b137ad346c4c15716b860b8..aae08a49c16d048f5d039efbf616661f4d861e6a 100644 (file)
@@ -217,8 +217,13 @@ char *alloca();
 # define ZEND_ATTRIBUTE_DEPRECATED
 #endif
 
-#if defined(__GNUC__) && ZEND_GCC_VERSION >= 4003
+#if ZEND_GCC_VERSION >= 4003 || __has_attribute(unused)
 # define ZEND_ATTRIBUTE_UNUSED __attribute__((unused))
+#else
+# define ZEND_ATTRIBUTE_UNUSED
+#endif
+
+#if defined(__GNUC__) && ZEND_GCC_VERSION >= 4003
 # define ZEND_COLD __attribute__((cold))
 # define ZEND_HOT __attribute__((hot))
 # ifdef __OPTIMIZE__
@@ -229,7 +234,6 @@ char *alloca();
 #  define ZEND_OPT_SPEED
 # endif
 #else
-# define ZEND_ATTRIBUTE_UNUSED
 # define ZEND_COLD
 # define ZEND_HOT
 # define ZEND_OPT_SIZE