Implement --warning-mode in SETUP.sh. The value of the
argument can be either "pedantic" or "old" (actually, or anything else). In case of "pedantic" mode, use -ansi -pedantic compilation flags. Fix the build to compile in pedantic mode. (Version 3 of the patch, with after-review fixes)
This commit is contained in:
parent
44628436e5
commit
8cb1245c1e
207
BUILD/SETUP.sh
207
BUILD/SETUP.sh
@ -1,98 +1,128 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
|
||||||
|
get_key_value()
|
||||||
|
{
|
||||||
|
echo "$1" | sed 's/^--[a-zA-Z_-]*=//'
|
||||||
|
}
|
||||||
|
|
||||||
|
usage()
|
||||||
|
{
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $0 [-h|-n] [configure-options]
|
||||||
|
-h, --help Show this help message.
|
||||||
|
-n, --just-print Don't actually run any commands; just print them.
|
||||||
|
-c, --just-configure Stop after running configure.
|
||||||
|
--with-debug=full Build with full debug.
|
||||||
|
--warning-mode=[old|pedantic]
|
||||||
|
Influences the debug flags. Old is default.
|
||||||
|
--prefix=path Build with prefix 'path'.
|
||||||
|
|
||||||
|
Note: this script is intended for internal use by MySQL developers.
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
parse_options()
|
||||||
|
{
|
||||||
|
while test $# -gt 0
|
||||||
|
do
|
||||||
|
case "$1" in
|
||||||
|
--prefix=*)
|
||||||
|
prefix=`get_key_value "$1"`;;
|
||||||
|
--with-debug=full)
|
||||||
|
full_debug="=full";;
|
||||||
|
--warning-mode=*)
|
||||||
|
warning_mode=`get_key_value "$1"`;;
|
||||||
|
-c | --just-configure)
|
||||||
|
just_configure=1;;
|
||||||
|
-n | --just-print | --print)
|
||||||
|
just_print=1;;
|
||||||
|
-h | --help)
|
||||||
|
usage
|
||||||
|
exit 0;;
|
||||||
|
*)
|
||||||
|
echo "Unknown option '$1'"
|
||||||
|
exit 1;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
|
||||||
if ! test -f sql/mysqld.cc
|
if ! test -f sql/mysqld.cc
|
||||||
then
|
then
|
||||||
echo "You must run this script from the MySQL top-level directory"
|
echo "You must run this script from the MySQL top-level directory"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
prefix_configs="--prefix=/usr/local/mysql"
|
prefix="/usr/local/mysql"
|
||||||
just_print=
|
just_print=
|
||||||
just_configure=
|
just_configure=
|
||||||
full_debug=
|
full_debug=
|
||||||
|
warning_mode=
|
||||||
|
|
||||||
|
parse_options "$@"
|
||||||
|
|
||||||
if test -n "$MYSQL_BUILD_PREFIX"
|
if test -n "$MYSQL_BUILD_PREFIX"
|
||||||
then
|
then
|
||||||
prefix_configs="--prefix=$MYSQL_BUILD_PREFIX"
|
prefix="$MYSQL_BUILD_PREFIX"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while test $# -gt 0
|
|
||||||
do
|
|
||||||
case "$1" in
|
|
||||||
--prefix=* ) prefix_configs="$1"; shift ;;
|
|
||||||
--with-debug=full ) full_debug="=full"; shift ;;
|
|
||||||
-c | --just-configure ) just_configure=1; shift ;;
|
|
||||||
-n | --just-print | --print ) just_print=1; shift ;;
|
|
||||||
-h | --help ) cat <<EOF; exit 0 ;;
|
|
||||||
Usage: $0 [-h|-n] [configure-options]
|
|
||||||
-h, --help Show this help message.
|
|
||||||
-n, --just-print Don't actually run any commands; just print them.
|
|
||||||
-c, --just-configure Stop after running configure.
|
|
||||||
--with-debug=full Build with full debug.
|
|
||||||
--prefix=path Build with prefix 'path'.
|
|
||||||
|
|
||||||
Note: this script is intended for internal use by MySQL developers.
|
|
||||||
EOF
|
|
||||||
* )
|
|
||||||
echo "Unknown option '$1'"
|
|
||||||
exit 1
|
|
||||||
break ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
#
|
||||||
|
# Check for the CPU and set up CPU specific flags. We may reset them
|
||||||
|
# later.
|
||||||
|
#
|
||||||
|
path=`dirname $0`
|
||||||
|
. "$path/check-cpu"
|
||||||
|
|
||||||
export AM_MAKEFLAGS
|
export AM_MAKEFLAGS
|
||||||
AM_MAKEFLAGS="-j 4"
|
AM_MAKEFLAGS="-j 4"
|
||||||
|
|
||||||
# SSL library to use.
|
# SSL library to use.
|
||||||
SSL_LIBRARY=--with-yassl
|
SSL_LIBRARY=--with-yassl
|
||||||
|
|
||||||
# If you are not using codefusion add "-Wpointer-arith" to WARNINGS
|
if [ "x$warning_mode" != "xpedantic" ]; then
|
||||||
# The following warning flag will give too many warnings:
|
# Both C and C++ warnings
|
||||||
# -Wshadow -Wunused -Winline (The later isn't usable in C++ as
|
warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W"
|
||||||
# __attribute()__ doesn't work with gnu C++)
|
warnings="$warnings -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare"
|
||||||
|
warnings="$warnings -Wwrite-strings"
|
||||||
global_warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings"
|
# C warnings
|
||||||
c_warnings="$global_warnings -Wunused"
|
c_warnings="$warnings -Wunused"
|
||||||
cxx_warnings="$global_warnings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
|
# C++ warnings
|
||||||
base_max_configs="--with-innodb --with-berkeley-db --with-ndbcluster --with-archive-storage-engine --with-big-tables --with-blackhole-storage-engine --with-federated-storage-engine --with-csv-storage-engine --with-example-storage-engine --with-partition $SSL_LIBRARY"
|
cxx_warnings="$warnings -Woverloaded-virtual -Wsign-promo -Wreorder"
|
||||||
base_max_no_ndb_configs="--with-innodb --with-berkeley-db --without-ndbcluster --with-archive-storage-engine --with-big-tables --with-blackhole-storage-engine --with-federated-storage-engine --with-csv-storage-engine --with-example-storage-engine --with-partition $SSL_LIBRARY"
|
cxx_warnings="$warnings -Wctor-dtor-privacy -Wnon-virtual-dtor"
|
||||||
max_configs="$base_max_configs --with-embedded-server"
|
# Added unless --with-debug=full
|
||||||
max_no_ndb_configs="$base_max_no_ndb_configs --with-embedded-server"
|
|
||||||
valgrind_flags="-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify -DMYSQL_SERVER_SUFFIX=-valgrind-max"
|
|
||||||
|
|
||||||
path=`dirname $0`
|
|
||||||
. "$path/check-cpu"
|
|
||||||
|
|
||||||
alpha_cflags="$check_cpu_cflags -Wa,-m$cpu_flag"
|
|
||||||
amd64_cflags="$check_cpu_cflags"
|
|
||||||
pentium_cflags="$check_cpu_cflags"
|
|
||||||
pentium64_cflags="$check_cpu_cflags -m64"
|
|
||||||
ppc_cflags="$check_cpu_cflags"
|
|
||||||
sparc_cflags=""
|
|
||||||
|
|
||||||
# be as fast as we can be without losing our ability to backtrace
|
|
||||||
fast_cflags="-O3 -fno-omit-frame-pointer"
|
|
||||||
# this is one is for someone who thinks 1% speedup is worth not being
|
|
||||||
# able to backtrace
|
|
||||||
reckless_cflags="-O3 -fomit-frame-pointer "
|
|
||||||
|
|
||||||
debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX"
|
|
||||||
debug_extra_cflags="-O1 -Wuninitialized"
|
debug_extra_cflags="-O1 -Wuninitialized"
|
||||||
|
else
|
||||||
|
warnings="-W -Wall -ansi -pedantic -Wno-long-long -D_POSIX_SOURCE"
|
||||||
|
c_warnings="$warnings"
|
||||||
|
cxx_warnings="$warnings -std=c++98"
|
||||||
|
# NOTE: warning mode should not influence optimize/debug mode.
|
||||||
|
# Please feel free to add a separate option if you don't feel it's an overkill.
|
||||||
|
debug_extra_flags="-O0"
|
||||||
|
# Reset CPU flags (-mtune), they don't work in -pedantic mode
|
||||||
|
check_cpu_cflags=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set flags for various build configurations.
|
||||||
|
# Used in -valgrind builds
|
||||||
|
valgrind_flags="-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify "
|
||||||
|
valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
|
||||||
|
#
|
||||||
|
# Used in -debug builds
|
||||||
|
debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS "
|
||||||
|
debug_cflags="$debug_cflags -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX"
|
||||||
|
#
|
||||||
|
# Base C++ flags for all builds
|
||||||
base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti"
|
base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti"
|
||||||
amd64_cxxflags="" # If dropping '--with-big-tables', add here "-DBIG_TABLES"
|
#
|
||||||
|
# Flags for optimizing builds.
|
||||||
base_configs="$prefix_configs --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-readline --with-big-tables"
|
# Be as fast as we can be without losing our ability to backtrace.
|
||||||
static_link="--with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static"
|
fast_cflags="-O3 -fno-omit-frame-pointer"
|
||||||
amd64_configs=""
|
|
||||||
alpha_configs="" # Not used yet
|
|
||||||
pentium_configs=""
|
|
||||||
sparc_configs=""
|
|
||||||
# we need local-infile in all binaries for rpl000001
|
|
||||||
# if you need to disable local-infile in the client, write a build script
|
|
||||||
# and unset local_infile_configs
|
|
||||||
local_infile_configs="--enable-local-infile"
|
|
||||||
|
|
||||||
debug_configs="--with-debug$full_debug"
|
debug_configs="--with-debug$full_debug"
|
||||||
if [ -z "$full_debug" ]
|
if [ -z "$full_debug" ]
|
||||||
@ -100,6 +130,45 @@ then
|
|||||||
debug_cflags="$debug_cflags $debug_extra_cflags"
|
debug_cflags="$debug_cflags $debug_extra_cflags"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Configuration options.
|
||||||
|
#
|
||||||
|
base_configs="--prefix=$prefix --enable-assembler "
|
||||||
|
base_configs="$base_configs --with-extra-charsets=complex "
|
||||||
|
base_configs="$base_configs --enable-thread-safe-client --with-readline "
|
||||||
|
base_configs="$base_configs --with-big-tables"
|
||||||
|
|
||||||
|
static_link="--with-mysqld-ldflags=-all-static "
|
||||||
|
static_link="$static_link --with-client-ldflags=-all-static"
|
||||||
|
# we need local-infile in all binaries for rpl000001
|
||||||
|
# if you need to disable local-infile in the client, write a build script
|
||||||
|
# and unset local_infile_configs
|
||||||
|
local_infile_configs="--enable-local-infile"
|
||||||
|
|
||||||
|
|
||||||
|
max_configs="--with-innodb --with-berkeley-db"
|
||||||
|
max_configs="$max_configs --with-archive-storage-engine"
|
||||||
|
max_configs="$max_configs --with-big-tables"
|
||||||
|
max_configs="$max_configs --with-blackhole-storage-engine"
|
||||||
|
max_configs="$max_configs --with-federated-storage-engine"
|
||||||
|
max_configs="$max_configs --with-csv-storage-engine"
|
||||||
|
max_configs="$max_configs --with-example-storage-engine"
|
||||||
|
max_configs="$max_configs --with-partition $SSL_LIBRARY"
|
||||||
|
|
||||||
|
max_no_embedded_configs="$max_configs --with-ndbcluster"
|
||||||
|
max_no_ndb_configs="$max_configs --without-ndbcluster --with-embedded-server"
|
||||||
|
max_configs="$max_configs --with-ndbcluster --with-embedded-server"
|
||||||
|
|
||||||
|
#
|
||||||
|
# CPU and platform specific compilation flags.
|
||||||
|
#
|
||||||
|
alpha_cflags="$check_cpu_cflags -Wa,-m$cpu_flag"
|
||||||
|
amd64_cflags="$check_cpu_cflags"
|
||||||
|
amd64_cxxflags="" # If dropping '--with-big-tables', add here "-DBIG_TABLES"
|
||||||
|
pentium64_cflags="$check_cpu_cflags -m64"
|
||||||
|
ppc_cflags="$check_cpu_cflags"
|
||||||
|
sparc_cflags=""
|
||||||
|
|
||||||
if gmake --version > /dev/null 2>&1
|
if gmake --version > /dev/null 2>&1
|
||||||
then
|
then
|
||||||
make=gmake
|
make=gmake
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
path=`dirname $0`
|
path=`dirname $0`
|
||||||
. "$path/SETUP.sh" $@ --with-debug=full
|
. "$path/SETUP.sh" "$@" --with-debug=full
|
||||||
|
|
||||||
extra_flags="$pentium_cflags $debug_cflags"
|
extra_flags="$pentium_cflags $debug_cflags"
|
||||||
extra_configs="$pentium_configs $debug_configs $max_configs"
|
extra_configs="$pentium_configs $debug_configs $max_configs"
|
||||||
|
@ -4,6 +4,6 @@ path=`dirname $0`
|
|||||||
. "$path/SETUP.sh"
|
. "$path/SETUP.sh"
|
||||||
|
|
||||||
extra_flags="$pentium_cflags $debug_cflags"
|
extra_flags="$pentium_cflags $debug_cflags"
|
||||||
extra_configs="$pentium_configs $debug_configs $base_max_configs"
|
extra_configs="$pentium_configs $debug_configs $max_no_embedded_configs"
|
||||||
|
|
||||||
. "$path/FINISH.sh"
|
. "$path/FINISH.sh"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
path=`dirname $0`
|
path=`dirname $0`
|
||||||
. "$path/SETUP.sh"
|
. "$path/SETUP.sh" "$@"
|
||||||
|
|
||||||
extra_flags="$pentium_cflags $debug_cflags $valgrind_flags"
|
extra_flags="$pentium_cflags $debug_cflags $valgrind_flags"
|
||||||
extra_configs="$pentium_configs $debug_configs $max_configs"
|
extra_configs="$pentium_configs $debug_configs $max_configs"
|
||||||
|
@ -917,7 +917,7 @@ typedef unsigned long uint32; /* Short for unsigned integer >= 32 bits */
|
|||||||
#error "Neither int or long is of 4 bytes width"
|
#error "Neither int or long is of 4 bytes width"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(HAVE_ULONG) && !defined(TARGET_OS_LINUX) && !defined(__USE_MISC)
|
#if !defined(HAVE_ULONG) && !defined(__USE_MISC)
|
||||||
typedef unsigned long ulong; /* Short for unsigned long */
|
typedef unsigned long ulong; /* Short for unsigned long */
|
||||||
#endif
|
#endif
|
||||||
#ifndef longlong_defined
|
#ifndef longlong_defined
|
||||||
|
Loading…
x
Reference in New Issue
Block a user