Open divinity76 opened 5 months ago
It looks like this move makes #if defined(IS_X86)
on line 119 redundant. The intention was to eventually use get_cpu_features
on other platforms, though we haven't done that yet. Is there any more direct way to mark the function "don't warn if this is unused"? Or is that all ugly compiler specific macros that we don't want to touch?
C23 has a solution: https://en.cppreference.com/w/c/language/attributes/maybe_unused but it's 9 years too early to require C23 compatibility.
Maybe make get_cpu_features() always static, and make a public non-static blake3_get_cpu_features() which is just a wrapper for get_cpu_features() ? that would get rid of the unused warning.
if you go that route, maybe some more thought should be put into exactly what the public function should return tho, idk
a possible alternative solution: https://github.com/BLAKE3-team/BLAKE3/pull/383
(it may solve the problem for ARM specifically, but probably not for other non-x86-non-arm architectures)
the #endif was in the wrong place, on MacOS-arm64 causing the error /Users/runner/work/php-src/php-src/ext/hash/blake3/upstream_blake3/c/blake3_dispatch.c:112:5: error: unused function 'get_cpu_features' [-Werror,-Wunused-function]
full compiler log showcasing the issue https://github.com/php/php-src/actions/runs/7762643678/job/21173438425?pr=13194