8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-02-02 10:40:38 +01:00

Fix Travis (Ubuntu Xenial) build.

This commit is contained in:
Adriano dos Santos Fernandes 2020-05-13 11:58:05 -03:00
parent 0ac602d59d
commit bc9bba65e8
7 changed files with 29 additions and 34 deletions

View File

@ -213,26 +213,15 @@ private:
};
} //namespace Firebird
// getting a portable isinf() is harder than you would expect
#ifdef WIN_NT
inline bool isinf(double x)
inline bool isNegativeInf(double x)
{
return (!_finite (x) && !isnan(x));
}
#endif // WIN_NT
namespace Firebird {
inline bool isNegativeInf(double x)
{
#ifdef WIN_NT
return _fpclass(x) == _FPCLASS_NINF;
return _fpclass(x) == _FPCLASS_NINF;
#else
return x == -INFINITY;
return x == -INFINITY;
#endif
}
}
#endif //CLASSES_FPE_CONTROL_H
} // namespace Firebird
#endif // CLASSES_FPE_CONTROL_H

View File

@ -36,6 +36,7 @@
*/
#include "firebird.h"
#include <cmath>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@ -1449,7 +1450,7 @@ double CVT_get_double(const dsc* desc, DecimalStatus decSt, ErrorFunction err, b
else if (scale < 0)
value *= CVT_power_of_ten(-scale);
if (isinf(value))
if (std::isinf(value))
{
if (getNumericOverflow)
{

View File

@ -19,6 +19,7 @@
*/
#include "firebird.h"
#include <cmath>
#include <math.h>
#include <ctype.h>
#include "../common/TimeZoneUtil.h"
@ -1858,7 +1859,7 @@ dsc* ArithmeticNode::execute(thread_db* tdbb, jrd_req* request) const
impure->vlu_misc.vlu_double = MOV_get_double(tdbb, desc1) / divisor;
if (isinf(impure->vlu_misc.vlu_double))
if (std::isinf(impure->vlu_misc.vlu_double))
{
ERR_post(Arg::Gds(isc_arith_except) <<
Arg::Gds(isc_exception_float_overflow));
@ -1949,7 +1950,7 @@ dsc* ArithmeticNode::add(thread_db* tdbb, const dsc* desc, impure_value* value,
value->vlu_misc.vlu_double = (blrOp == blr_subtract) ? d2 - d1 : d1 + d2;
if (isinf(value->vlu_misc.vlu_double))
if (std::isinf(value->vlu_misc.vlu_double))
ERR_post(Arg::Gds(isc_arith_except) << Arg::Gds(isc_exception_float_overflow));
result->dsc_dtype = DEFAULT_DOUBLE;
@ -2046,7 +2047,7 @@ dsc* ArithmeticNode::add2(thread_db* tdbb, const dsc* desc, impure_value* value,
value->vlu_misc.vlu_double = (blrOp == blr_subtract) ? d2 - d1 : d1 + d2;
if (isinf(value->vlu_misc.vlu_double))
if (std::isinf(value->vlu_misc.vlu_double))
ERR_post(Arg::Gds(isc_arith_except) << Arg::Gds(isc_exception_float_overflow));
result->dsc_dtype = DEFAULT_DOUBLE;
@ -2149,7 +2150,7 @@ dsc* ArithmeticNode::multiply(const dsc* desc, impure_value* value) const
const double d2 = MOV_get_double(tdbb, &value->vlu_desc);
value->vlu_misc.vlu_double = d1 * d2;
if (isinf(value->vlu_misc.vlu_double))
if (std::isinf(value->vlu_misc.vlu_double))
{
ERR_post(Arg::Gds(isc_arith_except) <<
Arg::Gds(isc_exception_float_overflow));
@ -2262,7 +2263,7 @@ dsc* ArithmeticNode::multiply2(const dsc* desc, impure_value* value) const
const double d2 = MOV_get_double(tdbb, &value->vlu_desc);
value->vlu_misc.vlu_double = d1 * d2;
if (isinf(value->vlu_misc.vlu_double))
if (std::isinf(value->vlu_misc.vlu_double))
{
ERR_post(Arg::Gds(isc_arith_except) <<
Arg::Gds(isc_exception_float_overflow));
@ -2381,7 +2382,7 @@ dsc* ArithmeticNode::divide2(const dsc* desc, impure_value* value) const
}
const double d1 = MOV_get_double(tdbb, &value->vlu_desc);
value->vlu_misc.vlu_double = d1 / d2;
if (isinf(value->vlu_misc.vlu_double))
if (std::isinf(value->vlu_misc.vlu_double))
{
ERR_post(Arg::Gds(isc_arith_except) <<
Arg::Gds(isc_exception_float_overflow));

View File

@ -44,6 +44,7 @@
*/
#include "firebird.h"
#include <cmath>
#include <stdio.h>
#include "../jrd/intl.h"
#include <stdlib.h>
@ -593,7 +594,7 @@ static bool M_Transaction()
{
if (DB && !M__trans && setValues.KeepTranParams)
{
M__trans = DB->execute(fbStatus, nullptr,
M__trans = DB->execute(fbStatus, nullptr,
TranParams->length(), TranParams->c_str(),
isqlGlob.SQL_dialect, nullptr, nullptr, nullptr, nullptr);
@ -7228,9 +7229,9 @@ static bool checkSpecial(TEXT* const p, const int length, const double value)
*
**************************************/
const TEXT* t = NULL;
if (isnan(value))
if (std::isnan(value))
t = "NaN";
else if (isinf(value))
else if (std::isinf(value))
t = Firebird::isNegativeInf(value) ? "-Infinity" : "Infinity";
else
return false;

View File

@ -59,6 +59,7 @@
#include "../common/classes/FpeControl.h"
#include "../jrd/extds/ExtDS.h"
#include <cmath>
#include <math.h>
#ifndef WIN_NT
@ -1825,7 +1826,7 @@ dsc* evlStdMath(thread_db* tdbb, const SysFunction* function, const NestValueArr
return NULL;
}
if (isinf(rc))
if (std::isinf(rc))
{
status_exception::raise(Arg::Gds(isc_arith_except) <<
Arg::Gds(isc_sysf_fp_overflow) << Arg::Str(function->name));
@ -3823,7 +3824,7 @@ dsc* evlExp(thread_db* tdbb, const SysFunction*, const NestValueArray& args,
const double rc = exp(MOV_get_double(tdbb, value));
if (rc == HUGE_VAL) // unlikely to trap anything
status_exception::raise(Arg::Gds(isc_arith_except) << Arg::Gds(isc_exception_float_overflow));
if (isinf(rc))
if (std::isinf(rc))
status_exception::raise(Arg::Gds(isc_arith_except) << Arg::Gds(isc_exception_float_overflow));
impure->vlu_misc.vlu_double = rc;
@ -5560,7 +5561,7 @@ dsc* evlPower(thread_db* tdbb, const SysFunction* function, const NestValueArray
}
const double rc = pow(v1, v2);
if (isinf(rc))
if (std::isinf(rc))
status_exception::raise(Arg::Gds(isc_arith_except) << Arg::Gds(isc_exception_float_overflow));
impure->vlu_misc.vlu_double = rc;

View File

@ -31,6 +31,7 @@
*/
#include "firebird.h"
#include <cmath>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@ -777,13 +778,13 @@ void FUN_evaluate(thread_db* tdbb, const Function* function, const NestValueArra
switch (value->vlu_desc.dsc_dtype)
{
case dtype_double:
if (isinf(value->vlu_misc.vlu_double))
if (std::isinf(value->vlu_misc.vlu_double))
{
status_exception::raise(Arg::Gds(isc_expression_eval_err) <<
Arg::Gds(isc_udf_fp_overflow) <<
Arg::Str(function->getName().toString()));
}
else if (isnan(value->vlu_misc.vlu_double))
else if (std::isnan(value->vlu_misc.vlu_double))
{
status_exception::raise(Arg::Gds(isc_expression_eval_err) <<
Arg::Gds(isc_udf_fp_nan) <<

View File

@ -22,6 +22,7 @@
*/
#include "firebird.h"
#include <cmath>
#include <stdio.h>
#include <string.h>
@ -734,9 +735,9 @@ static void edit_float( const dsc* desc, pics* picture, TEXT** output)
// space, print it in f-format; otherwise print it in e-format.
// (G-format is untrustworthy.)
if (isnan(number))
if (std::isnan(number))
sprintf(temp, "NaN");
else if (isinf(number))
else if (std::isinf(number))
sprintf(temp, "Infinity");
else if (picture->pic_exponents)
{