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


##########
include/tsutil/Metrics.h:
##########
@@ -304,17 +305,17 @@ class Metrics
 
   class Storage
   {
-    BlobStorage        _blobs;
-    uint16_t           _cur_blob = 0;
-    uint16_t           _cur_off  = 0;
-    LookupTable        _lookups;
-    mutable std::mutex _mutex;
+    BlobStorage _blobs   TS_GUARDED_BY(_mutex);
+    uint16_t _cur_blob   TS_GUARDED_BY(_mutex) = 0;
+    uint16_t _cur_off    TS_GUARDED_BY(_mutex) = 0;
+    LookupTable _lookups TS_GUARDED_BY(_mutex);
+    mutable ts::mutex    _mutex;

Review Comment:
   `TS_GUARDED_BY(_mutex)` on the Storage data members references `_mutex` 
before it is declared. Clang's thread-safety attributes require the capability 
expression to be name-resolvable at the declaration site; with `_mutex` 
declared last, this can fail to compile (and defeats the intent of enabling 
-Wthread-safety on Clang). Declare `_mutex` before the members that use it in 
`TS_GUARDED_BY(...)`.



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