stephanemoore added inline comments.
================ Comment at: clang-tools-extra/docs/clang-tidy/checks/misc-dispatch-once-assignment.rst:9 +and making such direct writes may potentially violate the run-once protections +intended by the library. ---------------- Eugene.Zelenko wrote: > Does library documentation contain this recommendation? If so, will be good > idea to add link. Same for other check. I don't recall if there is explicit GCD documentation anywhere. The closest thing I could find was a post from Greg Parker: https://stackoverflow.com/a/19845164. I think the general issue is that GCD performs atomic operations internally on `dispatch_once_t` memory. A recent [snapshot](https://github.com/apple/swift-corelibs-libdispatch/blob/631821c2bfcf296995a8424f148a9365470c2210/src/once.c) of a version of GCD suggests that C11 atomic operations are used but the general issue is that GCD does not publicly declare how it internally guarantees atomicity while managing `dispatch_once_t` state. The safest way to make mutations to `dispatch_once_t` memory is by using the same atomic operations library that the particular version of GCD loaded into your process uses (in theory this can vary depending on a number of factors including the system version). Given that this information is not exposed and it seems unlikely, if not unreasonable, to be exposed, the safest approach is presumably to to let GCD handle all mutations. Repository: rCTE Clang Tools Extra CHANGES SINCE LAST ACTION https://reviews.llvm.org/D67578/new/ https://reviews.llvm.org/D67578 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits