duckdb-r
duckdb-r copied to clipboard
Use proper std::isnan in C++ code, not C99 versions which may not compile
rfuns.cpp: In function 'int32_t duckdb::rfuns::{anonymous}::cast(T, duckdb::ValidityMask&, duckdb::idx_t) [with T = double; int32_t = int; duckdb::idx_t = long long unsigned int]':
rfuns.cpp:111:13: error: 'isnan' was not declared in this scope; did you mean 'std::isnan'?
111 | if (isnan(input)) {
| ^~~~~
| std::isnan
In file included from /opt/local/include/LegacySupport/cmath:54,
from duckdb/third_party/fast_float/fast_float/fast_float.h:1518,
from duckdb/src/include/duckdb/common/operator/double_cast_operator.hpp:12,
from rfuns.cpp:84:
/opt/local/include/gcc13/c++/cmath:1192:5: note: 'std::isnan' declared here
1192 | isnan(_Tp __x)
| ^~~~~
rfuns.cpp: In function 'void duckdb::rfuns::isna_double(duckdb::DataChunk&, duckdb::ExpressionState&, duckdb::Vector&)':
rfuns.cpp:231:57: error: 'isnan' was not declared in this scope; did you mean 'std::isnan'?
231 | result_data[base_idx] = isnan(data[base_idx]);
| ^~~~~
| std::isnan
/opt/local/include/gcc13/c++/cmath:1192:5: note: 'std::isnan' declared here
1192 | isnan(_Tp __x)
| ^~~~~
rfuns.cpp:244:65: error: 'isnan' was not declared in this scope; did you mean 'std::isnan'?
244 | result_data[base_idx] = isnan(data[base_idx]);
| ^~~~~
| std::isnan
/opt/local/include/gcc13/c++/cmath:1192:5: note: 'std::isnan' declared here
1192 | isnan(_Tp __x)
| ^~~~~
rfuns.cpp: In function 'bool duckdb::rfuns::{anonymous}::set_null(T, duckdb::ValidityMask&, duckdb::idx_t) [with T = double; duckdb::idx_t = long long unsigned int]':
rfuns.cpp:630:13: error: 'isnan' was not declared in this scope; did you mean 'std::isnan'?
630 | if (isnan(value)) {
| ^~~~~
| std::isnan
/opt/local/include/gcc13/c++/cmath:1192:5: note: 'std::isnan' declared here
1192 | isnan(_Tp __x)
| ^~~~~
make: *** [rfuns.o] Error 1
Once #include <cmath>
is added and isnan
replaced with std::isnan
, rfuns.cpp
compiles fine.
Thanks. @romainfrancois: Can you please take a look?
Done in 31c49e7a95c9302a55c0d74c679f5ec6c6ef5902.
@krlmlr We are back to having it broken ))
Now this is also needed: https://github.com/macports/macports-ports/blob/39c348b38f909764a7b76de406467d0ca48a9a00/R/R-duckdb/files/patch-fix-cmath.diff
I'm changing this for the imminent CRAN 1.0.0-1, the issue is closed when upstream duckdb-rfuns (that's vendored into this package) brings this in.
@krlmlr Thanks!