diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2010-08-29 18:24:22 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2010-08-30 14:36:07 +0200 |
commit | 5baf5ae9bdc5538e44805e520068badf6f546958 (patch) | |
tree | 2330d82c16bbe0931f9e17d6e5694190c4ddc0b3 /include/common.h | |
parent | 12f396a8b02e57f579d2863299948b5172ffdf6f (diff) | |
download | barebox-5baf5ae9bdc5538e44805e520068badf6f546958.tar.gz barebox-5baf5ae9bdc5538e44805e520068badf6f546958.tar.xz |
add WARN_ON and WARN support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/common.h')
-rw-r--r-- | include/common.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/common.h b/include/common.h index 0edc778095..64f49db387 100644 --- a/include/common.h +++ b/include/common.h @@ -56,6 +56,31 @@ } while (0) #define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0) + +#define __WARN() do { \ + printf("WARNING: at %s:%d/%s()!\n", __FILE__, __LINE__, __FUNCTION__); \ +} while (0) + +#ifndef WARN_ON +#define WARN_ON(condition) ({ \ + int __ret_warn_on = !!(condition); \ + if (unlikely(__ret_warn_on)) \ + __WARN(); \ + unlikely(__ret_warn_on); \ +}) +#endif + +#ifndef WARN +#define WARN(condition, format...) ({ \ + int __ret_warn_on = !!(condition); \ + if (unlikely(__ret_warn_on)) \ + __WARN(); \ + puts("WARNING: "); \ + printf(format); \ + unlikely(__ret_warn_on); \ +}) +#endif + typedef void (interrupt_handler_t)(void *); #include <asm/barebox.h> /* boot information for Linux kernel */ |