summaryrefslogtreecommitdiff
path: root/BUILD
diff options
context:
space:
mode:
authorDavi Arnaut <Davi.Arnaut@Sun.COM>2010-07-02 15:30:47 -0300
committerDavi Arnaut <Davi.Arnaut@Sun.COM>2010-07-02 15:30:47 -0300
commit93fb8bb23544a4b5b2a4a6e43e1c25d74ca9a6f0 (patch)
tree9706ada08fda4adc5e2f9cf90b41b72442c15849 /BUILD
parent6d5b440126aa44f838410c11fdf8cadb8df1e04f (diff)
downloadmariadb-git-93fb8bb23544a4b5b2a4a6e43e1c25d74ca9a6f0.tar.gz
Bug#53445: Build with -Wall and fix warnings that it generates
Apart strict-aliasing warnings, fix the remaining warnings generated by GCC 4.4.4 -Wall and -Wextra flags. One major source of warnings was the in-house function my_bcmp which (unconventionally) took pointers to unsigned characters as the byte sequences to be compared. Since my_bcmp and bcmp are deprecated functions whose only difference with memcmp is the return value, every use of the function is replaced with memcmp as the special return value wasn't actually being used by any caller. There were also various other warnings, mostly due to type mismatches, missing return values, missing prototypes, dead code (unreachable) and ignored return values.
Diffstat (limited to 'BUILD')
-rwxr-xr-xBUILD/SETUP.sh13
-rwxr-xr-xBUILD/check-cpu23
2 files changed, 18 insertions, 18 deletions
diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh
index 626f932e045..08ae4de2e23 100755
--- a/BUILD/SETUP.sh
+++ b/BUILD/SETUP.sh
@@ -90,22 +90,19 @@ SSL_LIBRARY=--with-ssl
if [ "x$warning_mode" != "xpedantic" ]; then
# Both C and C++ warnings
- warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W"
- warnings="$warnings -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare"
- warnings="$warnings -Wwrite-strings -Wunused-function -Wunused-label -Wunused-value -Wunused-variable"
+ warnings="-Wall -Wextra -Wunused -Wwrite-strings"
# For more warnings, uncomment the following line
-# warnings="$global_warnings -Wshadow"
+# warnings="$warnings -Wshadow"
# C warnings
- c_warnings="$warnings -Wunused-parameter"
+ c_warnings="$warnings"
# C++ warnings
- cxx_warnings="$warnings"
+ cxx_warnings="$warnings -Wno-unused-parameter"
# cxx_warnings="$cxx_warnings -Woverloaded-virtual -Wsign-promo"
- cxx_warnings="$cxx_warnings -Wreorder"
cxx_warnings="$cxx_warnings -Wctor-dtor-privacy -Wnon-virtual-dtor"
# Added unless --with-debug=full
- debug_extra_cflags="-O0 -g3 -gdwarf-2" #1 -Wuninitialized"
+ debug_extra_cflags="-O0 -g3 -gdwarf-2"
else
warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -D_POSIX_SOURCE"
c_warnings="$warnings"
diff --git a/BUILD/check-cpu b/BUILD/check-cpu
index c0e87a675cb..390ba545405 100755
--- a/BUILD/check-cpu
+++ b/BUILD/check-cpu
@@ -181,14 +181,17 @@ check_cpu () {
cc=$CC
fi
- cc_ver=`$cc --version | sed 1q`
- cc_verno=`echo $cc_ver | sed -e 's/^.*(GCC)//g; s/[^0-9. ]//g; s/^ *//g; s/ .*//g'`
- set -- `echo $cc_verno | tr '.' ' '`
- cc_major=$1
- cc_minor=$2
- cc_patch=$3
- cc_comp=`expr $cc_major '*' 100 '+' $cc_minor`
-
+ # check if compiler is gcc and dump its version
+ cc_verno=`$cc -dumpversion 2>/dev/null`
+ if test "x$?" = "x0" ; then
+ set -- `echo $cc_verno | tr '.' ' '`
+ cc_ver="GCC"
+ cc_major=$1
+ cc_minor=$2
+ cc_patch=$3
+ cc_comp=`expr $cc_major '*' 100 '+' $cc_minor`
+ fi
+
case "$cc_ver--$cc_verno" in
*GCC*)
# different gcc backends (and versions) have different CPU flags
@@ -229,7 +232,7 @@ check_cpu () {
fi
while [ "$cpu_arg" ] ; do
printf "testing $cpu_arg ... " >&2
-
+
# compile check
eval "$cc -c $check_cpu_cflags __test.c" 2>/dev/null
if test "x$?" = "x0" ; then
@@ -243,5 +246,5 @@ check_cpu () {
done
rm __test.*
}
-
+
check_cpu