Ticket #1741 (new defect)

Opened 1 year ago

Last modified 9 months ago

[PATCH] Fixes compilation with -Wall -Werror

Reported by: rouault Assigned to: rouault
Priority: normal Milestone: 1.6.0
Component: GDAL_Raster Version: svn-trunk
Severity: normal Keywords: warnings
Cc: warmerdam, mloskot

Description

Most fixes are to suppress "warning: dereferencing type-punned pointer will break strict-aliasing rules", which is not always easy to do in an elegant way. One big change (in term of diff) is for frmts/aigrid/aigccitt.c where 3 arrays of structure elements missed a lot of braces.

Apart from cosmetic and boring changes, I think that I've catched a bug in the process. See :

Index: frmts/fit/fitdataset.cpp
===================================================================
--- frmts/fit/fitdataset.cpp    (révision 11867)
+++ frmts/fit/fitdataset.cpp    (copie de travail)
@@ -941,7 +941,7 @@
         CPLDebug("FIT", "Loading file with header version 01");

         // map old style header into new header structure
-       FIThead01* head01 = (FIThead01*)&head;
+       FIThead01* head01 = (FIThead01*)head;
         gst_swapb(head->dataOffset);
        info->dataOffset = head01->dataOffset;

Attachments

gdal_svn_suppress_warnings.patch (203.7 kB) - added by rouault on 08/12/07 14:19:34.

Change History

08/12/07 14:19:34 changed by rouault

  • attachment gdal_svn_suppress_warnings.patch added.

08/13/07 14:00:26 changed by rouault

  • version changed from unspecified to svn-trunk.

08/17/07 14:37:57 changed by warmerdam

  • keywords set to warnings.
  • owner changed from warmerdam to rouault.
  • component changed from default to GDAL_Raster.
  • cc set to warmerdam.
  • milestone set to 1.5.0.

Even, please go ahead and apply.

Thanks

08/17/07 16:48:31 changed by rouault

Commited in trunk in r11896

08/17/07 17:03:45 changed by warmerdam

Doh! I thought the patch only included the fitdataset.cpp change.

The changes in the various support libraries (eg. libtiff, libgeotiff, avc*) are not appropriate and should be backed out.

08/17/07 17:13:41 changed by rouault

Sorry for the misunderstanding. I'm going to revert.

08/17/07 17:28:32 changed by rouault

In r11897, revert all unintended changes made in r11896. Just keep the fitdataset.cpp change.

08/18/07 11:06:35 changed by warmerdam

I have applied the aigccitt.c patch as well (r11903).

11/15/07 11:10:52 changed by mloskot

  • cc changed from warmerdam to warmerdam, mloskot.

12/11/07 09:31:07 changed by warmerdam

  • milestone changed from 1.5.0 to 1.6.0.

It's too late to try and fix type punning warnings in 1.5.