I am trying to track down numerical errors in my driver code
by turning up all the compiler warnings, but pull request #5122
https://github.com/OSGeo/gdal/pull/5122/commits/3d877aa5da8868ed5c3aacf98845c90bc0d36e54
triggers clang++ -Werror,-Wfloat-equal

Assuming it is possible, would it make sense to tell compilers
(and static analyzers?) to ignore this warning ?

I assume that in this case we *do* want an exact floating point comparison.

------------------------------------------------------

clang++-13 -I /usr/local/gdal.git.llvm/include -fPIC -std=c++11 -Wall
        -Wextra -Weverything -Werror -Wno-padded
        -Wno-error=unknown-warning-option -Wno-format-pedantic
        -Wno-c++98-compat-pedantic   -Wno-deprecated-copy-with-dtor
        -Wno-reserved-identifier -Og -g -DFRMT_qct -DFRMT_qed
        -c -o qed.o qed.cpp
In file included from qed.cpp:42:
In file included from /usr/local/gdal.git.llvm/include/gdal_pam.h:36:
In file included from /usr/local/gdal.git.llvm/include/gdal_priv.h:60:
In file included from /usr/local/gdal.git.llvm/include/gdal.h:50:
In file included from /usr/local/gdal.git.llvm/include/ogr_api.h:45:
/usr/local/gdal.git.llvm/include/ogr_core.h:158:21: error: comparing floating point with == or != is unsafe [-Werror,-Wfloat-equal]
        return MinX == other.MinX &&
               ~~~~ ^  ~~~~~~~~~~
/usr/local/gdal.git.llvm/include/ogr_core.h:159:21: error: comparing floating point with == or != is unsafe [-Werror,-Wfloat-equal]
               MinY == other.MinY &&
               ~~~~ ^  ~~~~~~~~~~
/usr/local/gdal.git.llvm/include/ogr_core.h:160:21: error: comparing floating point with == or != is unsafe [-Werror,-Wfloat-equal]
               MaxX == other.MaxX &&
               ~~~~ ^  ~~~~~~~~~~
/usr/local/gdal.git.llvm/include/ogr_core.h:161:21: error: comparing floating point with == or != is unsafe [-Werror,-Wfloat-equal]
               MaxY == other.MaxY;
               ~~~~ ^  ~~~~~~~~~~
4 errors generated.


--
Andrew C. Aitchison                                     Kendal, UK
                        [email protected]
_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to