#
0f037c78 |
| 19-Jan-2018 |
Sascha Wildner <saw@online.de> |
libthread_xu: Fix issues detected by gcc80.
The changes to <pthread.h> all deal with -Wnonnull-compare warnings, which are issued when a function has a NULL check for a parameter that at the same ti
libthread_xu: Fix issues detected by gcc80.
The changes to <pthread.h> all deal with -Wnonnull-compare warnings, which are issued when a function has a NULL check for a parameter that at the same time is marked with __attribute__((nonnull(...))), aka __nonnull(...).
Such __nonnull() decoration only ever catches those cases where NULL is passed directly to the function, but not any more indirect ways. What makes matters worse is that in higher optimization levels (-O >= 2), GCC will happily optimize out any NULL checks within the function for these parameters.
This means that __nonnull() is generally inferior to a direct NULL check in the function itself and if we have both, which newer GCCs warn about with -Wnonnull-compare (that is part of -Wall), we should remove the __nonnull().
This commit does that for all parameters which our libthread_xu checks directly in the function. What remains are __nonnull() for parameters which are _not_ checked in the functions, to at least catch cases where NULL is passed directly. We should think about adding real checks for those parameters too.
While here, add a "/* FALLTHROUGH */" comment in thr_printf.c which fixes a -Wimplicit-fallthrough warning.
show more ...
|