#!/usr/bin/env bash
# diag-build: a tool showing enabled warnings in a project.
#
# diag-build acts as a wrapper for 'diagtool show-enabled', in the same way
# that scan-build acts as a wrapper for the static analyzer. The common case is
# simple: use 'diag-build make' or 'diag-build xcodebuild' to list the warnings
# enabled for the first compilation command we see. Other build systems require
# you to manually specify "dry-run" and "use $CC and $CXX"; if there is a build
# system you are interested in, please add it to the switch statement.
# Mac OS X's BSD sed uses -E for extended regular expressions,
# but GNU sed uses -r. Find out which one this system accepts.
EXTENDED_SED_FLAG='-E'
| || EXTENDED_SED_FLAG='-r'
if ; then
verbose=
fi
guessing_cc=0
if ; then
guessing_cc=1
if ; then
CC=
/clangelif ; then
CC=
else
fi
fi
if ; then
if ; then
CXX=
/clang++elif ; then
CXX=
else
CXX=
fi
fi
diagtool=
if ; then
if ; then
diagtool=
/diagtoolelse
fi
fi
tool=
if ; then
elif ; then
dry_run='-dry-run'
set_compiler="CC=' ' CXX=' '"
elif ; then
dry_run='-n'
set_compiler="CC=' ' CXX=' '"
else
if ; then
# FIXME: We really only need $CC /or/ $CXX
fi
fi
escCC=
escCXX=
command=
if ; then
if ; then
# xcodebuild always echoes the compile commands on their own line,
# but other tools give no such guarantees.
fi
fi
# Chop off trailing '&&', '||', and ';'
command=
command=
command=
&&