From ee377744662fd9e0c0e3f1e018a57eab335ccdc7 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 4 Nov 2021 14:47:10 +0100 Subject: [PATCH] Suppress unused label warnings in SWITCH VM While we avoid emitting labels for handlers that are not referenced from anywhere else, we do not perform a fine-grained analysis on used specializations, so some of the specialization labels may not be used. Use ATTRIBUTE_UNUSED_LABEL to suppress the warning. Drop "cold" from the definition of this attribute, as it is completely unrelated. --- Zend/zend_portability.h | 2 +- Zend/zend_vm_gen.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h index f4acc9930e8..a3d2d1ccabc 100644 --- a/Zend/zend_portability.h +++ b/Zend/zend_portability.h @@ -245,7 +245,7 @@ char *alloca(); #endif #if defined(__GNUC__) && ZEND_GCC_VERSION >= 5000 -# define ZEND_ATTRIBUTE_UNUSED_LABEL __attribute__((cold, unused)); +# define ZEND_ATTRIBUTE_UNUSED_LABEL __attribute__((unused)); # define ZEND_ATTRIBUTE_COLD_LABEL __attribute__((cold)); # define ZEND_ATTRIBUTE_HOT_LABEL __attribute__((hot)); #else diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php index 0795822f965..a8bcf96ef2d 100755 --- a/Zend/zend_vm_gen.php +++ b/Zend/zend_vm_gen.php @@ -1123,7 +1123,7 @@ function gen_handler($f, $spec, $kind, $name, $op1, $op2, $use, $code, $lineno, } if ($use) { // This handler is used by other handlers. We will add label to call it. - out($f," {$spec_name}_LABEL:\n"); + out($f," {$spec_name}_LABEL: ZEND_ATTRIBUTE_UNUSED_LABEL\n"); } else { out($f,"\n"); }