diff options
author | Riccardo Mancini | 2021-07-30 17:34:12 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo | 2021-08-19 15:39:22 -0300 |
commit | ab3c0ddb0d71dc214b61d11deb8770196ef46c05 (patch) | |
tree | fb15fee379e33d63d6b8768af438c2c4f0de5236 /tools | |
parent | 5f534a81819ec9ed84ec2d97b7786ebafadd56a3 (diff) |
tools: Add sparse context/locking annotations in compiler-types.h
This patch copies sparse context/locking annotations from
include/compiler-types.h to tools/include/compiler-types.h.
Committer notes:
This will be used in the upcoming workqueue patchset.
Signed-off-by: Riccardo Mancini <rickyman7@gmail.com>
Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http //lore.kernel.org/lkml/58b2f161ce856ec8b499f4dcf60a10adc84651e0.1627657061.git.rickyman7@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/include/linux/compiler_types.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/include/linux/compiler_types.h b/tools/include/linux/compiler_types.h index feea09029f61..24ae3054f304 100644 --- a/tools/include/linux/compiler_types.h +++ b/tools/include/linux/compiler_types.h @@ -13,6 +13,24 @@ #define __has_builtin(x) (0) #endif +#ifdef __CHECKER__ +/* context/locking */ +# define __must_hold(x) __attribute__((context(x,1,1))) +# define __acquires(x) __attribute__((context(x,0,1))) +# define __releases(x) __attribute__((context(x,1,0))) +# define __acquire(x) __context__(x,1) +# define __release(x) __context__(x,-1) +# define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) +#else /* __CHECKER__ */ +/* context/locking */ +# define __must_hold(x) +# define __acquires(x) +# define __releases(x) +# define __acquire(x) (void)0 +# define __release(x) (void)0 +# define __cond_lock(x,c) (c) +#endif /* __CHECKER__ */ + /* Compiler specific macros. */ #ifdef __GNUC__ #include <linux/compiler-gcc.h> |