Fix for bug #28240: "isinf()" cannot be used in C++ for lack of prototype
Since isinf() portability across various platforms and compilers is a complicated question, we should not use it directly. Instead, the my_isinf() macro should be used, which is defined as an alias to the system-defined isinf() if it is safe to use, or a workaround implementation otherwise.
This commit is contained in:
parent
24a04cee4a
commit
51af6a4077
12
configure.in
12
configure.in
@ -2006,12 +2006,20 @@ case "$target" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# isinf() could be a function or a macro (HPUX)
|
# Check that isinf() is available in math.h and can be used in both C and C++
|
||||||
AC_MSG_CHECKING(for isinf with <math.h>)
|
# code
|
||||||
|
AC_MSG_CHECKING(for isinf in <math.h>)
|
||||||
AC_TRY_LINK([#include <math.h>], [float f = 0.0; int r = isinf(f); return r],
|
AC_TRY_LINK([#include <math.h>], [float f = 0.0; int r = isinf(f); return r],
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_MSG_CHECKING(whether isinf() can be used in C++ code)
|
||||||
|
AC_LANG_SAVE
|
||||||
|
AC_LANG_CPLUSPLUS
|
||||||
|
AC_TRY_LINK([#include <math.h>], [float f = 0.0; int r = isinf(f); return r],
|
||||||
AC_MSG_RESULT(yes)
|
AC_MSG_RESULT(yes)
|
||||||
AC_DEFINE(HAVE_ISINF, [1], [isinf() macro or function]),
|
AC_DEFINE(HAVE_ISINF, [1], [isinf() macro or function]),
|
||||||
AC_MSG_RESULT(no))
|
AC_MSG_RESULT(no))
|
||||||
|
AC_LANG_RESTORE,
|
||||||
|
AC_MSG_RESULT(no))
|
||||||
|
|
||||||
CFLAGS="$ORG_CFLAGS"
|
CFLAGS="$ORG_CFLAGS"
|
||||||
|
|
||||||
|
@ -792,12 +792,11 @@ typedef SOCKET_SIZE_TYPE size_socket;
|
|||||||
#define isnan(x) ((x) != (x))
|
#define isnan(x) ((x) != (x))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(HAVE_ISINF)
|
#ifdef HAVE_ISINF
|
||||||
/* The configure check for "isinf with math.h" has failed */
|
/* isinf() can be used in both C and C++ code */
|
||||||
#ifdef isinf
|
#define my_isinf(X) isinf(X)
|
||||||
#undef isinf
|
#else
|
||||||
#endif
|
#define my_isinf(X) (!finite(X) && !isnan(X))
|
||||||
#define isinf(X) (!finite(X) && !isnan(X))
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Define missing math constants. */
|
/* Define missing math constants. */
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
set autocommit=1;
|
|
||||||
reset master;
|
|
||||||
create table bug16206 (a int);
|
|
||||||
insert into bug16206 values(1);
|
|
||||||
start transaction;
|
|
||||||
insert into bug16206 values(2);
|
|
||||||
commit;
|
|
||||||
show binlog events;
|
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
|
||||||
f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4
|
|
||||||
f n Query 1 n use `test`; create table bug16206 (a int)
|
|
||||||
f n Query 1 n use `test`; insert into bug16206 values(1)
|
|
||||||
f n Query 1 n use `test`; insert into bug16206 values(2)
|
|
||||||
drop table bug16206;
|
|
||||||
reset master;
|
|
||||||
create table bug16206 (a int) engine= bdb;
|
|
||||||
insert into bug16206 values(0);
|
|
||||||
insert into bug16206 values(1);
|
|
||||||
start transaction;
|
|
||||||
insert into bug16206 values(2);
|
|
||||||
commit;
|
|
||||||
insert into bug16206 values(3);
|
|
||||||
show binlog events;
|
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
|
||||||
f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4
|
|
||||||
f n Query 1 n use `test`; create table bug16206 (a int) engine= bdb
|
|
||||||
f n Query 1 n use `test`; insert into bug16206 values(0)
|
|
||||||
f n Query 1 n use `test`; insert into bug16206 values(1)
|
|
||||||
f n Query 1 n use `test`; BEGIN
|
|
||||||
f n Query 1 n use `test`; insert into bug16206 values(2)
|
|
||||||
f n Query 1 n use `test`; COMMIT
|
|
||||||
f n Query 1 n use `test`; insert into bug16206 values(3)
|
|
||||||
drop table bug16206;
|
|
||||||
set autocommit=0;
|
|
||||||
End of 5.0 tests
|
|
@ -1,38 +0,0 @@
|
|||||||
-- source include/not_embedded.inc
|
|
||||||
-- source include/have_bdb.inc
|
|
||||||
|
|
||||||
#
|
|
||||||
# Bug #16206: Superfluous COMMIT event in binlog when updating BDB in autocommit mode
|
|
||||||
#
|
|
||||||
set autocommit=1;
|
|
||||||
|
|
||||||
let $VERSION=`select version()`;
|
|
||||||
|
|
||||||
reset master;
|
|
||||||
create table bug16206 (a int);
|
|
||||||
insert into bug16206 values(1);
|
|
||||||
start transaction;
|
|
||||||
insert into bug16206 values(2);
|
|
||||||
commit;
|
|
||||||
--replace_result $VERSION VERSION
|
|
||||||
--replace_column 1 f 2 n 5 n
|
|
||||||
show binlog events;
|
|
||||||
drop table bug16206;
|
|
||||||
|
|
||||||
reset master;
|
|
||||||
create table bug16206 (a int) engine= bdb;
|
|
||||||
insert into bug16206 values(0);
|
|
||||||
insert into bug16206 values(1);
|
|
||||||
start transaction;
|
|
||||||
insert into bug16206 values(2);
|
|
||||||
commit;
|
|
||||||
insert into bug16206 values(3);
|
|
||||||
--replace_result $VERSION VERSION
|
|
||||||
--replace_column 1 f 2 n 5 n
|
|
||||||
show binlog events;
|
|
||||||
drop table bug16206;
|
|
||||||
|
|
||||||
set autocommit=0;
|
|
||||||
|
|
||||||
|
|
||||||
--echo End of 5.0 tests
|
|
@ -1980,9 +1980,9 @@ double my_double_round(double value, longlong dec, bool dec_unsigned,
|
|||||||
tmp=(abs_dec < array_elements(log_10) ?
|
tmp=(abs_dec < array_elements(log_10) ?
|
||||||
log_10[abs_dec] : pow(10.0,(double) abs_dec));
|
log_10[abs_dec] : pow(10.0,(double) abs_dec));
|
||||||
|
|
||||||
if (dec_negative && isinf(tmp))
|
if (dec_negative && my_isinf(tmp))
|
||||||
tmp2= 0;
|
tmp2= 0;
|
||||||
else if (!dec_negative && isinf(value * tmp))
|
else if (!dec_negative && my_isinf(value * tmp))
|
||||||
tmp2= value;
|
tmp2= value;
|
||||||
else if (truncate)
|
else if (truncate)
|
||||||
{
|
{
|
||||||
|
@ -194,7 +194,7 @@ double my_strtod(const char *str, char **end_ptr, int *error)
|
|||||||
done:
|
done:
|
||||||
*end_ptr= (char*) str; /* end of number */
|
*end_ptr= (char*) str; /* end of number */
|
||||||
|
|
||||||
if (overflow || isinf(result))
|
if (overflow || my_isinf(result))
|
||||||
{
|
{
|
||||||
result= DBL_MAX;
|
result= DBL_MAX;
|
||||||
*error= EOVERFLOW;
|
*error= EOVERFLOW;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user