#!/usr/bin/env bash # A host includes term.h and nothing else. The header compiles alone as # strict C11 and as C++, with only include/term on the include path. set -euo pipefail cd "${1:-$(dirname "$0")/..}" cc=${CC:-cc} cxx=${CXX:-c++} status=0 echo '#include "term.h"' | "$cc" -std=c11 -Wall -Wextra -Wpedantic -Werror \ -Iinclude/term -x c -fsyntax-only - || { echo "term.h: not valid C11" >&2; status=1; } if command -v "$cxx" >/dev/null; then echo '#include "term.h"' | "$cxx" -std=c++17 -Wall -Wextra -Wpedantic -Werror \ -Iinclude/term -x c++ -fsyntax-only - || { echo "term.h: not valid C++" >&2; status=1; } fi exit $status