From c40157d87ef0b585a90ff5230fdf69cddc824d7f Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Mon, 1 Jun 2020 20:53:42 -0400 Subject: [PATCH] suppress unwanted warnings when configuring with clang coding style warnings enabled by default in clang have long been a source of spurious questions/bug-reports. since clang provides a -w that behaves differently from gcc's, and that lets us enable any warnings we may actually want after turning them all off to start with a clean slate, use it at configure time if clang is detected. --- configure | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/configure b/configure index a2728969..43598825 100755 --- a/configure +++ b/configure @@ -494,6 +494,13 @@ fnmatch '-march=*|*\ -march=*' "$CC $CFLAGS" || tryldflag CFLAGS_AUTO -march=i48 fnmatch '-mtune=*|*\ -mtune=*' "$CC $CFLAGS" || tryldflag CFLAGS_AUTO -mtune=generic fi +# +# GCC defines -w as overriding any -W options, regardless of order, but +# clang has a bunch of annoying warnings enabled by default and needs -w +# to start from a clean slate. So use -w if building with clang. +# +test "$cc_family" = clang && tryflag CFLAGS_AUTO -w + # # Even with -std=c99, gcc accepts some constructs which are constraint # violations. We want to treat these as errors regardless of whether