Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#5334 closed defect (fixed)

clang -Wtautological-compare complains about gdal_java.i

Reported by: Kurt Schwehr Owned by: Even Rouault
Priority: low Milestone: 1.11.0
Component: JavaBindings Version: unspecified
Severity: normal Keywords:
Cc:

Description

When using clang with -Wtautological-compare, clang gripes about

source:trunk/gdal/swig/include/java/gdal_java.i#L260 ReadRaster

The gdal_type == GDT_foo tests will have at least 4 cases where a constant is compared against the same constant. e.g.

SWIGINTERN CPLErr GDALDatasetShadow_ReadRaster__SWIG_4(GDALDatasetShadow *self,int xoff,int yoff,int xsize,...){
    if ((GDT_Int16 == GDT_Int16 && buf_type ...) ||
        (GDT_Int16 == GDT_Int32 && buf_type != GDT_Int32 

Looks like there is the same issue with WriteRaster.

I'm not much a swig hacker, otherwise I'd propose a solution. I'm hoping that anyone more experience than me will be able to quick knock out a solution.

Not a huge deal, as I can easily get around this with -Wno-tautological-compare, but would be nice just to have this cleaned up and I dislike some of the pragma fixes that I've seen like in this post: http://stackoverflow.com/questions/15864461/suppress-wtautological-compare-warning

Change History (2)

comment:1 by Even Rouault, 10 years ago

Milestone: 2.0
Resolution: fixed
Status: newclosed

trunk r26749 "Java bindings: refactor code to avoid -Wtautological-compare complains (#5334)"

comment:2 by Even Rouault, 10 years ago

Milestone: 2.01.11.0
Note: See TracTickets for help on using tickets.