AcademySoftwareFoundation / Imath

Imath is a C++ and python library of 2D and 3D vector, matrix, and math operations for computer graphics
https://imath.readthedocs.io
BSD 3-Clause "New" or "Revised" License
356 stars 104 forks source link

Add std:: to isfinite in ImathFun.cpp #368

Closed cary-ilm closed 4 months ago

cary-ilm commented 4 months ago

Should hopefully address #367

barracuda156 commented 4 months ago

@meshula @cary-ilm Thank you for addressing the issue!

There are two other cases in the same file:

float succf(float f) IMATH_NOEXCEPT
{
    return isfinite(f) ?
            std::nextafter(f, std::numeric_limits<float>::infinity()) : f;
}

float predf(float f) IMATH_NOEXCEPT
{
    return isfinite(f) ?
            std::nextafter(f, -std::numeric_limits<float>::infinity()) : f;
}

So at the moment it still fails:

/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_graphics_imath/imath/work/imath-3.1.10/src/Imath/ImathFun.cpp: In function 'float Imath_3_1::succf(float)':
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_graphics_imath/imath/work/imath-3.1.10/src/Imath/ImathFun.cpp:13:12: error: 'isfinite' was not declared in this scope; did you mean 'std::isfinite'?
   13 |     return isfinite(f) ?
      |            ^~~~~~~~
      |            std::isfinite
In file included from /opt/local/include/LegacySupport/cmath:54,
                 from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_graphics_imath/imath/work/imath-3.1.10/src/Imath/ImathFun.cpp:7:
/opt/local/include/gcc13/c++/cmath:1138:5: note: 'std::isfinite' declared here
 1138 |     isfinite(_Tp __x)
      |     ^~~~~~~~
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_graphics_imath/imath/work/imath-3.1.10/src/Imath/ImathFun.cpp: In function 'float Imath_3_1::predf(float)':
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_graphics_imath/imath/work/imath-3.1.10/src/Imath/ImathFun.cpp:19:12: error: 'isfinite' was not declared in this scope; did you mean 'std::isfinite'?
   19 |     return isfinite(f) ?
      |            ^~~~~~~~
      |            std::isfinite
/opt/local/include/gcc13/c++/cmath:1138:5: note: 'std::isfinite' declared here
 1138 |     isfinite(_Tp __x)
      |     ^~~~~~~~
make[2]: *** [src/Imath/CMakeFiles/Imath.dir/ImathFun.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....

Once those are fixed in the likewise manner, the build succeeds.