moonchen commented on code in PR #13571:
URL: https://github.com/apache/trafficserver/pull/13571#discussion_r3993573843
##########
src/tscore/CMakeLists.txt:
##########
@@ -138,6 +138,14 @@ if(TS_HAS_128BIT_CAS AND TS_NEEDS_MCX16_FOR_CAS)
target_compile_options(tscore PUBLIC "-mcx16")
endif()
+if(TS_NEEDS_LIBATOMIC_FOR_CAS)
+ target_link_libraries(tscore PUBLIC atomic)
+
+ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ target_compile_options(tscore PUBLIC "-Wno-error=atomic-alignment")
+ endif()
+endif()
Review Comment:
`-Wno-error=atomic-alignment` is applied inside the
`TS_NEEDS_LIBATOMIC_FOR_CAS` block, but the code that emits the diagnostic --
`INK_QUEUE_LD`'s `__atomic_load` and the `ink_atomic_cas<__int128_t>`
specialization -- is gated on `TS_HAS_128BIT_CAS_LIBATOMIC`. The probe sets
those two independently: if `CHECK_PROGRAM_ATOMIC` links without an explicit
`-latomic`, `USE_LIBATOMIC_CAS` is TRUE while `NEED_LIBATOMIC` stays FALSE, so
the `__atomic` path compiles with the diagnostic still fatal and `-Werror`
fails again. I couldn't find a toolchain here that actually lands there, so
it's latent rather than broken, but keying the flag to the same variable as the
code costs nothing.
```suggestion
if(TS_NEEDS_LIBATOMIC_FOR_CAS)
target_link_libraries(tscore PUBLIC atomic)
endif()
if(TS_HAS_128BIT_CAS_LIBATOMIC AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_options(tscore PUBLIC "-Wno-error=atomic-alignment")
endif()
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]