Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Riccardo Mancini and committed by
Arnaldo Carvalho de Melo
ab3c0ddb 5f534a81

+18
+18
tools/include/linux/compiler_types.h
··· 13 13 #define __has_builtin(x) (0) 14 14 #endif 15 15 16 + #ifdef __CHECKER__ 17 + /* context/locking */ 18 + # define __must_hold(x) __attribute__((context(x,1,1))) 19 + # define __acquires(x) __attribute__((context(x,0,1))) 20 + # define __releases(x) __attribute__((context(x,1,0))) 21 + # define __acquire(x) __context__(x,1) 22 + # define __release(x) __context__(x,-1) 23 + # define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) 24 + #else /* __CHECKER__ */ 25 + /* context/locking */ 26 + # define __must_hold(x) 27 + # define __acquires(x) 28 + # define __releases(x) 29 + # define __acquire(x) (void)0 30 + # define __release(x) (void)0 31 + # define __cond_lock(x,c) (c) 32 + #endif /* __CHECKER__ */ 33 + 16 34 /* Compiler specific macros. */ 17 35 #ifdef __GNUC__ 18 36 #include <linux/compiler-gcc.h>