aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/wrap-compiler-for-flag-check25
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/wrap-compiler-for-flag-check b/scripts/wrap-compiler-for-flag-check
new file mode 100755
index 0000000..6fa77f0
--- /dev/null
+++ b/scripts/wrap-compiler-for-flag-check
@@ -0,0 +1,25 @@
1#!/bin/sh
2
3# From kmcallister:
4# https://github.com/kmcallister/autoharden/blob/efaf5a16612589808c276a11536ea9a47071f74b/scripts/wrap-compiler-for-flag-check
5
6# There is no way to make clang's "argument unused" warning fatal. So when
7# configure checks for supported flags, it runs $CC, $CXX, $LD via this
8# wrapper.
9#
10# Ideally the search string would also include 'clang: ' but this output might
11# depend on clang's argv[0].
12
13if out=`"$@" 2>&1`; then
14 echo "$out"
15 if echo "$out" | grep 'warning: argument unused' >/dev/null; then
16 echo "$0: found clang warning"
17 exit 1
18 else
19 exit 0
20 fi
21else
22 code=$?
23 echo "$out"
24 exit $code
25fi