Compile warnings: macro redefinition - HOST_FILLORDER

Description

I see in several places (coming from GDAL):

  • \support\gdal_sdk\v141\include\win32\tiffconf.h(59): warning C4005: 'HOST_FILLORDER': macro redefinition (compiling source file Grid\GridManager.cpp)

  • \support\gdal_sdk\v141\include\win32\cpl_config.h(92): note: see previous definition of 'HOST_FILLORDER' (compiling source file Grid\GridManager.cpp)

  • \support\gdal_sdk\v141\include\win32\tiffconf.h(59): warning C4005: 'HOST_FILLORDER': macro redefinition (compiling source file Control\Map_Core.cpp)

  • \support\gdal_sdk\v141\include\win32\cpl_config.h(92): note: see previous definition of 'HOST_FILLORDER' (compiling source file Control\Map_Core.cpp)

  • \support\gdal_sdk\v141\include\win32\tif_config.h(39): warning C4005: 'TIFF_INT64_T': macro redefinition (compiling source file Control\Map_Core.cpp)

  • \support\gdal_sdk\v141\include\win32\tiffconf.h(17): note: see previous definition of 'TIFF_INT64_T' (compiling source file Control\Map_Core.cpp)

  • \support\gdal_sdk\v141\include\win32\tif_config.h(45): warning C4005: 'TIFF_UINT64_T': macro redefinition (compiling source file Control\Map_Core.cpp)

  • \support\gdal_sdk\v141\include\win32\tiffconf.h(29): note: see previous definition of 'TIFF_UINT64_T' (compiling source file Control\Map_Core.cpp)

  • \support\gdal_sdk\v141\include\win32\tif_config.h(48): warning C4005: 'HOST_FILLORDER': macro redefinition (compiling source file Control\Map_Core.cpp)

  • \support\gdal_sdk\v141\include\win32\tiffconf.h(59): note: see previous definition of 'HOST_FILLORDER' (compiling source file Control\Map_Core.cpp)

  • \support\gdal_sdk\v141\include\win32\tiffconf.h(59): warning C4005: 'HOST_FILLORDER': macro redefinition (compiling source file COM classes\Utils.cpp)

  • \support\gdal_sdk\v141\include\win32\cpl_config.h(92): note: see previous definition of 'HOST_FILLORDER' (compiling source file COM classes\Utils.cpp)

Not sure how to handle this.

Activity

Show:
Paul Meems
July 12, 2019, 1:57 PM

Do you think this is an issue with MapWinGIS or with GDAL?

If it is with GDAL I will report it on their mailinglist.

Jerry Faust
July 12, 2019, 10:01 PM

Just picking one example,

Our Map_Core.cpp includes tiff.h, which includes tiffconf.h, which defines HOST_FILLORDER as

Map_Core.cpp then also includes geotiff.h, which includes geo_config.h, which includes cpl_config.h, which unfortunately redefines HOST_FILLORDER in the opposite order

If it were redefining to the same value, that would be one thing, but since it is redefining to another value, it makes you wonder 1) why is it coming in differently, and 2) which value should it be?

A simple redefinition, with the same value, wouldn’t bother me as much, and would be easier to deal with. But with this, we will have to figure out which value it should be, and why do the includes we’re using result in conflicting definitions.

If you think you can put the question to the GDAL group in a logical way, please do. For instance, is it ‘known’ that we shouldn’t include both tiff.h and geotiff.h in the same file?

In the mean time, I can try to track down the other similar conflicts to see if there is a similar pattern.

Paul Meems
July 15, 2019, 9:30 AM

I’ve asked on the GDAL Dev list.

Paul Meems
July 16, 2019, 8:53 AM

The response from GDAL:

Paul, overall this doesn't seem critical as the only real use of
HOST_FILLORDER in all GDAL, libtiff and libgeotiff code bases in in libtiff
TIFFOpen() function when the esoteric 'H' open flag is used, and that one is
likely rarely used (not used by GDAL typically). So you could just #undef
HOST_FILLORDER between the 2 #include to silence the warning.

Tamas, how is tiffconf.h in gisinternals produced, which has this unexpected
#define HOST_FILLORDER FILLORDER_MSB2LSB (should be LSB2MSB for Intel
platforms) ? Is this the result of cmake ? I guess so, as it doesn't seem to
be in sync with the tiffconf.vc.h that is also provided and used by nmake
builds. That would mean that there's an issue in the CMake configuration step
with VS builds:
https://gitlab.com/libtiff/libtiff/blob/master/CMakeLists.txt#L394

Actually, I just found a CI with CMake + Windows at
https://ci.appveyor.com/project/rleigh-codelibre/libtiff-didfs/builds/
25846668/job/ory5w098j8wcij9x
where I can see:

[00:02:58] -- CMAKE_HOST_SYSTEM_PROCESSOR set to AMD64
[00:02:58] -- HOST_FILLORDER set to FILLORDER_MSB2LSB

So this seems to be a case sensitivity issue when comparing AMD64 vs amd64.
I've just submitted
https://gitlab.com/libtiff/libtiff/merge_requests/87
to fix this.

I’ll add the #undefas Even suggest to silence the warning.

Assignee

Paul Meems

Reporter

Paul Meems

Labels

None

Epic Link

Affects versions

Fix versions

Priority

Medium
Configure