blob: 0947c07137fc2f2a27f890ab235136351aebe73d (
plain)
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
40
41
42
43
44
|
#!/bin/sh
set -eu
base="${TMPDIR-/tmp}/mcpu-cpp-system-lang-$$"
mkdir -p "$base/system/diff" "$base/system/as"
trap 'rm -rf "$base"' EXIT HUP INT TERM
cat > "$base/test.conf" <<EOT
MCPU_CPP_SYSTEM_INCLUDE_PATH = $base/system;
EOT
cat > "$base/system/common.h" <<'EOT'
common_system_header
EOT
cat > "$base/system/diff/lang.h" <<'EOT'
diff_system_header
EOT
cat > "$base/system/as/lang.h" <<'EOT'
as_system_header
EOT
cat > "$base/system/diff/explicit.h" <<'EOT'
explicit_diff_system_header
EOT
cat > "$base/main.c" <<'EOT'
#include <common.h>
#lang "diff"
#include <lang.h>
#endlang
#lang "as"
#include <lang.h>
#include <diff/explicit.h>
#endlang
EOT
"$MCPU_CPP" --config-file "$base/test.conf" "$base/main.c" -o "$base/out"
grep '^common_system_header$' "$base/out" >/dev/null
grep '^diff_system_header$' "$base/out" >/dev/null
grep '^as_system_header$' "$base/out" >/dev/null
grep '^explicit_diff_system_header$' "$base/out" >/dev/null
if "$MCPU_CPP" --config-file "$base/test.conf" -nostdinc "$base/main.c" -o "$base/no" 2>/dev/null; then
exit 1
fi
|