moonchen commented on code in PR #13310:
URL: https://github.com/apache/trafficserver/pull/13310#discussion_r3455722524


##########
include/tsutil/TsSharedMutex.h:
##########
@@ -27,6 +27,7 @@
 #include <pthread.h>
 #include "tsutil/Strerror.h"
 #include "tsutil/Assert.h"
+#include "tsutil/ts_thread_safety.h"
 

Review Comment:
   Addressed: added `tsutil/ts_thread_safety.h` to `TSUTIL_PUBLIC_HEADERS` so 
it is installed alongside the public headers that include it 
(`TsSharedMutex.h`, and `Metrics.h` transitively).



##########
src/tsutil/CMakeLists.txt:
##########
@@ -80,9 +80,19 @@ if(BUILD_TESTING)
     unit_tests/test_StringConvert.cc
     unit_tests/test_Regex.cc
     unit_tests/test_ts_meta.cc
+    unit_tests/test_thread_safety.cc
     unit_tests/test_time_parser.cc
   )
 
+  # The thread-safety test doubles as a compile-time check: under Clang, build 
it
+  # with the analysis enabled and treat any finding as an error so a broken
+  # annotation chain fails the build. A no-op for GCC (the macros expand to
+  # nothing there).
+  set_source_files_properties(
+    unit_tests/test_thread_safety.cc PROPERTIES COMPILE_OPTIONS
+                                                
"$<$<CXX_COMPILER_ID:Clang>:-Wthread-safety;-Werror=thread-safety>"
+  )

Review Comment:
   Verified this works as written. CMake keeps the `;` inside the `$<...>` 
generator expression and emits a two-element list; the generated compile 
command shows Clang getting `-Wthread-safety -Werror=thread-safety` and GCC 
getting neither (no stray `-Werror=thread-safety>`). Leaving as-is.



-- 
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]

Reply via email to