Skip to content

Commit ee37774

Browse files
committed
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.
1 parent d393268 commit ee37774

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Zend/zend_portability.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ char *alloca();
245245
#endif
246246

247247
#if defined(__GNUC__) && ZEND_GCC_VERSION >= 5000
248-
# define ZEND_ATTRIBUTE_UNUSED_LABEL __attribute__((cold, unused));
248+
# define ZEND_ATTRIBUTE_UNUSED_LABEL __attribute__((unused));
249249
# define ZEND_ATTRIBUTE_COLD_LABEL __attribute__((cold));
250250
# define ZEND_ATTRIBUTE_HOT_LABEL __attribute__((hot));
251251
#else

Zend/zend_vm_gen.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,7 @@ function gen_handler($f, $spec, $kind, $name, $op1, $op2, $use, $code, $lineno,
11231123
}
11241124
if ($use) {
11251125
// This handler is used by other handlers. We will add label to call it.
1126-
out($f," {$spec_name}_LABEL:\n");
1126+
out($f," {$spec_name}_LABEL: ZEND_ATTRIBUTE_UNUSED_LABEL\n");
11271127
} else {
11281128
out($f,"\n");
11291129
}

0 commit comments

Comments
 (0)