Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1c3bea0e authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds
Browse files

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: default avatarOleg Nesterov <oleg@redhat.com>
Reported-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Reviewed-by: default avatarJosh Triplett <josh@joshtriplett.org>
Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 877aabd6
Loading
Loading
Loading
Loading
+13 −16
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
#define _LINUX_SIGNAL_H

#include <linux/list.h>
#include <linux/bug.h>
#include <uapi/linux/signal.h>

struct task_struct;
@@ -67,7 +68,6 @@ static inline int sigismember(sigset_t *set, int _sig)

static inline int sigisemptyset(sigset_t *set)
{
	extern void _NSIG_WORDS_is_unsupported_size(void);
	switch (_NSIG_WORDS) {
	case 4:
		return (set->sig[3] | set->sig[2] |
@@ -77,7 +77,7 @@ static inline int sigisemptyset(sigset_t *set)
	case 1:
		return set->sig[0] == 0;
	default:
		_NSIG_WORDS_is_unsupported_size();
		BUILD_BUG();
		return 0;
	}
}
@@ -90,7 +90,6 @@ static inline int sigisemptyset(sigset_t *set)
#define _SIG_SET_BINOP(name, op)					\
static inline void name(sigset_t *r, const sigset_t *a, const sigset_t *b) \
{									\
	extern void _NSIG_WORDS_is_unsupported_size(void);		\
	unsigned long a0, a1, a2, a3, b0, b1, b2, b3;			\
									\
	switch (_NSIG_WORDS) {						\
@@ -107,7 +106,7 @@ static inline void name(sigset_t *r, const sigset_t *a, const sigset_t *b) \
		r->sig[0] = op(a0, b0);					\
		break;							\
	default:							\
		_NSIG_WORDS_is_unsupported_size();			\
		BUILD_BUG();						\
	}								\
}

@@ -128,8 +127,6 @@ _SIG_SET_BINOP(sigandnsets, _sig_andn)
#define _SIG_SET_OP(name, op)						\
static inline void name(sigset_t *set)					\
{									\
	extern void _NSIG_WORDS_is_unsupported_size(void);		\
									\
	switch (_NSIG_WORDS) {						\
	case 4:	set->sig[3] = op(set->sig[3]);				\
		set->sig[2] = op(set->sig[2]);				\
@@ -137,7 +134,7 @@ static inline void name(sigset_t *set) \
	case 1:	set->sig[0] = op(set->sig[0]);				\
		    break;						\
	default:							\
		_NSIG_WORDS_is_unsupported_size();			\
		BUILD_BUG();						\
	}								\
}