File: check-private-headers

package info (click to toggle)
qpdf 12.3.2-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 72,660 kB
  • sloc: cpp: 59,054; perl: 12,189; ansic: 6,809; sh: 1,231; python: 1,041; xml: 43; makefile: 42
file content (35 lines) | stat: -rwxr-xr-x 903 bytes parent folder | download
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
#!/bin/bash
set -eo pipefail
cd "$(dirname $0)/.."

trap "rm -f a.cc" EXIT
declare -a pheaders
cd libqpdf
for i in qpdf/*.hh; do
    if [[ ! $i =~ .*auto_.* ]] && ! grep -q >/dev/null 2>&1 QPDFOBJECT_OLD_HH $i; then
        pheaders+=($i)
    fi
done
cd ..
# Make sure each header file can be included in isolation and that the
# result can be compiled with the version of the C++ standard used by the qpdf project, currently C++-20.
declare -a perrors
for i in "${pheaders[@]}"; do
    rm -f a.cc
    cat > a.cc <<EOF
#include "$i"
int main() { return 0; }
EOF
    echo "Checking $i"
    if ! g++ -std=c++20 -pedantic-errors -c -Iinclude -Ilibqpdf -Ibuild/libqpdf a.cc -o /dev/null; then
        perrors+=("$i doesn't compile")
    fi
done
if [[ ${#perrors[@]} -gt 0 ]]; then
    echo ""
    echo "Some header files had errors"
    for i in "${perrors[@]}"; do
        echo "$i"
    done
    exit 2
fi