mirror of
https://github.com/abseil/abseil-cpp.git
synced 2026-06-04 20:14:23 +08:00
to provide a centralized policy for hardware-accelerated implementations in headers. This option addresses ODR violations that occur when Abseil headers use compile-time feature detection (such as __SSE4_2__) in inline functions. If translation units are compiled with inconsistent CPU architecture flags (e.g., -march=native vs -march=generic) and linked together, they may disagree on the implementation of these inline functions. This can lead to crashes or silent data corruption in hashing. The new option provides three levels of control: - 0: Portable. Forces software-only implementations in headers, guaranteeing ABI safety across mixed translation units. - 1: Required. Forces hardware-accelerated implementations in headers. The build will fail if the required instructions are not enabled in the compiler environment. - 2: Auto-detect. Selects the best available implementation based on compiler flags, but can't guarantee safety if translation units are compiled with inconsistent flags. PiperOrigin-RevId: 896569507 Change-Id: Ifcbc1f3980883feeaa4f05f845ce32310ca7d533