2004-11-03 11:39:38 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2006-04-07 00:25:59 +02:00
|
|
|
########################################################################
|
|
|
|
|
|
|
|
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.
|
2010-07-24 15:31:48 +02:00
|
|
|
--warning-mode=[old|pedantic|maintainer]
|
2006-04-07 00:25:59 +02:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
|
2006-08-30 23:20:01 +02:00
|
|
|
if test ! -f sql/mysqld.cc
|
2001-01-31 02:43:16 +01:00
|
|
|
then
|
2000-12-18 22:24:19 +01:00
|
|
|
echo "You must run this script from the MySQL top-level directory"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2006-04-07 00:25:59 +02:00
|
|
|
prefix="/usr/local/mysql"
|
2003-10-08 20:50:05 +02:00
|
|
|
just_print=
|
2001-03-04 22:34:26 +01:00
|
|
|
just_configure=
|
2004-10-04 13:43:16 +02:00
|
|
|
full_debug=
|
2006-04-07 00:25:59 +02:00
|
|
|
warning_mode=
|
2010-07-24 15:31:48 +02:00
|
|
|
maintainer_mode=
|
2006-04-07 00:25:59 +02:00
|
|
|
|
|
|
|
parse_options "$@"
|
|
|
|
|
2005-09-28 17:04:08 +02:00
|
|
|
if test -n "$MYSQL_BUILD_PREFIX"
|
2005-09-17 03:10:36 +02:00
|
|
|
then
|
2006-04-07 00:25:59 +02:00
|
|
|
prefix="$MYSQL_BUILD_PREFIX"
|
2005-09-17 03:10:36 +02:00
|
|
|
fi
|
|
|
|
|
2001-01-31 02:43:16 +01:00
|
|
|
set -e
|
|
|
|
|
2006-04-07 00:25:59 +02:00
|
|
|
#
|
|
|
|
# Check for the CPU and set up CPU specific flags. We may reset them
|
|
|
|
# later.
|
|
|
|
#
|
|
|
|
path=`dirname $0`
|
|
|
|
. "$path/check-cpu"
|
|
|
|
|
2001-01-31 02:43:16 +01:00
|
|
|
export AM_MAKEFLAGS
|
2008-11-05 16:40:23 +01:00
|
|
|
AM_MAKEFLAGS="-j 6"
|
2000-12-18 22:24:19 +01:00
|
|
|
|
2006-05-17 13:59:37 +02:00
|
|
|
# SSL library to use.--with-ssl will select our bundled yaSSL
|
|
|
|
# implementation of SSL. To use openSSl you will nee too point out
|
|
|
|
# the location of openSSL headers and lbs on your system.
|
|
|
|
# Ex --with-ssl=/usr
|
|
|
|
SSL_LIBRARY=--with-ssl
|
2005-11-02 14:45:25 +01:00
|
|
|
|
2010-07-24 15:31:48 +02:00
|
|
|
if [ "x$warning_mode" = "xpedantic" ]; then
|
|
|
|
warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -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_cflags="-O0"
|
|
|
|
# Reset CPU flags (-mtune), they don't work in -pedantic mode
|
|
|
|
check_cpu_cflags=""
|
|
|
|
elif [ "x$warning_mode" = "xmaintainer" ]; then
|
|
|
|
c_warnings="-Wall -Wextra"
|
|
|
|
cxx_warnings="$c_warnings -Wno-unused-parameter"
|
|
|
|
maintainer_mode="--enable-mysql-maintainer-mode"
|
|
|
|
debug_extra_cflags="-g3"
|
|
|
|
else
|
2006-04-07 00:25:59 +02:00
|
|
|
# Both C and C++ warnings
|
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.
BUILD/SETUP.sh:
Remove flags that are implied by -Wall and -Wextra.
Do not warn about unused parameters in C++.
BUILD/check-cpu:
Print only the compiler version instead of verbose banner.
Although the option is gcc specific, the check was only
being used for GCC specific checks anyway.
client/mysql.cc:
bcmp is no longer defined.
client/mysqltest.cc:
Pass a string to function expecting a format string.
Replace use of bcmp with memcmp.
cmd-line-utils/readline/Makefile.am:
Always define _GNU_SOURCE when compiling GNU readline.
Required to make certain prototypes visible.
cmd-line-utils/readline/input.c:
Condition for the code to be meaningful.
configure.in:
Remove check for bcmp.
extra/comp_err.c:
Use appropriate type.
extra/replace.c:
Replace use of bcmp with memcmp.
extra/yassl/src/crypto_wrapper.cpp:
Do not ignore the return value of fgets. Retrieve the file
position if fgets succeed -- if it fails, the function will
bail out and return a error.
extra/yassl/taocrypt/include/blowfish.hpp:
Use a single array instead of accessing positions of the sbox_
through a subscript to pbox_.
extra/yassl/taocrypt/include/runtime.hpp:
One definition of such functions is enough.
extra/yassl/taocrypt/src/aes.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/algebra.cpp:
Rename arguments to avoid shadowing related warnings.
extra/yassl/taocrypt/src/blowfish.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/integer.cpp:
Do not define type within a anonymous union.
Use a variable to return a value instead of
leaving the result in a register -- compiler
does not know the logic inside the asm.
extra/yassl/taocrypt/src/misc.cpp:
Define handler for pure virtual functions.
Remove unused code.
extra/yassl/taocrypt/src/twofish.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/testsuite/test.hpp:
Function must have C language linkage.
include/m_string.h:
Remove check which relied on bcmp being defined -- they weren't
being used as bcmp is only visible when _BSD_SOURCE is defined.
include/my_bitmap.h:
Remove bogus helpers which were used only in a few files and
were causing warnings about dead code.
include/my_global.h:
Due to G++ bug, always silence false-positive uninitialized
variables warnings when compiling C++ code with G++.
Remove bogus helper.
libmysql/Makefile.shared:
Remove built-in implementation of bcmp.
mysql-test/lib/My/SafeProcess/safe_process.cc:
Cast pid to largest possible type for a process identifier.
mysys/mf_loadpath.c:
Leave space of the ending nul.
mysys/mf_pack.c:
Replace bcmp with memcmp.
mysys/my_bitmap.c:
Dead code removal.
mysys/my_gethwaddr.c:
Remove unused variable.
mysys/my_getopt.c:
Silence bogus uninitialized variable warning.
Do not cast away the constant qualifier.
mysys/safemalloc.c:
Cast to expected type.
mysys/thr_lock.c:
Silence bogus uninitialized variable warning.
sql/field.cc:
Replace bogus helper with a more appropriate logic which is
used throughout the code.
sql/item.cc:
Remove bogus logical condition which always evaluates to TRUE.
sql/item_create.cc:
Simplify code to avoid signedness related warnings.
sql/log_event.cc:
Replace use of bcmp with memcmp.
No need to use helpers for simple bit operations.
sql/log_event_old.cc:
Replace bmove_align with memcpy.
sql/mysqld.cc:
Move use declaration of variable to the ifdef block where it
is used. Remove now-unnecessary casts and arguments.
sql/set_var.cc:
Replace bogus helpers with simple and classic bit operations.
sql/slave.cc:
Cast to expected type and silence bogus warning.
sql/sql_class.h:
Don't use enum values as bit flags, the supposed type safety is
bogus as the combined bit flags are not a value in the enumeration.
sql/udf_example.c:
Only declare variable when necessary.
sql/unireg.h:
Replace use of bmove_align with memcpy.
storage/innobase/os/os0file.c:
Silence bogus warning.
storage/myisam/mi_open.c:
Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
char.
storage/myisam/mi_page.c:
Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
char.
strings/bcmp.c:
Remove built-in bcmp.
strings/ctype-ucs2.c:
Silence bogus warning.
tests/mysql_client_test.c:
Use a appropriate type as expected by simple_command().
2010-07-02 20:30:47 +02:00
|
|
|
warnings="-Wall -Wextra -Wunused -Wwrite-strings"
|
2005-11-02 14:45:25 +01:00
|
|
|
|
2006-12-14 23:51:37 +01:00
|
|
|
# For more warnings, uncomment the following line
|
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.
BUILD/SETUP.sh:
Remove flags that are implied by -Wall and -Wextra.
Do not warn about unused parameters in C++.
BUILD/check-cpu:
Print only the compiler version instead of verbose banner.
Although the option is gcc specific, the check was only
being used for GCC specific checks anyway.
client/mysql.cc:
bcmp is no longer defined.
client/mysqltest.cc:
Pass a string to function expecting a format string.
Replace use of bcmp with memcmp.
cmd-line-utils/readline/Makefile.am:
Always define _GNU_SOURCE when compiling GNU readline.
Required to make certain prototypes visible.
cmd-line-utils/readline/input.c:
Condition for the code to be meaningful.
configure.in:
Remove check for bcmp.
extra/comp_err.c:
Use appropriate type.
extra/replace.c:
Replace use of bcmp with memcmp.
extra/yassl/src/crypto_wrapper.cpp:
Do not ignore the return value of fgets. Retrieve the file
position if fgets succeed -- if it fails, the function will
bail out and return a error.
extra/yassl/taocrypt/include/blowfish.hpp:
Use a single array instead of accessing positions of the sbox_
through a subscript to pbox_.
extra/yassl/taocrypt/include/runtime.hpp:
One definition of such functions is enough.
extra/yassl/taocrypt/src/aes.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/algebra.cpp:
Rename arguments to avoid shadowing related warnings.
extra/yassl/taocrypt/src/blowfish.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/integer.cpp:
Do not define type within a anonymous union.
Use a variable to return a value instead of
leaving the result in a register -- compiler
does not know the logic inside the asm.
extra/yassl/taocrypt/src/misc.cpp:
Define handler for pure virtual functions.
Remove unused code.
extra/yassl/taocrypt/src/twofish.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/testsuite/test.hpp:
Function must have C language linkage.
include/m_string.h:
Remove check which relied on bcmp being defined -- they weren't
being used as bcmp is only visible when _BSD_SOURCE is defined.
include/my_bitmap.h:
Remove bogus helpers which were used only in a few files and
were causing warnings about dead code.
include/my_global.h:
Due to G++ bug, always silence false-positive uninitialized
variables warnings when compiling C++ code with G++.
Remove bogus helper.
libmysql/Makefile.shared:
Remove built-in implementation of bcmp.
mysql-test/lib/My/SafeProcess/safe_process.cc:
Cast pid to largest possible type for a process identifier.
mysys/mf_loadpath.c:
Leave space of the ending nul.
mysys/mf_pack.c:
Replace bcmp with memcmp.
mysys/my_bitmap.c:
Dead code removal.
mysys/my_gethwaddr.c:
Remove unused variable.
mysys/my_getopt.c:
Silence bogus uninitialized variable warning.
Do not cast away the constant qualifier.
mysys/safemalloc.c:
Cast to expected type.
mysys/thr_lock.c:
Silence bogus uninitialized variable warning.
sql/field.cc:
Replace bogus helper with a more appropriate logic which is
used throughout the code.
sql/item.cc:
Remove bogus logical condition which always evaluates to TRUE.
sql/item_create.cc:
Simplify code to avoid signedness related warnings.
sql/log_event.cc:
Replace use of bcmp with memcmp.
No need to use helpers for simple bit operations.
sql/log_event_old.cc:
Replace bmove_align with memcpy.
sql/mysqld.cc:
Move use declaration of variable to the ifdef block where it
is used. Remove now-unnecessary casts and arguments.
sql/set_var.cc:
Replace bogus helpers with simple and classic bit operations.
sql/slave.cc:
Cast to expected type and silence bogus warning.
sql/sql_class.h:
Don't use enum values as bit flags, the supposed type safety is
bogus as the combined bit flags are not a value in the enumeration.
sql/udf_example.c:
Only declare variable when necessary.
sql/unireg.h:
Replace use of bmove_align with memcpy.
storage/innobase/os/os0file.c:
Silence bogus warning.
storage/myisam/mi_open.c:
Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
char.
storage/myisam/mi_page.c:
Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
char.
strings/bcmp.c:
Remove built-in bcmp.
strings/ctype-ucs2.c:
Silence bogus warning.
tests/mysql_client_test.c:
Use a appropriate type as expected by simple_command().
2010-07-02 20:30:47 +02:00
|
|
|
# warnings="$warnings -Wshadow"
|
2007-01-27 02:46:45 +01:00
|
|
|
|
2006-04-07 00:25:59 +02:00
|
|
|
# C warnings
|
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.
BUILD/SETUP.sh:
Remove flags that are implied by -Wall and -Wextra.
Do not warn about unused parameters in C++.
BUILD/check-cpu:
Print only the compiler version instead of verbose banner.
Although the option is gcc specific, the check was only
being used for GCC specific checks anyway.
client/mysql.cc:
bcmp is no longer defined.
client/mysqltest.cc:
Pass a string to function expecting a format string.
Replace use of bcmp with memcmp.
cmd-line-utils/readline/Makefile.am:
Always define _GNU_SOURCE when compiling GNU readline.
Required to make certain prototypes visible.
cmd-line-utils/readline/input.c:
Condition for the code to be meaningful.
configure.in:
Remove check for bcmp.
extra/comp_err.c:
Use appropriate type.
extra/replace.c:
Replace use of bcmp with memcmp.
extra/yassl/src/crypto_wrapper.cpp:
Do not ignore the return value of fgets. Retrieve the file
position if fgets succeed -- if it fails, the function will
bail out and return a error.
extra/yassl/taocrypt/include/blowfish.hpp:
Use a single array instead of accessing positions of the sbox_
through a subscript to pbox_.
extra/yassl/taocrypt/include/runtime.hpp:
One definition of such functions is enough.
extra/yassl/taocrypt/src/aes.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/algebra.cpp:
Rename arguments to avoid shadowing related warnings.
extra/yassl/taocrypt/src/blowfish.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/integer.cpp:
Do not define type within a anonymous union.
Use a variable to return a value instead of
leaving the result in a register -- compiler
does not know the logic inside the asm.
extra/yassl/taocrypt/src/misc.cpp:
Define handler for pure virtual functions.
Remove unused code.
extra/yassl/taocrypt/src/twofish.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/testsuite/test.hpp:
Function must have C language linkage.
include/m_string.h:
Remove check which relied on bcmp being defined -- they weren't
being used as bcmp is only visible when _BSD_SOURCE is defined.
include/my_bitmap.h:
Remove bogus helpers which were used only in a few files and
were causing warnings about dead code.
include/my_global.h:
Due to G++ bug, always silence false-positive uninitialized
variables warnings when compiling C++ code with G++.
Remove bogus helper.
libmysql/Makefile.shared:
Remove built-in implementation of bcmp.
mysql-test/lib/My/SafeProcess/safe_process.cc:
Cast pid to largest possible type for a process identifier.
mysys/mf_loadpath.c:
Leave space of the ending nul.
mysys/mf_pack.c:
Replace bcmp with memcmp.
mysys/my_bitmap.c:
Dead code removal.
mysys/my_gethwaddr.c:
Remove unused variable.
mysys/my_getopt.c:
Silence bogus uninitialized variable warning.
Do not cast away the constant qualifier.
mysys/safemalloc.c:
Cast to expected type.
mysys/thr_lock.c:
Silence bogus uninitialized variable warning.
sql/field.cc:
Replace bogus helper with a more appropriate logic which is
used throughout the code.
sql/item.cc:
Remove bogus logical condition which always evaluates to TRUE.
sql/item_create.cc:
Simplify code to avoid signedness related warnings.
sql/log_event.cc:
Replace use of bcmp with memcmp.
No need to use helpers for simple bit operations.
sql/log_event_old.cc:
Replace bmove_align with memcpy.
sql/mysqld.cc:
Move use declaration of variable to the ifdef block where it
is used. Remove now-unnecessary casts and arguments.
sql/set_var.cc:
Replace bogus helpers with simple and classic bit operations.
sql/slave.cc:
Cast to expected type and silence bogus warning.
sql/sql_class.h:
Don't use enum values as bit flags, the supposed type safety is
bogus as the combined bit flags are not a value in the enumeration.
sql/udf_example.c:
Only declare variable when necessary.
sql/unireg.h:
Replace use of bmove_align with memcpy.
storage/innobase/os/os0file.c:
Silence bogus warning.
storage/myisam/mi_open.c:
Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
char.
storage/myisam/mi_page.c:
Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
char.
strings/bcmp.c:
Remove built-in bcmp.
strings/ctype-ucs2.c:
Silence bogus warning.
tests/mysql_client_test.c:
Use a appropriate type as expected by simple_command().
2010-07-02 20:30:47 +02:00
|
|
|
c_warnings="$warnings"
|
2006-04-07 00:25:59 +02:00
|
|
|
# C++ warnings
|
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.
BUILD/SETUP.sh:
Remove flags that are implied by -Wall and -Wextra.
Do not warn about unused parameters in C++.
BUILD/check-cpu:
Print only the compiler version instead of verbose banner.
Although the option is gcc specific, the check was only
being used for GCC specific checks anyway.
client/mysql.cc:
bcmp is no longer defined.
client/mysqltest.cc:
Pass a string to function expecting a format string.
Replace use of bcmp with memcmp.
cmd-line-utils/readline/Makefile.am:
Always define _GNU_SOURCE when compiling GNU readline.
Required to make certain prototypes visible.
cmd-line-utils/readline/input.c:
Condition for the code to be meaningful.
configure.in:
Remove check for bcmp.
extra/comp_err.c:
Use appropriate type.
extra/replace.c:
Replace use of bcmp with memcmp.
extra/yassl/src/crypto_wrapper.cpp:
Do not ignore the return value of fgets. Retrieve the file
position if fgets succeed -- if it fails, the function will
bail out and return a error.
extra/yassl/taocrypt/include/blowfish.hpp:
Use a single array instead of accessing positions of the sbox_
through a subscript to pbox_.
extra/yassl/taocrypt/include/runtime.hpp:
One definition of such functions is enough.
extra/yassl/taocrypt/src/aes.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/algebra.cpp:
Rename arguments to avoid shadowing related warnings.
extra/yassl/taocrypt/src/blowfish.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/integer.cpp:
Do not define type within a anonymous union.
Use a variable to return a value instead of
leaving the result in a register -- compiler
does not know the logic inside the asm.
extra/yassl/taocrypt/src/misc.cpp:
Define handler for pure virtual functions.
Remove unused code.
extra/yassl/taocrypt/src/twofish.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/testsuite/test.hpp:
Function must have C language linkage.
include/m_string.h:
Remove check which relied on bcmp being defined -- they weren't
being used as bcmp is only visible when _BSD_SOURCE is defined.
include/my_bitmap.h:
Remove bogus helpers which were used only in a few files and
were causing warnings about dead code.
include/my_global.h:
Due to G++ bug, always silence false-positive uninitialized
variables warnings when compiling C++ code with G++.
Remove bogus helper.
libmysql/Makefile.shared:
Remove built-in implementation of bcmp.
mysql-test/lib/My/SafeProcess/safe_process.cc:
Cast pid to largest possible type for a process identifier.
mysys/mf_loadpath.c:
Leave space of the ending nul.
mysys/mf_pack.c:
Replace bcmp with memcmp.
mysys/my_bitmap.c:
Dead code removal.
mysys/my_gethwaddr.c:
Remove unused variable.
mysys/my_getopt.c:
Silence bogus uninitialized variable warning.
Do not cast away the constant qualifier.
mysys/safemalloc.c:
Cast to expected type.
mysys/thr_lock.c:
Silence bogus uninitialized variable warning.
sql/field.cc:
Replace bogus helper with a more appropriate logic which is
used throughout the code.
sql/item.cc:
Remove bogus logical condition which always evaluates to TRUE.
sql/item_create.cc:
Simplify code to avoid signedness related warnings.
sql/log_event.cc:
Replace use of bcmp with memcmp.
No need to use helpers for simple bit operations.
sql/log_event_old.cc:
Replace bmove_align with memcpy.
sql/mysqld.cc:
Move use declaration of variable to the ifdef block where it
is used. Remove now-unnecessary casts and arguments.
sql/set_var.cc:
Replace bogus helpers with simple and classic bit operations.
sql/slave.cc:
Cast to expected type and silence bogus warning.
sql/sql_class.h:
Don't use enum values as bit flags, the supposed type safety is
bogus as the combined bit flags are not a value in the enumeration.
sql/udf_example.c:
Only declare variable when necessary.
sql/unireg.h:
Replace use of bmove_align with memcpy.
storage/innobase/os/os0file.c:
Silence bogus warning.
storage/myisam/mi_open.c:
Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
char.
storage/myisam/mi_page.c:
Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
char.
strings/bcmp.c:
Remove built-in bcmp.
strings/ctype-ucs2.c:
Silence bogus warning.
tests/mysql_client_test.c:
Use a appropriate type as expected by simple_command().
2010-07-02 20:30:47 +02:00
|
|
|
cxx_warnings="$warnings -Wno-unused-parameter"
|
2007-12-14 14:21:37 +01:00
|
|
|
# cxx_warnings="$cxx_warnings -Woverloaded-virtual -Wsign-promo"
|
|
|
|
cxx_warnings="$cxx_warnings -Wctor-dtor-privacy -Wnon-virtual-dtor"
|
2006-04-07 00:25:59 +02:00
|
|
|
# Added unless --with-debug=full
|
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.
BUILD/SETUP.sh:
Remove flags that are implied by -Wall and -Wextra.
Do not warn about unused parameters in C++.
BUILD/check-cpu:
Print only the compiler version instead of verbose banner.
Although the option is gcc specific, the check was only
being used for GCC specific checks anyway.
client/mysql.cc:
bcmp is no longer defined.
client/mysqltest.cc:
Pass a string to function expecting a format string.
Replace use of bcmp with memcmp.
cmd-line-utils/readline/Makefile.am:
Always define _GNU_SOURCE when compiling GNU readline.
Required to make certain prototypes visible.
cmd-line-utils/readline/input.c:
Condition for the code to be meaningful.
configure.in:
Remove check for bcmp.
extra/comp_err.c:
Use appropriate type.
extra/replace.c:
Replace use of bcmp with memcmp.
extra/yassl/src/crypto_wrapper.cpp:
Do not ignore the return value of fgets. Retrieve the file
position if fgets succeed -- if it fails, the function will
bail out and return a error.
extra/yassl/taocrypt/include/blowfish.hpp:
Use a single array instead of accessing positions of the sbox_
through a subscript to pbox_.
extra/yassl/taocrypt/include/runtime.hpp:
One definition of such functions is enough.
extra/yassl/taocrypt/src/aes.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/algebra.cpp:
Rename arguments to avoid shadowing related warnings.
extra/yassl/taocrypt/src/blowfish.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/integer.cpp:
Do not define type within a anonymous union.
Use a variable to return a value instead of
leaving the result in a register -- compiler
does not know the logic inside the asm.
extra/yassl/taocrypt/src/misc.cpp:
Define handler for pure virtual functions.
Remove unused code.
extra/yassl/taocrypt/src/twofish.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/testsuite/test.hpp:
Function must have C language linkage.
include/m_string.h:
Remove check which relied on bcmp being defined -- they weren't
being used as bcmp is only visible when _BSD_SOURCE is defined.
include/my_bitmap.h:
Remove bogus helpers which were used only in a few files and
were causing warnings about dead code.
include/my_global.h:
Due to G++ bug, always silence false-positive uninitialized
variables warnings when compiling C++ code with G++.
Remove bogus helper.
libmysql/Makefile.shared:
Remove built-in implementation of bcmp.
mysql-test/lib/My/SafeProcess/safe_process.cc:
Cast pid to largest possible type for a process identifier.
mysys/mf_loadpath.c:
Leave space of the ending nul.
mysys/mf_pack.c:
Replace bcmp with memcmp.
mysys/my_bitmap.c:
Dead code removal.
mysys/my_gethwaddr.c:
Remove unused variable.
mysys/my_getopt.c:
Silence bogus uninitialized variable warning.
Do not cast away the constant qualifier.
mysys/safemalloc.c:
Cast to expected type.
mysys/thr_lock.c:
Silence bogus uninitialized variable warning.
sql/field.cc:
Replace bogus helper with a more appropriate logic which is
used throughout the code.
sql/item.cc:
Remove bogus logical condition which always evaluates to TRUE.
sql/item_create.cc:
Simplify code to avoid signedness related warnings.
sql/log_event.cc:
Replace use of bcmp with memcmp.
No need to use helpers for simple bit operations.
sql/log_event_old.cc:
Replace bmove_align with memcpy.
sql/mysqld.cc:
Move use declaration of variable to the ifdef block where it
is used. Remove now-unnecessary casts and arguments.
sql/set_var.cc:
Replace bogus helpers with simple and classic bit operations.
sql/slave.cc:
Cast to expected type and silence bogus warning.
sql/sql_class.h:
Don't use enum values as bit flags, the supposed type safety is
bogus as the combined bit flags are not a value in the enumeration.
sql/udf_example.c:
Only declare variable when necessary.
sql/unireg.h:
Replace use of bmove_align with memcpy.
storage/innobase/os/os0file.c:
Silence bogus warning.
storage/myisam/mi_open.c:
Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
char.
storage/myisam/mi_page.c:
Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
char.
strings/bcmp.c:
Remove built-in bcmp.
strings/ctype-ucs2.c:
Silence bogus warning.
tests/mysql_client_test.c:
Use a appropriate type as expected by simple_command().
2010-07-02 20:30:47 +02:00
|
|
|
debug_extra_cflags="-O0 -g3 -gdwarf-2"
|
2006-04-07 00:25:59 +02:00
|
|
|
fi
|
2000-12-18 22:24:19 +01:00
|
|
|
|
2006-04-07 00:25:59 +02:00
|
|
|
# Set flags for various build configurations.
|
|
|
|
# Used in -valgrind builds
|
2010-05-20 12:40:42 +02:00
|
|
|
# Override -DFORCE_INIT_OF_VARS from debug_cflags. It enables the macro
|
|
|
|
# LINT_INIT(), which is only useful for silencing spurious warnings
|
|
|
|
# of static analysis tools. We want LINT_INIT() to be a no-op in Valgrind.
|
Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled
Essentially, the problem is that safemalloc is excruciatingly
slow as it checks all allocated blocks for overrun at each
memory management primitive, yielding a almost exponential
slowdown for the memory management functions (malloc, realloc,
free). The overrun check basically consists of verifying some
bytes of a block for certain magic keys, which catches some
simple forms of overrun. Another minor problem is violation
of aliasing rules and that its own internal list of blocks
is prone to corruption.
Another issue with safemalloc is rather the maintenance cost
as the tool has a significant impact on the server code.
Given the magnitude of memory debuggers available nowadays,
especially those that are provided with the platform malloc
implementation, maintenance of a in-house and largely obsolete
memory debugger becomes a burden that is not worth the effort
due to its slowness and lack of support for detecting more
common forms of heap corruption.
Since there are third-party tools that can provide the same
functionality at a lower or comparable performance cost, the
solution is to simply remove safemalloc. Third-party tools
can provide the same functionality at a lower or comparable
performance cost.
The removal of safemalloc also allows a simplification of the
malloc wrappers, removing quite a bit of kludge: redefinition
of my_malloc, my_free and the removal of the unused second
argument of my_free. Since free() always check whether the
supplied pointer is null, redudant checks are also removed.
Also, this patch adds unit testing for my_malloc and moves
my_realloc implementation into the same file as the other
memory allocation primitives.
client/mysqldump.c:
Pass my_free directly as its signature is compatible with the
callback type -- which wasn't the case for free_table_ent.
2010-07-08 23:20:08 +02:00
|
|
|
valgrind_flags="-UFORCE_INIT_OF_VARS -DHAVE_purify "
|
2006-04-07 00:25:59 +02:00
|
|
|
valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
|
2010-05-20 12:40:42 +02:00
|
|
|
valgrind_configs="--with-valgrind"
|
2006-04-07 00:25:59 +02:00
|
|
|
#
|
|
|
|
# Used in -debug builds
|
|
|
|
debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS "
|
Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled
Essentially, the problem is that safemalloc is excruciatingly
slow as it checks all allocated blocks for overrun at each
memory management primitive, yielding a almost exponential
slowdown for the memory management functions (malloc, realloc,
free). The overrun check basically consists of verifying some
bytes of a block for certain magic keys, which catches some
simple forms of overrun. Another minor problem is violation
of aliasing rules and that its own internal list of blocks
is prone to corruption.
Another issue with safemalloc is rather the maintenance cost
as the tool has a significant impact on the server code.
Given the magnitude of memory debuggers available nowadays,
especially those that are provided with the platform malloc
implementation, maintenance of a in-house and largely obsolete
memory debugger becomes a burden that is not worth the effort
due to its slowness and lack of support for detecting more
common forms of heap corruption.
Since there are third-party tools that can provide the same
functionality at a lower or comparable performance cost, the
solution is to simply remove safemalloc. Third-party tools
can provide the same functionality at a lower or comparable
performance cost.
The removal of safemalloc also allows a simplification of the
malloc wrappers, removing quite a bit of kludge: redefinition
of my_malloc, my_free and the removal of the unused second
argument of my_free. Since free() always check whether the
supplied pointer is null, redudant checks are also removed.
Also, this patch adds unit testing for my_malloc and moves
my_realloc implementation into the same file as the other
memory allocation primitives.
client/mysqldump.c:
Pass my_free directly as its signature is compatible with the
callback type -- which wasn't the case for free_table_ent.
2010-07-08 23:20:08 +02:00
|
|
|
debug_cflags="$debug_cflags -DSAFE_MUTEX"
|
2006-02-03 18:05:29 +01:00
|
|
|
error_inject="--with-error-inject "
|
2006-04-07 00:25:59 +02:00
|
|
|
#
|
|
|
|
# Base C++ flags for all builds
|
|
|
|
base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti"
|
|
|
|
#
|
|
|
|
# Flags for optimizing builds.
|
|
|
|
# Be as fast as we can be without losing our ability to backtrace.
|
2001-04-13 21:09:33 +02:00
|
|
|
fast_cflags="-O3 -fno-omit-frame-pointer"
|
2004-10-04 13:43:16 +02:00
|
|
|
|
2006-04-07 00:25:59 +02:00
|
|
|
debug_configs="--with-debug$full_debug"
|
|
|
|
if [ -z "$full_debug" ]
|
|
|
|
then
|
|
|
|
debug_cflags="$debug_cflags $debug_extra_cflags"
|
|
|
|
fi
|
2000-12-18 22:24:19 +01:00
|
|
|
|
2006-04-07 00:25:59 +02:00
|
|
|
#
|
|
|
|
# Configuration options.
|
|
|
|
#
|
|
|
|
base_configs="--prefix=$prefix --enable-assembler "
|
|
|
|
base_configs="$base_configs --with-extra-charsets=complex "
|
2007-01-25 09:18:10 +01:00
|
|
|
base_configs="$base_configs --enable-thread-safe-client "
|
2010-07-24 15:31:48 +02:00
|
|
|
base_configs="$base_configs --with-big-tables $maintainer_mode"
|
2006-04-07 00:25:59 +02:00
|
|
|
|
2007-01-25 08:46:07 +01:00
|
|
|
if test -d "$path/../cmd-line-utils/readline"
|
|
|
|
then
|
|
|
|
base_configs="$base_configs --with-readline"
|
|
|
|
elif test -d "$path/../cmd-line-utils/libedit"
|
|
|
|
then
|
|
|
|
base_configs="$base_configs --with-libedit"
|
|
|
|
fi
|
|
|
|
|
2006-04-07 00:25:59 +02:00
|
|
|
static_link="--with-mysqld-ldflags=-all-static "
|
|
|
|
static_link="$static_link --with-client-ldflags=-all-static"
|
2002-03-02 20:45:44 +01:00
|
|
|
# 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"
|
2000-12-18 22:24:19 +01:00
|
|
|
|
2006-04-07 00:25:59 +02:00
|
|
|
|
2006-05-02 06:33:09 +02:00
|
|
|
max_no_embedded_configs="$SSL_LIBRARY --with-plugins=max"
|
|
|
|
max_no_ndb_configs="$SSL_LIBRARY --with-plugins=max-no-ndb --with-embedded-server"
|
|
|
|
max_configs="$SSL_LIBRARY --with-plugins=max --with-embedded-server"
|
2006-04-07 00:25:59 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# 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"
|
2007-02-26 17:06:10 +01:00
|
|
|
pentium_cflags="$check_cpu_cflags"
|
2006-04-07 00:25:59 +02:00
|
|
|
pentium64_cflags="$check_cpu_cflags -m64"
|
|
|
|
ppc_cflags="$check_cpu_cflags"
|
|
|
|
sparc_cflags=""
|
2000-12-18 22:24:19 +01:00
|
|
|
|
2001-01-31 02:43:16 +01:00
|
|
|
if gmake --version > /dev/null 2>&1
|
|
|
|
then
|
2000-12-18 22:24:19 +01:00
|
|
|
make=gmake
|
|
|
|
else
|
|
|
|
make=make
|
|
|
|
fi
|
2001-10-30 15:31:35 +01:00
|
|
|
|
2005-10-06 16:54:43 +02:00
|
|
|
if test -z "$CC" ; then
|
|
|
|
CC=gcc
|
|
|
|
fi
|
|
|
|
|
2003-05-23 18:20:57 +02:00
|
|
|
if test -z "$CXX" ; then
|
2003-04-09 14:53:20 +02:00
|
|
|
CXX=gcc
|
|
|
|
fi
|
2003-05-23 18:20:57 +02:00
|
|
|
|
|
|
|
# If ccache (a compiler cache which reduces build time)
|
|
|
|
# (http://samba.org/ccache) is installed, use it.
|
|
|
|
# We use 'grep' and hope 'grep' will work as expected
|
|
|
|
# (returns 0 if finds lines)
|
2007-01-29 00:47:35 +01:00
|
|
|
if test "$USING_GCOV" != "1"
|
|
|
|
then
|
|
|
|
# Not using gcov; Safe to use ccache
|
|
|
|
CCACHE_GCOV_VERSION_ENABLED=1
|
|
|
|
fi
|
|
|
|
|
2007-01-07 18:21:42 +01:00
|
|
|
if ccache -V > /dev/null 2>&1 && test "$CCACHE_GCOV_VERSION_ENABLED" = "1"
|
2003-05-23 18:20:57 +02:00
|
|
|
then
|
2006-08-29 01:13:06 +02:00
|
|
|
echo "$CC" | grep "ccache" > /dev/null || CC="ccache $CC"
|
|
|
|
echo "$CXX" | grep "ccache" > /dev/null || CXX="ccache $CXX"
|
2003-05-23 18:20:57 +02:00
|
|
|
fi
|
2007-08-16 02:10:16 +02:00
|
|
|
|
|
|
|
# gcov
|
|
|
|
|
|
|
|
# The -fprofile-arcs and -ftest-coverage options cause GCC to instrument the
|
|
|
|
# code with profiling information used by gcov.
|
|
|
|
# The -DDISABLE_TAO_ASM is needed to avoid build failures in Yassl.
|
|
|
|
# The -DHAVE_gcov enables code to write out coverage info even when crashing.
|
|
|
|
|
|
|
|
gcov_compile_flags="-fprofile-arcs -ftest-coverage"
|
|
|
|
gcov_compile_flags="$gcov_compile_flags -DDISABLE_TAO_ASM"
|
|
|
|
gcov_compile_flags="$gcov_compile_flags -DMYSQL_SERVER_SUFFIX=-gcov -DHAVE_gcov"
|
|
|
|
|
|
|
|
# GCC4 needs -fprofile-arcs -ftest-coverage on the linker command line (as well
|
|
|
|
# as on the compiler command line), and this requires setting LDFLAGS for BDB.
|
|
|
|
|
|
|
|
gcov_link_flags="-fprofile-arcs -ftest-coverage"
|
|
|
|
|
2007-08-23 02:11:01 +02:00
|
|
|
gcov_configs="--disable-shared"
|
2007-08-16 02:10:16 +02:00
|
|
|
|
|
|
|
# gprof
|
|
|
|
|
|
|
|
gprof_compile_flags="-O2 -pg -g"
|
|
|
|
|
|
|
|
gprof_link_flags="--disable-shared $static_link"
|
|
|
|
|