Commit 082f846f authored by Thomas Markwalder's avatar Thomas Markwalder

[master] Mitigate GCC 5.x optmizer issue in asiolink

    Merged in trac4243.
parents abee3e73 b71852dc
// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
#include <asiolink/asio_wrapper.h>
#include <cc/command_interpreter.h>
#include <d2/d2_log.h>
#include <d2/d2_cfg_mgr.h>
#include <d2/d2_process.h>
#include <boost/asio.hpp>
namespace isc {
namespace d2 {
......
// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
#include <asiolink/asio_wrapper.h>
#include <asiolink/udp_endpoint.h>
#include <d2/d2_cfg_mgr.h>
#include <dns/opcode.h>
#include <dns/messagerenderer.h>
#include <nc_test_utils.h>
#include <boost/asio.hpp>
#include <asiolink/udp_endpoint.h>
#include <util/encode/base64.h>
#include <gtest/gtest.h>
......
// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
#include <asiolink/asio_wrapper.h>
#include <asiolink/io_service.h>
#include <asiolink/interval_timer.h>
#include <d2/nc_trans.h>
......@@ -16,10 +16,6 @@
#include <util/buffer.h>
#include <nc_test_utils.h>
#include <boost/asio/ip/udp.hpp>
#include <boost/asio/socket_base.hpp>
#include <boost/asio.hpp>
#include <boost/function.hpp>
#include <boost/bind.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
......
......@@ -50,7 +50,6 @@
#endif
#include <dhcpsrv/memfile_lease_mgr.h>
#include <boost/asio.hpp>
#include <boost/bind.hpp>
#include <boost/foreach.hpp>
#include <boost/shared_ptr.hpp>
......
......@@ -26,6 +26,7 @@ AM_CPPFLAGS += -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\"
CLEANFILES = $(builddir)/interfaces.txt $(builddir)/logger_lockfile
CLEANFILES += $(builddir)/load_marker.txt $(builddir)/unload_marker.txt
CLEANFILES += $(builddir)/test_leases.csv.*
CLEANFILES += *.json *.log
DISTCLEANFILES = dhcp4_process_tests.sh
......
......@@ -58,8 +58,6 @@
#endif
#include <dhcpsrv/memfile_lease_mgr.h>
#include <boost/asio.hpp>
#include <boost/bind.hpp>
#include <boost/foreach.hpp>
#include <boost/tokenizer.hpp>
......
......@@ -27,6 +27,7 @@ AM_CPPFLAGS += -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\"
CLEANFILES = $(builddir)/logger_lockfile
CLEANFILES += $(builddir)/load_marker.txt $(builddir)/unload_marker.txt
CLEANFILES += $(builddir)/test_leases.csv.*
CLEANFILES += *.json *.log
DISTCLEANFILES = dhcp6_process_tests.sh
......
// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
#include <unistd.h> // for some IPC/network system calls
#include <netinet/in.h>
#include <stdint.h>
#include <sys/socket.h>
#include <boost/bind.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/asio.hpp>
#include <boost/asio/deadline_timer.hpp>
#include <asiolink/asio_wrapper.h>
#include <asiolink/io_address.h>
#include <asiolink/io_asio_socket.h>
#include <asiolink/io_endpoint.h>
......@@ -26,17 +14,22 @@
#include <asiolink/tcp_socket.h>
#include <asiolink/udp_endpoint.h>
#include <asiolink/udp_socket.h>
#include <asiodns/io_fetch.h>
#include <asiodns/logger.h>
#include <dns/messagerenderer.h>
#include <dns/opcode.h>
#include <dns/rcode.h>
#include <asiodns/io_fetch.h>
#include <util/buffer.h>
#include <util/random/qid_gen.h>
#include <asiodns/logger.h>
#include <boost/bind.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <unistd.h> // for some IPC/network system calls
#include <netinet/in.h>
#include <stdint.h>
#include <sys/socket.h>
using namespace boost::asio;
using namespace isc::asiolink;
......
// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
#include <asiolink/asio_wrapper.h>
#include <asiolink/io_address.h>
#include <asiolink/io_endpoint.h>
#include <asiolink/io_service.h>
#include <asiodns/io_fetch.h>
#include <dns/question.h>
#include <dns/message.h>
#include <dns/messagerenderer.h>
#include <dns/opcode.h>
#include <dns/name.h>
#include <dns/rcode.h>
#include <util/buffer.h>
#include <util/io_utilities.h>
#include <gtest/gtest.h>
#include <boost/bind.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <algorithm>
#include <cstdlib>
......@@ -14,27 +31,6 @@
#include <iterator>
#include <vector>
#include <gtest/gtest.h>
#include <boost/bind.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/asio.hpp>
#include <util/buffer.h>
#include <util/io_utilities.h>
#include <dns/question.h>
#include <dns/message.h>
#include <dns/messagerenderer.h>
#include <dns/opcode.h>
#include <dns/name.h>
#include <dns/rcode.h>
#include <asiolink/io_address.h>
#include <asiolink/io_endpoint.h>
#include <asiolink/io_service.h>
#include <asiodns/io_fetch.h>
using namespace boost::asio;
using namespace isc::dns;
using namespace isc::util;
......
......@@ -18,6 +18,7 @@ lib_LTLIBRARIES = libkea-asiolink.la
libkea_asiolink_la_LDFLAGS = -no-undefined -version-info 2:0:0
libkea_asiolink_la_SOURCES = asiolink.h
libkea_asiolink_la_SOURCES += asio_wrapper.h
libkea_asiolink_la_SOURCES += dummy_io_cb.h
libkea_asiolink_la_SOURCES += interval_timer.cc interval_timer.h
libkea_asiolink_la_SOURCES += io_address.cc io_address.h
......
// Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef ASIO_WRAPPER_H
#define ASIO_WRAPPER_H 1
// !!! IMPORTANT !!!!
// This file must be included anywhere one would normally have included
// boost/asio.hpp. Until the issue described below is resolved in some
// other fashion asio.hpp should not be included other than through
// this file.
//
// The optimizer as of gcc 5.2.0, may not reliably ensure a single value
// returned by boost::system::system_category() within a translation unit
// when building the header only version of the boost error handling.
// See Trac #4243 for more details. For now we turn off optimization for
// header only builds the under the suspect GCC versions.
//
// The issue arises from in-lining the above function, which returns a
// reference to a local static variable, system_category_const. This leads
// to situations where a construct such as the following:
//
// {{{
// if (ec == boost::asio::error::would_block
// || ec == boost::asio::error::try_again)
// return false;
// }}}
//
// which involve implicit conversion of enumerates to error_code instances
// to not evaluate correctly. During the implicit conversion the error_code
// instances may be assigned differeing values error_code:m_cat. This
// causes two instances of error_code which should have been equal to
// to not be equal.
//
// The problem disappers if either error handling code is not built header
// only as this results in a single definiton of system_category() supplied
// by libboost_system; or the error handling code is not optimized.
//
// We're doing the test here, rather than in configure to guard against the
// user supplying the header only flag via environment variables.
//
// We opened bugs with GNU and BOOST:
//
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69789
// https://svn.boost.org/trac/boost/ticket/11989
//
// @todo Currently, 5.3.0 is the latest released versio of GCC. Version 6.0 is
// in development and will need to be tested.
#define GNU_CC_VERSION (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100 \
+ __GNUC_PATCHLEVEL__)
#if (defined(__GNUC__) && \
((GNU_CC_VERSION >= 50200) && (GNU_CC_VERSION <= 50301)) \
&& defined(BOOST_ERROR_CODE_HEADER_ONLY))
#pragma GCC push_options
#pragma GCC optimize ("O0")
#include <boost/asio.hpp>
#pragma GCC pop_options
#else
#include <boost/asio.hpp>
#endif
#endif // ASIO_WRAPPER_H
// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
#include <asiolink/asio_wrapper.h>
#include <asiolink/interval_timer.h>
#include <asiolink/io_service.h>
#include <boost/bind.hpp>
#include <boost/enable_shared_from_this.hpp>
......@@ -12,10 +15,6 @@
#include <exceptions/exceptions.h>
#include <boost/asio.hpp>
#include <asiolink/interval_timer.h>
#include <asiolink/io_service.h>
namespace isc {
namespace asiolink {
......
// Copyright (C) 2010-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2010-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
#include <asiolink/asio_wrapper.h>
#include <asiolink/io_address.h>
#include <asiolink/io_error.h>
#include <exceptions/exceptions.h>
#include <boost/static_assert.hpp>
#include <unistd.h> // for some IPC/network system calls
#include <stdint.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <boost/asio.hpp>
#include <exceptions/exceptions.h>
#include <asiolink/io_address.h>
#include <asiolink/io_error.h>
#include <boost/static_assert.hpp>
using namespace boost::asio;
using boost::asio::ip::udp;
using boost::asio::ip::tcp;
......
// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
#include <boost/asio.hpp>
#include <asiolink/asio_wrapper.h>
#include <asiolink/io_address.h>
#include <asiolink/io_error.h>
#include <asiolink/io_endpoint.h>
......
// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
#include <asiolink/asio_wrapper.h>
#include <asiolink/io_service.h>
#include <unistd.h> // for some IPC/network system calls
#include <netinet/in.h>
#include <sys/socket.h>
#include <boost/asio.hpp>
#include <asiolink/io_service.h>
namespace isc {
namespace asiolink {
......
// Copyright (C) 2010-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2010-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include "io_socket.h"
#include <boost/asio.hpp>
#include <config.h>
#include <asiolink/asio_wrapper.h>
#include <asiolink/io_socket.h>
namespace isc {
namespace asiolink {
......
// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
#include <gtest/gtest.h>
#include <boost/asio.hpp>
#include <asiolink/asio_wrapper.h>
#include <asiolink/dummy_io_cb.h>
#include <gtest/gtest.h>
using namespace isc::asiolink;
using namespace boost::asio;
......
// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
#include <gtest/gtest.h>
#include <boost/asio.hpp>
#include <asiolink/asio_wrapper.h>
#include <asiolink/asiolink.h>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <gtest/gtest.h>
namespace {
// TODO: Consider this margin
......
// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
#include <gtest/gtest.h>
#include <asiolink/asio_wrapper.h>
#include <asiolink/io_socket.h>
#include <gtest/gtest.h>
#include <netinet/in.h>
#include <boost/asio.hpp>
#include <asiolink/io_socket.h>
using namespace isc::asiolink;
TEST(IOSocketTest, dummySockets) {
......
// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
#include <string>
#include <asiolink/asio_wrapper.h>
#include <asiolink/io_address.h>
#include <asiolink/tcp_endpoint.h>
#include <gtest/gtest.h>
#include <boost/asio.hpp>
#include <asiolink/io_address.h>
#include <asiolink/tcp_endpoint.h>
#include <string>
using namespace isc::asiolink;
using namespace std;
......
// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -11,33 +11,27 @@
/// work.
#include <config.h>
#include <asiolink/asio_wrapper.h>
#include <asiolink/io_service.h>
#include <asiolink/tcp_endpoint.h>
#include <asiolink/tcp_socket.h>
#include <util/buffer.h>
#include <util/io_utilities.h>
#include <string>
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
#include <gtest/gtest.h>
#include <string>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <algorithm>
#include <cstdlib>
#include <cstddef>
#include <vector>
#include <gtest/gtest.h>
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
#include <util/buffer.h>
#include <util/io_utilities.h>
#include <boost/asio.hpp>
#include <asiolink/io_service.h>
#include <asiolink/tcp_endpoint.h>
#include <asiolink/tcp_socket.h>
using namespace boost::asio;
using namespace boost::asio::ip;
using namespace isc::util;
......
// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
#include <string>
#include <asiolink/asio_wrapper.h>
#include <asiolink/io_address.h>
#include <asiolink/udp_endpoint.h>
#include <gtest/gtest.h>
#include <boost/asio.hpp>
#include <asiolink/io_address.h>
#include <asiolink/udp_endpoint.h>
#include <string>
using namespace isc::asiolink;
using namespace std;
......
// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -11,32 +11,27 @@
/// work.
#include <config.h>
#include <asiolink/asio_wrapper.h>
#include <asiolink/io_service.h>
#include <asiolink/udp_endpoint.h>
#include <asiolink/udp_socket.h>
#include <util/buffer.h>
#include <util/io_utilities.h>
#include <string>
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
#include <gtest/gtest.h>
#include <string>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <algorithm>
#include <cstdlib>
#include <cstddef>
#include <vector>
#include <gtest/gtest.h>
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
#include <util/buffer.h>
#include <util/io_utilities.h>
#include <boost/asio.hpp>
#include <asiolink/io_service.h>
#include <asiolink/udp_endpoint.h>
#include <asiolink/udp_socket.h>
using namespace boost::asio;
using namespace isc::util;
......
// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
// This must be included before udp_endpoint.h
#include <boost/asio.hpp>
#include <asiolink/asio_wrapper.h>
#include <asiolink/io_error.h>
#include <asiolink/udp_endpoint.h>
#include <dhcp/dhcp4.h>
......
// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
#include <asiolink/asio_wrapper.h>
#include <dhcp_ddns/dhcp_ddns_log.h>
#include <dhcp_ddns/ncr_io.h>
#include <boost/asio.hpp>
#include <boost/algorithm/string/predicate.hpp>
namespace isc {
......
// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -9,8 +9,6 @@
#include <dhcp_ddns/dhcp_ddns_log.h>
#include <dhcp_ddns/ncr_udp.h>