Message ID | 20140919172030.GA22293@redhat.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
On Fri, Sep 19, 2014 at 07:20:30PM +0200, Oleg Nesterov wrote: > On 09/19, Richard Weinberger wrote: > > > > Am 19.09.2014 17:37, schrieb Jeff Kirsher: > > > > > > See patch 1 of the series. > > > > I was not CC'ed... > > Me too, and thus I don't understand this patch. > > But I have to admit it looks a bit ugly to me anyway. > Can't we simply kill _NSIG_WORDS_is_unsupported_size ? This looks quite preferable. Can you post that with a commit message and signoff? Also, the indentation on the second of the three BUILD_BUG calls has some spaces in it, which it shouldn't. With those fixed: Reviewed-by: Josh Triplett <josh@joshtriplett.org> > diff --git a/include/linux/signal.h b/include/linux/signal.h > index 750196f..679c9b4 100644 > --- a/include/linux/signal.h > +++ b/include/linux/signal.h > @@ -67,7 +67,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 +76,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 +89,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 +105,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 +126,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 +133,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(); \ > } \ > } > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-sparse" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Sep 19, 2014, at 2:21 PM, Josh Triplett <josh@joshtriplett.org> wrote: > On Fri, Sep 19, 2014 at 07:20:30PM +0200, Oleg Nesterov wrote: >> On 09/19, Richard Weinberger wrote: >>> >>> Am 19.09.2014 17:37, schrieb Jeff Kirsher: >>>> >>>> See patch 1 of the series. >>> >>> I was not CC'ed... >> >> Me too, and thus I don't understand this patch. >> >> But I have to admit it looks a bit ugly to me anyway. >> Can't we simply kill _NSIG_WORDS_is_unsupported_size ? > > This looks quite preferable. Can you post that with a commit message > and signoff? Also, the indentation on the second of the three BUILD_BUG > calls has some spaces in it, which it shouldn't. With those fixed: > Reviewed-by: Josh Triplett <josh@joshtriplett.org> I haven't tried this patch myself yet, but assuming that it works, it is a far better way to go. >> diff --git a/include/linux/signal.h b/include/linux/signal.h >> index 750196f..679c9b4 100644 >> --- a/include/linux/signal.h >> +++ b/include/linux/signal.h >> @@ -67,7 +67,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 +76,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 +89,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 +105,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 +126,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 +133,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(); \ >> } \ >> }
On 09/19, Josh Triplett wrote: > > On Fri, Sep 19, 2014 at 07:20:30PM +0200, Oleg Nesterov wrote: > > > But I have to admit it looks a bit ugly to me anyway. > > Can't we simply kill _NSIG_WORDS_is_unsupported_size ? > > This looks quite preferable. Can you post that with a commit message > and signoff? OK, please see 1/1. > Also, the indentation on the second of the three BUILD_BUG > calls has some spaces in it, which it shouldn't. Yes, thanks, and it makes sense to also fix the indentation. > With those fixed: > Reviewed-by: Josh Triplett <josh@joshtriplett.org> Thanks. Could you ack it again? I didn't preserve your ack because it seems that BUILD_BUG() and/or BUILD_BUG_ON_MSG() deserve some cleanups... For example, if (0) BUILD_BUG(); can't be compiled if __compiletime_error_fallback() falls back to a negative-size array (see the changelog). But I think that the code above must be correct by definition, see the comment and the original changelog (1399ff86f2a2 "kernel.h: add BUILD_BUG() macro"). So if this patch breaks the compilation with some compiler/version we should update include/linux/compiler-xxx.h or fix BUILD_BUG(). Oleg. include/linux/signal.h | 28 ++++++++++++---------------- 1 files changed, 12 insertions(+), 16 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/include/linux/signal.h b/include/linux/signal.h index 750196f..679c9b4 100644 --- a/include/linux/signal.h +++ b/include/linux/signal.h @@ -67,7 +67,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 +76,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 +89,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 +105,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 +126,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 +133,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(); \ } \ }