blob: f8d5401353d71a6379d7c9f522d577e42c07c649 (
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
|
?RCS: $Id: cpp_trad.U 167 2013-05-08 17:58:00Z rmanfredi $
?RCS:
?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
?RCS:
?RCS: You may redistribute only under the terms of the Artistic License,
?RCS: as specified in the README file that comes with the distribution.
?RCS: You may reuse parts of this distribution only within the terms of
?RCS: that same Artistic License; a copy of which may be found at the root
?RCS: of the source tree for dist 4.0.
?RCS:
?RCS: $Log: cpp_stuff.U,v $
?MAKE:cpp_trad: cpp cat contains rm
?MAKE: -pick add $@ %<
?S:cpp_trad:
?S: This variable contains the program to run to get traditional C
?S: preprocessor semantics and not ISO C semantics: we want something
?S: that knows as little about C as possible to use as a more general
?S: purpose preprocessor.
?S:.
?F:!foo.c !foo.cpp
: how do we get traditional cpp semantics?
echo " "
echo "Checking to see how to get traditional cpp semantics..." >&4
$cat >foo.c <<'EOF'
#define A(x) x
#define B(y) y
A(a)B(b)
EOF
if $cpp foo.c >foo.cpp; $contains ab foo.cpp >/dev/null 2>&1; then
echo "Plain '$cpp' works just fine."
cpp_trad="$cpp"
elif $cpp -traditional foo.c >foo.cpp; \
$contains ab foo.cpp >/dev/null 2>&1; then
echo "We'll use '$cpp -traditional' to get proper semantics."
cpp_trad="$cpp -traditional"
else
echo "I don't know how to get traditional semantics with '$cpp'." >&4
cpp_trad="$cpp"
fi
$rm -f foo.c foo.cpp
|