Kea 3.1.5
asio_wrapper.h
Go to the documentation of this file.
1// Copyright (C) 2016-2025 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6#ifndef ASIO_WRAPPER_H
7#define ASIO_WRAPPER_H 1
8
62
63// Some boost headers need the <utility> header to be included for some Boost versions under C++20.
64// Include it in all situations for simplicity.
65#include <utility>
66
67// Another problem is some boost versions raise a warning with -Wshadow
68// so disable it.
69
70// Another problem is as of Boost 1.89, with g++ on Linux, Woverloaded-virtual is raised in
71// boost/system/detail/error_category_impl.hpp:44. Lots of occurrences, but one location, so it is
72// worth checking if future Boost versions fix it.
73
74#define GNU_CC_VERSION (__GNUC__ * 10000 \
75 + __GNUC_MINOR__ * 100 \
76 + __GNUC_PATCHLEVEL__)
77
78#ifdef __GNUC__
79#pragma GCC diagnostic push
80#pragma GCC diagnostic ignored "-Woverloaded-virtual"
81#pragma GCC diagnostic ignored "-Wshadow"
82#if (((GNU_CC_VERSION >= 50200) && (GNU_CC_VERSION < 60000)) \
83 && defined(BOOST_ERROR_CODE_HEADER_ONLY))
84#pragma GCC push_options
85#pragma GCC optimize ("O0")
86#include <boost/asio.hpp>
87#pragma GCC pop_options
88#else
89#include <boost/asio.hpp>
90#endif
91#pragma GCC diagnostic pop
92#else
93#include <boost/asio.hpp>
94#endif
95
96#endif // ASIO_WRAPPER_H