[PATCH] D73376: [analyzer] Add FuchsiaLockChecker and C11LockChecker

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 27 09:51:20 PST 2020


xazax.hun marked 2 inline comments as done.
xazax.hun added inline comments.


================
Comment at: clang/test/Analysis/c11lock.c:7
+enum {
+  thrd_success = 0,
+  thrd_error = 2
----------------
Strictly speaking, this is implementation defined. But the C11 implementations I am aware of are following this trend (`thrd_success == 0`). E.g. if the implementation is using pthreads as a backend it is unlikely for this to be any other value.


================
Comment at: clang/test/Analysis/c11lock.c:32
+  mtx_lock(&mtx);
+} // TODO: Warn for missing unlock?
+
----------------
This is a TODO, and I did not solve in this patch for two reasons:
* Having a mutex in stack scope is rare and prone to errors.
* I did not want to add new functionality in this patch.

That being said I am not sure if I want to add this anytime soon (due to reason 1).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73376/new/

https://reviews.llvm.org/D73376





More information about the cfe-commits mailing list