mirror of https://github.com/OpenTTD/OpenTTD
(svn r16424) -Codechange: warn about casting-out 'const' only when using gcc4+, older versions give many useless false positives
parent
168ae6f7e2
commit
9355d1d169
|
@ -1103,7 +1103,7 @@ make_cflags_and_ldflags() {
|
||||||
if [ $cc_version -ge 29 ]; then
|
if [ $cc_version -ge 29 ]; then
|
||||||
CFLAGS="$CFLAGS -Wall -Wno-multichar -Wsign-compare -Wundef"
|
CFLAGS="$CFLAGS -Wall -Wno-multichar -Wsign-compare -Wundef"
|
||||||
CFLAGS="$CFLAGS -Wwrite-strings -Wpointer-arith"
|
CFLAGS="$CFLAGS -Wwrite-strings -Wpointer-arith"
|
||||||
CFLAGS="$CFLAGS -Wno-uninitialized -Wcast-qual"
|
CFLAGS="$CFLAGS -Wno-uninitialized"
|
||||||
|
|
||||||
CC_CFLAGS="$CC_CFLAGS -Wstrict-prototypes"
|
CC_CFLAGS="$CC_CFLAGS -Wstrict-prototypes"
|
||||||
fi
|
fi
|
||||||
|
@ -1148,19 +1148,22 @@ make_cflags_and_ldflags() {
|
||||||
LIBS="$LIBS -lws2_32 -lwinmm -lgdi32 -ldxguid -lole32"
|
LIBS="$LIBS -lws2_32 -lwinmm -lgdi32 -ldxguid -lole32"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $cc_version -ge 40 ]; then
|
||||||
# GCC 4.0+ complains about that we break strict-aliasing.
|
# GCC 4.0+ complains about that we break strict-aliasing.
|
||||||
# On most places we don't see how to fix it, and it doesn't
|
# On most places we don't see how to fix it, and it doesn't
|
||||||
# break anything. So disable strict-aliasing to make the
|
# break anything. So disable strict-aliasing to make the
|
||||||
# compiler all happy.
|
# compiler all happy.
|
||||||
if [ $cc_version -ge 40 ]; then
|
|
||||||
CFLAGS="$CFLAGS -fno-strict-aliasing"
|
CFLAGS="$CFLAGS -fno-strict-aliasing"
|
||||||
|
# Warn about casting-out 'const' with regular C-style cast.
|
||||||
|
# The preferred way is const_cast<>() which doesn't warn.
|
||||||
|
CFLAGS="$CFLAGS -Wcast-qual"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $cc_version -ge 42 ]; then
|
||||||
# GCC 4.2+ automatically assumes that signed overflows do
|
# GCC 4.2+ automatically assumes that signed overflows do
|
||||||
# not occur in signed arithmetics, whereas we are not
|
# not occur in signed arithmetics, whereas we are not
|
||||||
# sure that they will not happen. It furthermore complains
|
# sure that they will not happen. It furthermore complains
|
||||||
# about it's own optimized code in some places.
|
# about it's own optimized code in some places.
|
||||||
if [ $cc_version -ge 42 ]; then
|
|
||||||
CFLAGS="$CFLAGS -fno-strict-overflow"
|
CFLAGS="$CFLAGS -fno-strict-overflow"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue