libthr: Use CLI flags instead of pragmas to disable warnings

People tweaking the build system or compilers tend to look into
the Makefile and not into the source.  Having some warning controls
in the Makefile and some in the source code is surprising.

Pragmas have the advantage that they leave the warnings enabled
for more code, but that advantage isn't very relevant in these cases.

Requested by:	kib
Reviewed by:	kib
MFC after:	3 days
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D10832
This commit is contained in:
Eric van Gyzen 2017-05-20 17:33:47 +00:00
parent d71b289766
commit 0b2f3f2058
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=318584
3 changed files with 6 additions and 21 deletions

View File

@ -27,6 +27,12 @@ CFLAGS+=-I${SRCTOP}/libexec/rtld-elf/${MACHINE_CPUARCH}
CFLAGS+=-I${SRCTOP}/lib/libthread_db
CFLAGS+=-Winline
CFLAGS.thr_stack.c+= -Wno-cast-align
.include <bsd.compiler.mk>
.if !(${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} < 40300)
CFLAGS.thr_symbols.c+= -Wno-missing-variable-declarations
.endif
.ifndef NO_THREAD_UNWIND_STACK
CFLAGS+=-fexceptions
CFLAGS+=-D_PTHREAD_FORCED_UNWIND

View File

@ -290,19 +290,6 @@ _thr_stack_alloc(struct pthread_attr *attr)
return (-1);
}
/*
* Disable this warning from clang:
*
* cast from 'char *' to
* 'struct stack *' increases required alignment from 1 to 8
* [-Werror,-Wcast-align]
* spare_stack = (struct stack *)
*/
#ifdef __clang__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
#endif
/* This function must be called with _thread_list_lock held. */
void
_thr_stack_free(struct pthread_attr *attr)
@ -329,7 +316,3 @@ _thr_stack_free(struct pthread_attr *attr)
attr->stackaddr_attr = NULL;
}
}
#ifdef __clang__
#pragma GCC diagnostic pop
#endif

View File

@ -37,10 +37,6 @@ __FBSDID("$FreeBSD$");
#include "thr_private.h"
#ifdef __clang__
#pragma GCC diagnostic ignored "-Wmissing-variable-declarations"
#endif
/* A collection of symbols needed by debugger */
/* int _libthr_debug */