diff --git a/autotest/postinstall/test_cpp/test_cpp.cpp b/autotest/postinstall/test_cpp/test_cpp.cpp index b928a03b9205..173daa14f6f2 100644 --- a/autotest/postinstall/test_cpp/test_cpp.cpp +++ b/autotest/postinstall/test_cpp/test_cpp.cpp @@ -9,6 +9,7 @@ #endif #include #include +#include int main(int argc, char **argv) { @@ -16,5 +17,13 @@ int main(int argc, char **argv) OGRGeometryFactory::createFromWkt("POINT(1 2)", nullptr, &poGeom); OGRGeometryFactory::destroyGeometry(poGeom); std::cout << GDALVersionInfo("RELEASE_NAME") << std::endl; + + // Check fix for https://github.com/OSGeo/gdal/issues/11311 + OGRSpatialReference oSRS; + int nEntries = 0; + int *panMatchCondidence = nullptr; + oSRS.FindMatches(nullptr, &nEntries, &panMatchCondidence); + CPLFree(panMatchCondidence); + return (0); } diff --git a/gdal.cmake b/gdal.cmake index 014867404323..b0d5b2ad3bfe 100644 --- a/gdal.cmake +++ b/gdal.cmake @@ -189,6 +189,10 @@ if (MINGW AND BUILD_SHARED_LIBS) set_target_properties(${GDAL_LIB_TARGET_NAME} PROPERTIES SUFFIX "-${GDAL_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}") endif () +# Some of the types in our public headers are dependent on whether GDAL_DEBUG +# is defined or not +target_compile_definitions(${GDAL_LIB_TARGET_NAME} PUBLIC $<$:GDAL_DEBUG>) + # Install properties if (GDAL_ENABLE_MACOSX_FRAMEWORK) set(FRAMEWORK_VERSION ${GDAL_VERSION_MAJOR}.${GDAL_VERSION_MINOR}) diff --git a/ogr/ogr_api.h b/ogr/ogr_api.h index 926734daafb9..99c38e370eb0 100644 --- a/ogr/ogr_api.h +++ b/ogr/ogr_api.h @@ -43,7 +43,7 @@ bool CPL_DLL OGRGetGEOSVersion(int *pnMajor, int *pnMinor, int *pnPatch); /*! @cond Doxygen_Suppress */ #define DEFINEH_OGRGeometryH /*! @endcond */ -#ifdef DEBUG +#if defined(DEBUG) || defined(GDAL_DEBUG) typedef struct OGRGeometryHS *OGRGeometryH; #else /** Opaque type for a geometry */ @@ -57,7 +57,7 @@ typedef void *OGRGeometryH; /*! @endcond */ #ifndef DOXYGEN_XML -#ifdef DEBUG +#if defined(DEBUG) || defined(GDAL_DEBUG) typedef struct OGRSpatialReferenceHS *OGRSpatialReferenceH; typedef struct OGRCoordinateTransformationHS *OGRCoordinateTransformationH; #else @@ -396,7 +396,7 @@ int CPL_DLL OGRPreparedGeometryContains(OGRPreparedGeometryH hPreparedGeom, /*! @cond Doxygen_Suppress */ #define DEFINE_OGRFeatureH /*! @endcond */ -#ifdef DEBUG +#if defined(DEBUG) || defined(GDAL_DEBUG) typedef struct OGRFieldDefnHS *OGRFieldDefnH; typedef struct OGRFeatureDefnHS *OGRFeatureDefnH; typedef struct OGRFeatureHS *OGRFeatureH; @@ -667,7 +667,7 @@ const char CPL_DLL *OGR_GlobFldDomain_GetGlob(OGRFieldDomainH); /* ogrsf_frmts.h */ /* -------------------------------------------------------------------- */ -#ifdef DEBUG +#if defined(DEBUG) || defined(GDAL_DEBUG) typedef struct OGRLayerHS *OGRLayerH; typedef struct OGRDataSourceHS *OGRDataSourceH; typedef struct OGRDriverHS *OGRSFDriverH; @@ -949,7 +949,7 @@ void CPL_DLL OGRCleanupAll(void); /* ogrsf_featurestyle.h */ /* -------------------------------------------------------------------- */ -#ifdef DEBUG +#if defined(DEBUG) || defined(GDAL_DEBUG) typedef struct OGRStyleMgrHS *OGRStyleMgrH; typedef struct OGRStyleToolHS *OGRStyleToolH; #else diff --git a/ogr/ogr_feature.h b/ogr/ogr_feature.h index f22d875f5e35..7b51cf951e37 100644 --- a/ogr/ogr_feature.h +++ b/ogr/ogr_feature.h @@ -37,7 +37,7 @@ /*! @cond Doxygen_Suppress */ #define DEFINE_OGRFeatureH /*! @endcond */ -#ifdef DEBUG +#if defined(DEBUG) || defined(GDAL_DEBUG) typedef struct OGRFieldDefnHS *OGRFieldDefnH; typedef struct OGRFeatureDefnHS *OGRFeatureDefnH; typedef struct OGRFeatureHS *OGRFeatureH; diff --git a/ogr/ogr_geometry.h b/ogr/ogr_geometry.h index abd66ace0e8f..cee963fd3cc6 100644 --- a/ogr/ogr_geometry.h +++ b/ogr/ogr_geometry.h @@ -35,7 +35,7 @@ /*! @cond Doxygen_Suppress */ #ifndef DEFINEH_OGRGeometryH #define DEFINEH_OGRGeometryH -#ifdef DEBUG +#if defined(DEBUG) || defined(GDAL_DEBUG) typedef struct OGRGeometryHS *OGRGeometryH; #else typedef void *OGRGeometryH; diff --git a/ogr/ogr_srs_api.h b/ogr/ogr_srs_api.h index e9eb02ea90ca..2116821b80bc 100644 --- a/ogr/ogr_srs_api.h +++ b/ogr/ogr_srs_api.h @@ -426,7 +426,7 @@ const char CPL_DLL *OSRAxisEnumToName(OGRAxisOrientation eOrientation); #define DEFINED_OGRSpatialReferenceH /*! @endcond */ -#ifdef DEBUG +#if defined(DEBUG) || defined(GDAL_DEBUG) typedef struct OGRSpatialReferenceHS *OGRSpatialReferenceH; typedef struct OGRCoordinateTransformationHS *OGRCoordinateTransformationH; #else diff --git a/ogr/ograpispy.h b/ogr/ograpispy.h index 70d98b5ea16f..f04d3758657b 100644 --- a/ogr/ograpispy.h +++ b/ogr/ograpispy.h @@ -45,7 +45,7 @@ * @since GDAL 2.0 */ -#ifdef DEBUG +#if defined(DEBUG) || defined(GDAL_DEBUG) #define OGRAPISPY_ENABLED #endif diff --git a/port/cpl_error.h b/port/cpl_error.h index d15d875e619c..c4f1cde43626 100644 --- a/port/cpl_error.h +++ b/port/cpl_error.h @@ -179,7 +179,7 @@ void CPL_DLL CPLDebugProgress(const char *, CPL_FORMAT_STRING(const char *), ...) CPL_PRINT_FUNC_FORMAT(2, 3); #endif -#ifdef DEBUG +#if defined(DEBUG) || defined(GDAL_DEBUG) /** Same as CPLDebug(), but expands to nothing for non-DEBUG builds. * @since GDAL 3.1 */