From: Ben Pfaff Date: Wed, 21 Aug 2013 18:24:49 +0000 (-0700) Subject: ovs-thread: Mark lock and unlock functions as no_thread_safety_analysis. X-Git-Tag: v2.0~137 X-Git-Url: http://git.cascardo.eti.br/?a=commitdiff_plain;h=da2035617fc39caf2efb02916db684cafa679c96;p=cascardo%2Fovs.git ovs-thread: Mark lock and unlock functions as no_thread_safety_analysis. I don't see any other way to make Clang realize that these are the real mutex implementation functions. I first noticed these warnings with Clang 1:3.4~svn188890-1~exp1. I previously used version 1:3.4~svn187484-1~exp1. Signed-off-by: Ben Pfaff Acked-by: Ethan Jackson --- diff --git a/lib/compiler.h b/lib/compiler.h index 519b83291..fb4d46cd1 100644 --- a/lib/compiler.h +++ b/lib/compiler.h @@ -128,6 +128,8 @@ #define OVS_EXCLUDED(...) __attribute__((locks_excluded(__VA_ARGS__))) #define OVS_ACQ_BEFORE(...) __attribute__((acquired_before(__VA_ARGS__))) #define OVS_ACQ_AFTER(...) __attribute__((acquired_after(__VA_ARGS__))) +#define OVS_NO_THREAD_SAFETY_ANALYSIS \ + __attribute__((no_thread_safety_analysis)) #else /* not Clang */ #define OVS_LOCKABLE #define OVS_REQ_RDLOCK(...) @@ -145,6 +147,7 @@ #define OVS_RELEASES(...) #define OVS_ACQ_BEFORE(...) #define OVS_ACQ_AFTER(...) +#define OVS_NO_THREAD_SAFETY_ANALYSIS #endif /* ISO C says that a C implementation may choose any integer type for an enum diff --git a/lib/ovs-thread.c b/lib/ovs-thread.c index e9366e2de..b3a87bb12 100644 --- a/lib/ovs-thread.c +++ b/lib/ovs-thread.c @@ -47,6 +47,7 @@ static bool multithreaded; void \ ovs_##TYPE##_##FUN##_at(const struct ovs_##TYPE *l_, \ const char *where) \ + OVS_NO_THREAD_SAFETY_ANALYSIS \ { \ struct ovs_##TYPE *l = CONST_CAST(struct ovs_##TYPE *, l_); \ int error = pthread_##TYPE##_##FUN(&l->lock); \ @@ -63,6 +64,7 @@ LOCK_FUNCTION(rwlock, wrlock); int \ ovs_##TYPE##_##FUN##_at(const struct ovs_##TYPE *l_, \ const char *where) \ + OVS_NO_THREAD_SAFETY_ANALYSIS \ { \ struct ovs_##TYPE *l = CONST_CAST(struct ovs_##TYPE *, l_); \ int error = pthread_##TYPE##_##FUN(&l->lock); \ @@ -81,6 +83,7 @@ TRY_LOCK_FUNCTION(rwlock, trywrlock); #define UNLOCK_FUNCTION(TYPE, FUN) \ void \ ovs_##TYPE##_##FUN(const struct ovs_##TYPE *l_) \ + OVS_NO_THREAD_SAFETY_ANALYSIS \ { \ struct ovs_##TYPE *l = CONST_CAST(struct ovs_##TYPE *, l_); \ int error; \