diff options
author | Matthew Wilcox <mawilcox@microsoft.com> | 2016-12-19 17:07:17 +0100 |
---|---|---|
committer | Matthew Wilcox <mawilcox@microsoft.com> | 2017-01-28 03:29:39 +0100 |
commit | b246a9d2671f4f6cfab3f98199568e0b3028f6e5 (patch) | |
tree | b8ae5d681acf9e8bf66ff49143440fd34f5cdd5c /tools/include/asm | |
parent | radix tree test suite: Remove duplicate bitops code (diff) | |
download | linux-b246a9d2671f4f6cfab3f98199568e0b3028f6e5.tar.xz linux-b246a9d2671f4f6cfab3f98199568e0b3028f6e5.zip |
tools: Provide a definition of WARN_ON
The definition of WARN_ON being used by the radix tree test suite was
deficient in two ways: it did not provide a return value, and it stopped
execution instead of continuing. This version of WARN_ON tells you
which file & line the assertion was triggered in.
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
Diffstat (limited to 'tools/include/asm')
-rw-r--r-- | tools/include/asm/bug.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/include/asm/bug.h b/tools/include/asm/bug.h index beda1a884b50..4790f047a89c 100644 --- a/tools/include/asm/bug.h +++ b/tools/include/asm/bug.h @@ -12,6 +12,14 @@ unlikely(__ret_warn_on); \ }) +#define WARN_ON(condition) ({ \ + int __ret_warn_on = !!(condition); \ + if (unlikely(__ret_warn_on)) \ + __WARN_printf("assertion failed at %s:%d\n", \ + __FILE__, __LINE__); \ + unlikely(__ret_warn_on); \ +}) + #define WARN_ON_ONCE(condition) ({ \ static int __warned; \ int __ret_warn_once = !!(condition); \ |