summaryrefslogtreecommitdiff
path: root/tests/t0014-preprocessing-phases.sh
blob: 5cc98c88559626d2aee28b64170555558e88ec80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
set -eu
src="${TMPDIR-/tmp}/mcpu-cpp-phases-$$.c"
out="${TMPDIR-/tmp}/mcpu-cpp-phases-$$.out"
trap 'rm -f "$src" "$out"' EXIT HUP INT TERM
cat > "$src" <<'EOT'
#defi\
ne VALUE 10\
20
/* comment */ VALUE // trailing comment
const char *s = "VALUE /* not a comment */";
EOT
"$MCPU_CPP" --no-config "$src" -o "$out"
grep '1020' "$out" >/dev/null
grep 'VALUE /\* not a comment \*/' "$out" >/dev/null
if grep 'trailing comment' "$out" >/dev/null; then
  exit 1
fi
if grep '/\* comment \*/' "$out" >/dev/null; then
  exit 1
fi