1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
#!/bin/bash
# This script checks that each installed public and private XRootD header can
# be included individually without errors. The intention is to identify which
# headers may have missing includes, missing forward declarations, or missing
# header dependencies, that is, headers from XRootD which it includes, but were
# not installed by the install target.
# We need to split CXXFLAGS
# shellcheck disable=SC2086
: "${CXX:=c++}"
: "${CXXFLAGS:=-std=c++17 -Wall -Wextra -Wno-unused-parameter}"
: "${INCLUDE_DIR:=${1:-/usr/include/xrootd}}"
if ! command -v "${CXX}" >/dev/null; then
exit 1
fi
STATUS=0
HEADERS=$(find "${INCLUDE_DIR}" -type f -name '*.hh')
PUBLIC_HEADERS=$(grep -E -v '(XrdPosix|private)' <<< "${HEADERS}")
PRIVATE_HEADERS=$(grep private <<< "${HEADERS}")
# Check public headers without adding private include directory.
# This ensures public headers do not depend on any private headers.
while IFS=$'\n' read -r HEADER; do
"${CXX}" -fsyntax-only ${CXXFLAGS} -I"${INCLUDE_DIR}" "${HEADER}" || STATUS=1
done <<< "${PUBLIC_HEADERS}"
# Check private headers
while IFS=$'\n' read -r HEADER; do
"${CXX}" -fsyntax-only ${CXXFLAGS} -I"${INCLUDE_DIR}"{,/private} "${HEADER}" || STATUS=1
done <<< "${PRIVATE_HEADERS}"
exit $STATUS
|