mirror of
https://github.com/postgres/postgres.git
synced 2025-05-06 19:59:18 +03:00
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 far without "-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. The other ones I'd omitted seem to compile all right on architectures they don't belong to, but that's surely too shaky to rely on. Let's do like we did for the src/include/port/ headers, and ignore all except the variant that's pulled in by the arch-independent header.
This commit is contained in:
parent
032627ee78
commit
f4755a2c01
@ -24,14 +24,23 @@ fi
|
||||
|
||||
me=`basename $0`
|
||||
|
||||
# These switches are g++ specific, you may override if necessary.
|
||||
CXXFLAGS=${CXXFLAGS:- -fsyntax-only -Wall}
|
||||
|
||||
# Pull some info from configure's results.
|
||||
MGLOB="$builddir/src/Makefile.global"
|
||||
CPPFLAGS=`sed -n 's/^CPPFLAGS[ ]*=[ ]*//p' "$MGLOB"`
|
||||
CXX=`sed -n 's/^CXX[ ]*=[ ]*//p' "$MGLOB"`
|
||||
perl_includespec=`sed -n 's/^perl_includespec[ ]*=[ ]*//p' "$MGLOB"`
|
||||
python_includespec=`sed -n 's/^python_includespec[ ]*=[ ]*//p' "$MGLOB"`
|
||||
|
||||
# These switches are g++ specific, you may override if necessary.
|
||||
CXXFLAGS=${CXXFLAGS:- -fsyntax-only -Wall}
|
||||
# Extract any -I and -D switches from CPPFLAGS.
|
||||
# (If necessary, user can pass more switches by presetting EXTRAFLAGS.)
|
||||
for flag in $CPPFLAGS; do
|
||||
case $flag in
|
||||
-I*|-D*) EXTRAFLAGS="$EXTRAFLAGS $flag";;
|
||||
esac
|
||||
done
|
||||
|
||||
# Create temp directory.
|
||||
tmp=`mktemp -d /tmp/$me.XXXXXX`
|
||||
@ -65,11 +74,16 @@ do
|
||||
# Likewise, these files are platform-specific, and the one
|
||||
# relevant to our platform will be included by atomics.h.
|
||||
test "$f" = src/include/port/atomics/arch-arm.h && continue
|
||||
test "$f" = src/include/port/atomics/arch-hppa.h && continue
|
||||
test "$f" = src/include/port/atomics/arch-ia64.h && continue
|
||||
test "$f" = src/include/port/atomics/arch-ppc.h && continue
|
||||
test "$f" = src/include/port/atomics/arch-x86.h && continue
|
||||
test "$f" = src/include/port/atomics/fallback.h && continue
|
||||
test "$f" = src/include/port/atomics/generic.h && continue
|
||||
test "$f" = src/include/port/atomics/generic-acc.h && continue
|
||||
test "$f" = src/include/port/atomics/generic-gcc.h && continue
|
||||
test "$f" = src/include/port/atomics/generic-msvc.h && continue
|
||||
test "$f" = src/include/port/atomics/generic-sunpro.h && continue
|
||||
test "$f" = src/include/port/atomics/generic-xlc.h && continue
|
||||
|
||||
# rusagestub.h is also platform-specific, and will be included
|
||||
@ -145,6 +159,6 @@ do
|
||||
${CXX:-g++} -I $builddir -I $srcdir \
|
||||
-I $builddir/src/include -I $srcdir/src/include \
|
||||
-I $builddir/src/interfaces/libpq -I $srcdir/src/interfaces/libpq \
|
||||
$EXTRAINCLUDES $CXXFLAGS -c $tmp/test.cpp
|
||||
$EXTRAINCLUDES $EXTRAFLAGS $CXXFLAGS -c $tmp/test.cpp
|
||||
|
||||
done
|
||||
|
Loading…
x
Reference in New Issue
Block a user