From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7798 Path: news.gmane.org!not-for-mail From: Shiz Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH] add unused flag check arguments to toolchain flag detection Date: Thu, 28 May 2015 04:50:10 +0200 Message-ID: <1432781410-7914-1-git-send-email-hi@shiz.me> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------2.3.6" X-Trace: ger.gmane.org 1432781449 7163 80.91.229.3 (28 May 2015 02:50:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 28 May 2015 02:50:49 +0000 (UTC) Cc: Shiz To: musl@lists.openwall.com Original-X-From: musl-return-7810-gllmg-musl=m.gmane.org@lists.openwall.com Thu May 28 04:50:48 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1YxnuB-0000Ns-GG for gllmg-musl@m.gmane.org; Thu, 28 May 2015 04:50:47 +0200 Original-Received: (qmail 14155 invoked by uid 550); 28 May 2015 02:50:45 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 14124 invoked from network); 28 May 2015 02:50:40 -0000 X-Virus-Scanned: amavisd-new at shiz.me X-Mailer: git-send-email 2.4.1 Xref: news.gmane.org gmane.linux.lib.musl.general:7798 Archived-At: This is a multi-part message in MIME format. --------------2.3.6 Content-Type: text/plain; charset=UTF-8; format=fixed Content-Transfer-Encoding: 8bit this checks whether -Werror=unknown-warning-option and -Werror=unused-command-line-argument are supported by the toolchain. if so, it adds those flags to the tryflag and tryldflag checks in ./configure. so far only clang supports these flags, but clang is also the only toolchain I've encountered that ignores unrecognized arguments instead of erroring out. --- configure | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) --------------2.3.6 Content-Type: text/x-patch; name="0001-add-unused-flag-check-arguments-to-toolchain-flag-de.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="0001-add-unused-flag-check-arguments-to-toolchain-flag-de.patch" diff --git a/configure b/configure index 143dc92..08acef0 100755 --- a/configure +++ b/configure @@ -80,7 +80,7 @@ fi tryflag () { printf "checking whether compiler accepts %s... " "$2" echo "typedef int x;" > "$tmpc" -if $CC $2 -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then +if $CC $CFLAGS_TRY $2 -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then printf "yes\n" eval "$1=\"\${$1} \$2\"" eval "$1=\${$1# }" @@ -94,7 +94,7 @@ fi tryldflag () { printf "checking whether linker accepts %s... " "$2" echo "typedef int x;" > "$tmpc" -if $CC -nostdlib -shared "$2" -o /dev/null "$tmpc" >/dev/null 2>&1 ; then +if $CC $LDFLAGS_TRY -nostdlib -shared "$2" -o /dev/null "$tmpc" >/dev/null 2>&1 ; then printf "yes\n" eval "$1=\"\${$1} \$2\"" eval "$1=\${$1# }" @@ -113,7 +113,9 @@ CFLAGS_C99FSE= CFLAGS_AUTO= CFLAGS_MEMOPS= CFLAGS_NOSSP= +CFLAGS_TRY= LDFLAGS_AUTO= +LDFLAGS_TRY= OPTIMIZE_GLOBS= prefix=/usr/local/musl exec_prefix='$(prefix)' @@ -205,6 +207,14 @@ exit 1 fi # +# Figure out options to force errors on unknown flags. +# +tryflag CFLAGS_TRY -Werror=unknown-warning-option +tryflag CFLAGS_TRY -Werror=unused-command-line-argument +tryldflag LDFLAGS_TRY -Wl,-Werror=unknown-warning-option +tryldflag LDFLAGS_TRY -Wl,-Werror=unused-command-line-argument + +# # Need to know if the compiler is gcc to decide whether to build the # musl-gcc wrapper, and for critical bug detection in some gcc versions. # --------------2.3.6--