From: mathieu.desnoyers@efficios.com (Mathieu Desnoyers)
Subject: [lttng-dev] [PATCH 03/19] lttng: BUILD_RUNTIME_BUG_ON
Date: Sat, 26 Nov 2011 10:03:28 -0500 [thread overview]
Message-ID: <1322319824-6529-4-git-send-email-mathieu.desnoyers@efficios.com> (raw)
In-Reply-To: <1322319824-6529-3-git-send-email-mathieu.desnoyers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
drivers/staging/lttng/lib/bug.h | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
create mode 100644 drivers/staging/lttng/lib/bug.h
diff --git a/drivers/staging/lttng/lib/bug.h b/drivers/staging/lttng/lib/bug.h
new file mode 100644
index 0000000..8243cc9
--- /dev/null
+++ b/drivers/staging/lttng/lib/bug.h
@@ -0,0 +1,29 @@
+#ifndef _LTTNG_BUG_H
+#define _LTTNG_BUG_H
+
+/*
+ * lib/bug.h
+ *
+ * (C) Copyright 2010-2011 - Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
+ *
+ * Dual LGPL v2.1/GPL v2 license.
+ */
+
+/**
+ * BUILD_RUNTIME_BUG_ON - check condition at build (if constant) or runtime
+ * @condition: the condition which should be false.
+ *
+ * If the condition is a constant and true, the compiler will generate a build
+ * error. If the condition is not constant, a BUG will be triggered at runtime
+ * if the condition is ever true. If the condition is constant and false, no
+ * code is emitted.
+ */
+#define BUILD_RUNTIME_BUG_ON(condition) \
+ do { \
+ if (__builtin_constant_p(condition)) \
+ BUILD_BUG_ON(condition); \
+ else \
+ BUG_ON(condition); \
+ } while (0)
+
+#endif
--
1.7.2.5
next prev parent reply other threads:[~2011-11-26 15:03 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-26 15:03 [lttng-dev] LTTng driver submission for inclusion in staging (resend) Mathieu Desnoyers
2011-11-26 15:03 ` [lttng-dev] [PATCH 01/19] lttng lib: ring buffer Mathieu Desnoyers
2011-11-26 15:03 ` [lttng-dev] [PATCH 02/19] lttng lib: portable bitfield read/write header Mathieu Desnoyers
2011-11-26 15:03 ` Mathieu Desnoyers [this message]
2011-11-26 15:03 ` [lttng-dev] [PATCH 04/19] lttng: offset alignment header Mathieu Desnoyers
2011-11-26 15:03 ` [lttng-dev] [PATCH 05/19] lttng libs: add Makefile Mathieu Desnoyers
2011-11-26 15:03 ` [lttng-dev] [PATCH 06/19] lttng wrappers Mathieu Desnoyers
2011-11-26 15:03 ` [lttng-dev] [PATCH 07/19] lttng instrumentation: tracepoint events Mathieu Desnoyers
2011-11-26 15:03 ` [lttng-dev] [PATCH 08/19] lttng: syscall instrumentation Mathieu Desnoyers
2011-11-26 15:03 ` [lttng-dev] [PATCH 09/19] lttng: lib ring buffer clients Mathieu Desnoyers
2011-11-26 15:03 ` [lttng-dev] [PATCH 10/19] lttng: tracer control and core structures Mathieu Desnoyers
2011-11-26 15:03 ` [lttng-dev] [PATCH 11/19] lttng: dynamically selectable context information Mathieu Desnoyers
2011-11-26 15:03 ` [lttng-dev] [PATCH 12/19] lttng: timing calibration feature Mathieu Desnoyers
2011-11-26 15:03 ` [lttng-dev] [PATCH 13/19] lttng: debugfs and procfs ABI Mathieu Desnoyers
2011-11-26 15:03 ` [lttng-dev] [PATCH 14/19] lttng: Add documentation and license files Mathieu Desnoyers
2011-11-26 15:03 ` [lttng-dev] [PATCH 15/19] lttng: add system call instrumentation probe Mathieu Desnoyers
2011-11-26 15:03 ` [lttng-dev] [PATCH 16/19] lttng: probe callbacks Mathieu Desnoyers
2011-11-26 15:03 ` [lttng-dev] [PATCH 17/19] lttng: toplevel Makefile and Kconfig Mathieu Desnoyers
2011-11-26 15:03 ` [lttng-dev] [PATCH 18/19] staging: add LTTng to build Mathieu Desnoyers
2011-11-26 15:03 ` [lttng-dev] [PATCH 19/19] Add LTTng entry to MAINTAINERS file Mathieu Desnoyers
2011-11-27 2:24 ` [lttng-dev] [PATCH 14/19] lttng: Add documentation and license files Greg KH
2011-11-27 10:04 ` Mathieu Desnoyers
2011-11-27 2:28 ` [lttng-dev] LTTng driver submission for inclusion in staging (resend) Greg KH
2011-11-27 10:07 ` Mathieu Desnoyers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1322319824-6529-4-git-send-email-mathieu.desnoyers@efficios.com \
--to=mathieu.desnoyers@efficios.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox