| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: bug.h,v 1.1.2.5 2013/07/24 03:02:51 riastradh Exp $ */ | | 1 | /* $NetBSD: bug.h,v 1.1.2.6 2013/07/24 03:25:28 riastradh Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2013 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2013 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Taylor R. Campbell. | | 8 | * by Taylor R. Campbell. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -30,23 +30,30 @@ | | | @@ -30,23 +30,30 @@ |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #ifndef _ASM_BUG_H_ | | 32 | #ifndef _ASM_BUG_H_ |
33 | #define _ASM_BUG_H_ | | 33 | #define _ASM_BUG_H_ |
34 | | | 34 | |
35 | #include <sys/cdefs.h> | | 35 | #include <sys/cdefs.h> |
36 | #include <sys/systm.h> | | 36 | #include <sys/systm.h> |
37 | | | 37 | |
38 | #define BUG() panic("%s:%d: BUG!", __FILE__, __LINE__) | | 38 | #define BUG() panic("%s:%d: BUG!", __FILE__, __LINE__) |
39 | #define BUG_ON(CONDITION) KASSERT(!(CONDITION)) | | 39 | #define BUG_ON(CONDITION) KASSERT(!(CONDITION)) |
40 | | | 40 | |
41 | /* XXX Rate limit? */ | | 41 | /* XXX Rate limit? */ |
42 | #define WARN(CONDITION, FMT, ...) \ | | 42 | #define WARN(CONDITION, FMT, ...) \ |
43 | ((CONDITION)? \ | | 43 | linux_warning((CONDITION)? \ |
44 | (printf("warning: %s:%d: " FMT, __FILE__, __LINE__, \ | | 44 | (printf("warning: %s:%d: " FMT, __FILE__, __LINE__, \ |
45 | ##__VA_ARGS__), 1) \ | | 45 | ##__VA_ARGS__), 1) \ |
46 | : 0) | | 46 | : 0) |
47 | | | 47 | |
48 | #define WARN_ON(CONDITION) WARN(CONDITION, "%s\n", #CONDITION) | | 48 | #define WARN_ON(CONDITION) WARN(CONDITION, "%s\n", #CONDITION) |
49 | #define WARN_ON_SMP(CONDITION) WARN_ON(CONDITION) /* XXX */ | | 49 | #define WARN_ON_SMP(CONDITION) WARN_ON(CONDITION) /* XXX */ |
50 | #define WARN_ON_ONCE(CONDITION) WARN_ON(CONDITION) /* XXX */ | | 50 | #define WARN_ON_ONCE(CONDITION) WARN_ON(CONDITION) /* XXX */ |
51 | | | 51 | |
| | | 52 | /* XXX Kludge to avoid GCC warning about statements without effect. */ |
| | | 53 | static inline int |
| | | 54 | linux_warning(int x) |
| | | 55 | { |
| | | 56 | return x; |
| | | 57 | } |
| | | 58 | |
52 | #endif /* _ASM_BUG_H_ */ | | 59 | #endif /* _ASM_BUG_H_ */ |