[QGIS-Developer] bare isnan -- why isn't CI catching this?
Greg Troxel
gdt at lexort.com
Fri Jan 26 06:06:05 PST 2024
I am in the process of building 3.34.3 for pkgsrc. (We've been on 3.28.x,
and I am just now getting to jumping to the new LTR.)
I am using gcc 7.5.0 on NetBSD 10 amd64.
I found a case of bare isnan in a source file. It's easy for me to
patch to std::isnan. I see that there are a large number of std::isnan
in the sources. I am guessing that formally bare isnan is an error, but
have not passed the bar to be a practicing C++ Language Lawyer. I see
an include of cmath, but not "use that scope as if here" decl.
My question is:
Is it in fact invalid code to use bare isnan instead of std::isnan, vs
would someone claim my compiler is wrong?
Assuming bare isnan is wrong, why isn't qgis's CI catching this? I
would think the CI environment should have the equivalent of
POSIXLY_CORRECT to try to reject as much as possible in terms of using
extensions not required by standards.
[ 56%] Building CXX object src/core/CMakeFiles/qgis_core.dir/raster/qgsrasterattributetable.cpp.o
/tmp/work/wip/qgis/work/qgis-3.34.3/src/core/raster/qgsrasterattributetable.cpp: In member function 'QgsGradientColorRamp QgsRasterAttributeTable::colorRamp(QStringList&, int) const':
/tmp/work/wip/qgis/work/qgis-3.34.3/src/core/raster/qgsrasterattributetable.cpp:1362:16: error: 'isnan' was not declared in this scope; did you mean 'std::isnan'?
1362 | if ( ! isnan( min ) && ! isnan( max ) )
| ^~~~~
| std::isnan
In file included from /tmp/work/wip/qgis/work/qgis-3.34.3/src/core/qgis.h:25,
from /tmp/work/wip/qgis/work/qgis-3.34.3/src/core/qgsfield.h:25,
from /tmp/work/wip/qgis/work/qgis-3.34.3/src/core/qgsfields.h:22,
from /tmp/work/wip/qgis/work/qgis-3.34.3/src/core/raster/qgsrasterattributetable.h:19,
from /tmp/work/wip/qgis/work/qgis-3.34.3/src/core/raster/qgsrasterattributetable.cpp:17:
/usr/include/g++/cmath:632:5: note: 'std::isnan' declared here
632 | isnan(_Tp __x)
| ^~~~~
gmake[2]: *** [src/core/CMakeFiles/qgis_core.dir/build.make:10842: src/core/CMakeFiles/qgis_core.dir/raster/qgsrasterattributetable.cpp.o] Error 1
gmake[2]: Target 'src/core/CMakeFiles/qgis_core.dir/build' not remade because of errors.
gmake[1]: *** [CMakeFiles/Makefile2:4912: src/core/CMakeFiles/qgis_core.dir/all] Error 2
gmake[1]: Target 'all' not remade because of errors.
gmake: *** [Makefile:166: all] Error 2
More information about the QGIS-Developer
mailing list