Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf4755a2

Browse files
committed
Make cpluspluscheck more portable.
Teach it to scrape -I and -D switches from CPPFLAGS in Makefile.global.This is useful for testing on, eg, FreeBSD, where you won't get farwithout "-I/usr/local/include".Also, expand the set of blacklisted-for-unportability atomics headers,based on noting that arch-x86.h fails to compile on an ARM box. Theother ones I'd omitted seem to compile all right on architectures theydon't belong to, but that's surely too shaky to rely on. Let's dolike we did for the src/include/port/ headers, and ignore all exceptthe variant that's pulled in by the arch-independent header.
1 parent032627e commitf4755a2

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

‎src/tools/pginclude/cpluspluscheck

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,23 @@ fi
2424

2525
me=`basename$0`
2626

27+
# These switches are g++ specific, you may override if necessary.
28+
CXXFLAGS=${CXXFLAGS:- -fsyntax-only -Wall}
29+
2730
# Pull some info from configure's results.
2831
MGLOB="$builddir/src/Makefile.global"
32+
CPPFLAGS=`sed -n's/^CPPFLAGS[ ]*=[ ]*//p'"$MGLOB"`
2933
CXX=`sed -n's/^CXX[ ]*=[ ]*//p'"$MGLOB"`
3034
perl_includespec=`sed -n's/^perl_includespec[ ]*=[ ]*//p'"$MGLOB"`
3135
python_includespec=`sed -n's/^python_includespec[ ]*=[ ]*//p'"$MGLOB"`
3236

33-
# These switches are g++ specific, you may override if necessary.
34-
CXXFLAGS=${CXXFLAGS:- -fsyntax-only -Wall}
37+
# Extract any -I and -D switches from CPPFLAGS.
38+
# (If necessary, user can pass more switches by presetting EXTRAFLAGS.)
39+
forflagin$CPPFLAGS;do
40+
case$flagin
41+
-I*|-D*) EXTRAFLAGS="$EXTRAFLAGS$flag";;
42+
esac
43+
done
3544

3645
# Create temp directory.
3746
tmp=`mktemp -d /tmp/$me.XXXXXX`
@@ -65,11 +74,16 @@ do
6574
# Likewise, these files are platform-specific, and the one
6675
# relevant to our platform will be included by atomics.h.
6776
test"$f" = src/include/port/atomics/arch-arm.h&&continue
77+
test"$f" = src/include/port/atomics/arch-hppa.h&&continue
78+
test"$f" = src/include/port/atomics/arch-ia64.h&&continue
79+
test"$f" = src/include/port/atomics/arch-ppc.h&&continue
80+
test"$f" = src/include/port/atomics/arch-x86.h&&continue
6881
test"$f" = src/include/port/atomics/fallback.h&&continue
6982
test"$f" = src/include/port/atomics/generic.h&&continue
7083
test"$f" = src/include/port/atomics/generic-acc.h&&continue
7184
test"$f" = src/include/port/atomics/generic-gcc.h&&continue
7285
test"$f" = src/include/port/atomics/generic-msvc.h&&continue
86+
test"$f" = src/include/port/atomics/generic-sunpro.h&&continue
7387
test"$f" = src/include/port/atomics/generic-xlc.h&&continue
7488

7589
# rusagestub.h is also platform-specific, and will be included
@@ -145,6 +159,6 @@ do
145159
${CXX:-g++} -I$builddir -I$srcdir \
146160
-I$builddir/src/include -I$srcdir/src/include \
147161
-I$builddir/src/interfaces/libpq -I$srcdir/src/interfaces/libpq \
148-
$EXTRAINCLUDES$CXXFLAGS -c$tmp/test.cpp
162+
$EXTRAINCLUDES$EXTRAFLAGS$CXXFLAGS -c$tmp/test.cpp
149163

150164
done

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp