diff options
author | Oleg Nesterov <oleg@redhat.com> | 2014-10-13 18:53:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-13 20:18:20 -0400 |
commit | 1c3bea0e71892ef9100c01d3799cdae8cac273ef (patch) | |
tree | 771d51ea718cd57af410cb7daebcd78aea809e38 /include/linux/signal.h | |
parent | 877aabd6ce16bc17cf62c2356b5d61f36454c1ed (diff) |
signal: use BUILD_BUG() instead of _NSIG_WORDS_is_unsupported_size()
Kill _NSIG_WORDS_is_unsupported_size(), use BUILD_BUG() instead. This
simplifies the code, avoids the nested-externs warnings, and this way we
do not defer the problem to linker.
Also, fix the indentation in _SIG_SET_BINOP() and _SIG_SET_OP().
Note: this patch assumes that the code like "if (0) BUILD_BUG();" is
valid. If not (say __compiletime_error() is not defined and thus
__compiletime_error_fallback() uses a negative array) we should fix
BUILD_BUG() and/or BUILD_BUG_ON_MSG(). This code should be fine by
definition, this is the documented purpose of BUILD_BUG().
[sfr@canb.auug.org.au: fix powerpc build failures]
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Reported-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/signal.h')
-rw-r--r-- | include/linux/signal.h | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/include/linux/signal.h b/include/linux/signal.h index 750196fcc0a5..ab1e0392b5ac 100644 --- a/include/linux/signal.h +++ b/include/linux/signal.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _LINUX_SIGNAL_H | 2 | #define _LINUX_SIGNAL_H |
3 | 3 | ||
4 | #include <linux/list.h> | 4 | #include <linux/list.h> |
5 | #include <linux/bug.h> | ||
5 | #include <uapi/linux/signal.h> | 6 | #include <uapi/linux/signal.h> |
6 | 7 | ||
7 | struct task_struct; | 8 | struct task_struct; |
@@ -67,7 +68,6 @@ static inline int sigismember(sigset_t *set, int _sig) | |||
67 | 68 | ||
68 | static inline int sigisemptyset(sigset_t *set) | 69 | static inline int sigisemptyset(sigset_t *set) |
69 | { | 70 | { |
70 | extern void _NSIG_WORDS_is_unsupported_size(void); | ||
71 | switch (_NSIG_WORDS) { | 71 | switch (_NSIG_WORDS) { |
72 | case 4: | 72 | case 4: |
73 | return (set->sig[3] | set->sig[2] | | 73 | return (set->sig[3] | set->sig[2] | |
@@ -77,7 +77,7 @@ static inline int sigisemptyset(sigset_t *set) | |||
77 | case 1: | 77 | case 1: |
78 | return set->sig[0] == 0; | 78 | return set->sig[0] == 0; |
79 | default: | 79 | default: |
80 | _NSIG_WORDS_is_unsupported_size(); | 80 | BUILD_BUG(); |
81 | return 0; | 81 | return 0; |
82 | } | 82 | } |
83 | } | 83 | } |
@@ -90,24 +90,23 @@ static inline int sigisemptyset(sigset_t *set) | |||
90 | #define _SIG_SET_BINOP(name, op) \ | 90 | #define _SIG_SET_BINOP(name, op) \ |
91 | static inline void name(sigset_t *r, const sigset_t *a, const sigset_t *b) \ | 91 | static inline void name(sigset_t *r, const sigset_t *a, const sigset_t *b) \ |
92 | { \ | 92 | { \ |
93 | extern void _NSIG_WORDS_is_unsupported_size(void); \ | ||
94 | unsigned long a0, a1, a2, a3, b0, b1, b2, b3; \ | 93 | unsigned long a0, a1, a2, a3, b0, b1, b2, b3; \ |
95 | \ | 94 | \ |
96 | switch (_NSIG_WORDS) { \ | 95 | switch (_NSIG_WORDS) { \ |
97 | case 4: \ | 96 | case 4: \ |
98 | a3 = a->sig[3]; a2 = a->sig[2]; \ | 97 | a3 = a->sig[3]; a2 = a->sig[2]; \ |
99 | b3 = b->sig[3]; b2 = b->sig[2]; \ | 98 | b3 = b->sig[3]; b2 = b->sig[2]; \ |
100 | r->sig[3] = op(a3, b3); \ | 99 | r->sig[3] = op(a3, b3); \ |
101 | r->sig[2] = op(a2, b2); \ | 100 | r->sig[2] = op(a2, b2); \ |
102 | case 2: \ | 101 | case 2: \ |
103 | a1 = a->sig[1]; b1 = b->sig[1]; \ | 102 | a1 = a->sig[1]; b1 = b->sig[1]; \ |
104 | r->sig[1] = op(a1, b1); \ | 103 | r->sig[1] = op(a1, b1); \ |
105 | case 1: \ | 104 | case 1: \ |
106 | a0 = a->sig[0]; b0 = b->sig[0]; \ | 105 | a0 = a->sig[0]; b0 = b->sig[0]; \ |
107 | r->sig[0] = op(a0, b0); \ | 106 | r->sig[0] = op(a0, b0); \ |
108 | break; \ | 107 | break; \ |
109 | default: \ | 108 | default: \ |
110 | _NSIG_WORDS_is_unsupported_size(); \ | 109 | BUILD_BUG(); \ |
111 | } \ | 110 | } \ |
112 | } | 111 | } |
113 | 112 | ||
@@ -128,16 +127,14 @@ _SIG_SET_BINOP(sigandnsets, _sig_andn) | |||
128 | #define _SIG_SET_OP(name, op) \ | 127 | #define _SIG_SET_OP(name, op) \ |
129 | static inline void name(sigset_t *set) \ | 128 | static inline void name(sigset_t *set) \ |
130 | { \ | 129 | { \ |
131 | extern void _NSIG_WORDS_is_unsupported_size(void); \ | ||
132 | \ | ||
133 | switch (_NSIG_WORDS) { \ | 130 | switch (_NSIG_WORDS) { \ |
134 | case 4: set->sig[3] = op(set->sig[3]); \ | 131 | case 4: set->sig[3] = op(set->sig[3]); \ |
135 | set->sig[2] = op(set->sig[2]); \ | 132 | set->sig[2] = op(set->sig[2]); \ |
136 | case 2: set->sig[1] = op(set->sig[1]); \ | 133 | case 2: set->sig[1] = op(set->sig[1]); \ |
137 | case 1: set->sig[0] = op(set->sig[0]); \ | 134 | case 1: set->sig[0] = op(set->sig[0]); \ |
138 | break; \ | 135 | break; \ |
139 | default: \ | 136 | default: \ |
140 | _NSIG_WORDS_is_unsupported_size(); \ | 137 | BUILD_BUG(); \ |
141 | } \ | 138 | } \ |
142 | } | 139 | } |
143 | 140 | ||