| 1 |
/****************************************************************************** |
| 2 |
* |
| 3 |
* Project: KML Translator |
| 4 |
* Purpose: Implements OGRLIBKMLDriver |
| 5 |
* Author: Even Rouault <even dot rouault at spatialys dot com> |
| 6 |
* |
| 7 |
****************************************************************************** |
| 8 |
* Copyright (c) 2015, Even Rouault <even dot rouault at spatialys dot com> |
| 9 |
* |
| 10 |
* SPDX-License-Identifier: MIT |
| 11 |
*****************************************************************************/ |
| 12 |
|
| 13 |
#ifndef LIBKML_HEADERS_H |
| 14 |
#define LIBKML_HEADERS_H |
| 15 |
|
| 16 |
#if ((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)) && \ |
| 17 |
!defined(_MSC_VER)) |
| 18 |
#pragma GCC system_header |
| 19 |
#endif |
| 20 |
|
| 21 |
#ifdef _MSC_VER |
| 22 |
#pragma warning(push) |
| 23 |
#pragma warning(disable \ |
| 24 |
: 4512) /* assignment operator could not be generated \ |
| 25 |
*/ |
| 26 |
#endif |
| 27 |
|
| 28 |
#if defined(__clang_major__) && __clang_major__ >= 21 && __cplusplus >= 202302L |
| 29 |
// Since Boost 1.90, in particular https://github.com/boostorg/smart_ptr/commit/d08d035bdf4d5d1b9d5c6b798e0b7da8fa9bb325 |
| 30 |
// methods of Boost intrusive_ptr class are prefixed with a BOOST_SP_CXX20_CONSTEXPR macro |
| 31 |
// defined in a include/boost/smart_ptr/detail/sp_cxx20_constexpr.hpp header |
| 32 |
// protected by BOOST_SMART_PTR_DETAIL_SP_CXX20_CONSTEXPR_HPP_INCLUDED |
| 33 |
// The expansion of that BOOST_SP_CXX20_CONSTEXPR macro cause build issues in |
| 34 |
// libkml header with clang 21 *and* c++23 |
| 35 |
// e.g: clang++ -std=c++23 -c /usr/include/kml/dom/xal.h |
| 36 |
// outputs: |
| 37 |
/* |
| 38 |
/usr/include/boost/smart_ptr/intrusive_ptr.hpp:76:23: error: use of undeclared identifier 'intrusive_ptr_release' |
| 39 |
76 | if( px != 0 ) intrusive_ptr_release( px ); |
| 40 |
| ^~~~~~~~~~~~~~~~~~~~~ |
| 41 |
/usr/include/kml/dom/xal.h:62:11: note: in instantiation of member function 'boost::intrusive_ptr<kmldom::XalCountry>::~intrusive_ptr' requested here |
| 42 |
62 | virtual ~XalAddressDetails() {} |
| 43 |
| ^ |
| 44 |
*/ |
| 45 |
// It is not clear to me if this is a defect of clang 21 in C++23 mode, or |
| 46 |
// if some changes would be needed in the way libkml defines the intrusive_ptr_release() |
| 47 |
// function in kml/base/referent.h |
| 48 |
// Anyway the following defines have the consequence of the methods of intrusive_ptr |
| 49 |
// not being marked as constexpr, which works around the issue. |
| 50 |
#define BOOST_SMART_PTR_DETAIL_SP_CXX20_CONSTEXPR_HPP_INCLUDED |
| 51 |
#define BOOST_SP_CXX20_CONSTEXPR |
| 52 |
#define BOOST_SP_NO_CXX20_CONSTEXPR |
| 53 |
#endif |
| 54 |
|
| 55 |
#include <kml/engine.h> |
| 56 |
#include <kml/dom.h> |
| 57 |
#include <kml/base/color32.h> |
| 58 |
#include <kml/base/file.h> |
| 59 |
|
| 60 |
#ifdef _MSC_VER |
| 61 |
#pragma warning(pop) |
| 62 |
#endif |
| 63 |
|
| 64 |
#endif |