Skip to content

Commit

Permalink
Suppress unused label warnings in SWITCH VM
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nikic committed Nov 4, 2021
1 parent d393268 commit ee37774
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Zend/zend_portability.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_vm_gen.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down

0 comments on commit ee37774

Please sign in to comment.