Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 May 2017 17:33:47 +0000 (UTC)
From:      Eric van Gyzen <vangyzen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r318584 - in head/lib/libthr: . thread
Message-ID:  <201705201733.v4KHXlT6031332@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: vangyzen
Date: Sat May 20 17:33:47 2017
New Revision: 318584
URL: https://svnweb.freebsd.org/changeset/base/318584

Log:
  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

Modified:
  head/lib/libthr/Makefile
  head/lib/libthr/thread/thr_stack.c
  head/lib/libthr/thread/thr_symbols.c

Modified: head/lib/libthr/Makefile
==============================================================================
--- head/lib/libthr/Makefile	Sat May 20 17:32:30 2017	(r318583)
+++ head/lib/libthr/Makefile	Sat May 20 17:33:47 2017	(r318584)
@@ -27,6 +27,12 @@ CFLAGS+=-I${SRCTOP}/libexec/rtld-elf/${M
 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

Modified: head/lib/libthr/thread/thr_stack.c
==============================================================================
--- head/lib/libthr/thread/thr_stack.c	Sat May 20 17:32:30 2017	(r318583)
+++ head/lib/libthr/thread/thr_stack.c	Sat May 20 17:33:47 2017	(r318584)
@@ -290,19 +290,6 @@ _thr_stack_alloc(struct pthread_attr *at
 		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 *att
 		attr->stackaddr_attr = NULL;
 	}
 }
-
-#ifdef __clang__
-#pragma GCC diagnostic pop
-#endif

Modified: head/lib/libthr/thread/thr_symbols.c
==============================================================================
--- head/lib/libthr/thread/thr_symbols.c	Sat May 20 17:32:30 2017	(r318583)
+++ head/lib/libthr/thread/thr_symbols.c	Sat May 20 17:33:47 2017	(r318584)
@@ -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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705201733.v4KHXlT6031332>