Bug report #1240

Invalid preprocessor condition testing value of GEOS_VERSION_MAJOR

Added by Mateusz Loskot - over 16 years ago. Updated about 16 years ago.

Status:Closed
Priority:Low
Assignee:nobody -
Category:Build/Install
Affected QGIS version: Regression?:No
Operating System:OS X Easy fix?:No
Pull Request or Patch supplied: Resolution:fixed
Crashes QGIS or corrupts data: Copied to github as #:11300

Description

In file [source:trunk/qgis/src/core/qgsgeometry.h@9096#L27 qgsgeometry.h], line 27, preprocessir #if-def testing major version number is incorrect:

#if GEOS_VERSION_MAJOR<3

If the tested macro is not defined, it always evaluates to true. Small test:

  • Incorrect condition due to the incompleteness
    //#define ABC 3   // ABC not defined
    
    #if (ABC < 4)
    #  error XXX      // always printed, despite ABC undefined
    #endif
    
    int main() { return 0; }
    
  • Correct #ifdef condition should include 2 tests together
    //#define ABC 3
    
    #if defined(ABC) && (ABC < 4)
    #  error XXX
    #endif
    
    int main() { return 0; }
    

Associated revisions

Revision 2e5506a2
Added by Jürgen Fischer about 16 years ago

various code cleanups by mloskot for GCC 4.1 (fixes #1239, #1240).
Inspired by it I also enabled pedantic mode for MSVC and cleaned
up some more warnings found by GCC 4.3 and MSVC.

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9133 c8812cc2-4d05-0410-92ff-de0c093fc19c

Revision 120a61ca
Added by Jürgen Fischer about 16 years ago

various code cleanups by mloskot for GCC 4.1 (fixes #1239, #1240).
Inspired by it I also enabled pedantic mode for MSVC and cleaned
up some more warnings found by GCC 4.3 and MSVC.

git-svn-id: http://svn.osgeo.org/qgis/trunk@9133 c8812cc2-4d05-0410-92ff-de0c093fc19c

History

#1 Updated by Jürgen Fischer about 16 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

also fixed with 120a61ca (SVN r9134)

Also available in: Atom PDF