Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport 8067 to rec 4.2.x: Make sure we always compile with BOOST_CB_ENABLE_DEBUG set to 0 #8074

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions pdns/Makefile.am
Expand Up @@ -162,6 +162,7 @@ pdns_server_SOURCES = \
bindlexer.l \
bindparser.cc \
cachecleaner.hh \
circular_buffer.hh \
comment.hh \
common_startup.cc common_startup.hh \
communicator.cc communicator.hh \
Expand Down Expand Up @@ -297,6 +298,7 @@ pdnsutil_SOURCES = \
bindlexer.l \
bindparser.yy \
cachecleaner.hh \
circular_buffer.hh \
dbdnsseckeeper.cc \
dnsbackend.cc \
dns.cc \
Expand Down
38 changes: 38 additions & 0 deletions pdns/circular_buffer.hh
@@ -0,0 +1,38 @@
/*
* This file is part of PowerDNS or dnsdist.
* Copyright -- PowerDNS.COM B.V. and its contributors
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* In addition, for the avoidance of any doubt, permission is granted to
* link this program with OpenSSL and to (re)distribute the binaries
* produced as the result of such linking.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once

// Disable the non-threadsafe debug code in boost::circular_buffer before 1.62
#define BOOST_CB_DISABLE_DEBUG 1

// Make sure it is also disabled when >= 1.62
#ifndef BOOST_CB_ENABLE_DEBUG
#define BOOST_CB_ENABLE_DEBUG 0
#endif

#if BOOST_CB_ENABLE_DEBUG
// https://github.com/boostorg/circular_buffer/pull/9
// https://svn.boost.org/trac10/ticket/6277
#error Building with BOOST_CB_ENABLE_DEBUG prevents accessing a boost::circular_buffer from more than one thread at once
#endif /* BOOST_CB_ENABLE_DEBUG */

#include <boost/circular_buffer.hpp>
2 changes: 1 addition & 1 deletion pdns/dnsdist-rings.hh
Expand Up @@ -25,9 +25,9 @@
#include <time.h>
#include <unordered_map>

#include <boost/circular_buffer.hpp>
#include <boost/variant.hpp>

#include "circular_buffer.hh"
#include "dnsname.hh"
#include "iputils.hh"

Expand Down
2 changes: 1 addition & 1 deletion pdns/dnsdist.hh
Expand Up @@ -31,11 +31,11 @@
#include <unistd.h>
#include <unordered_map>

#include <boost/circular_buffer.hpp>
#include <boost/variant.hpp>

#include "bpf-filter.hh"
#include "capabilities.hh"
#include "circular_buffer.hh"
#include "dnscrypt.hh"
#include "dnsdist-cache.hh"
#include "dnsdist-dynbpf.hh"
Expand Down
3 changes: 3 additions & 0 deletions pdns/dnsdistdist/Makefile.am
Expand Up @@ -103,6 +103,7 @@ dnsdist_SOURCES = \
bpf-filter.cc bpf-filter.hh \
cachecleaner.hh \
capabilities.cc capabilities.hh \
circular_buffer.hh \
dns.cc dns.hh \
dnscrypt.cc dnscrypt.hh \
dnsdist.cc dnsdist.hh \
Expand Down Expand Up @@ -253,9 +254,11 @@ testrunner_SOURCES = \
test-iputils_hh.cc \
test-mplexer.cc \
cachecleaner.hh \
circular_buffer.hh \
dnsdist.hh \
dnsdist-cache.cc dnsdist-cache.hh \
dnsdist-ecs.cc dnsdist-ecs.hh \
dnsdist-rings.hh \
dnsdist-xpf.cc dnsdist-xpf.hh \
dnscrypt.cc dnscrypt.hh \
dnslabeltext.cc \
Expand Down
1 change: 1 addition & 0 deletions pdns/dnsdistdist/circular_buffer.hh
3 changes: 1 addition & 2 deletions pdns/dnsdistdist/tcpiohandler.cc
@@ -1,6 +1,7 @@
#include <fstream>

#include "config.h"
#include "circular_buffer.hh"
#include "dolog.hh"
#include "iputils.hh"
#include "lock.hh"
Expand All @@ -17,8 +18,6 @@
#include <openssl/rand.h>
#include <openssl/ssl.h>

#include <boost/circular_buffer.hpp>

#include "libssl.hh"

/* From rfc5077 Section 4. Recommended Ticket Construction */
Expand Down
2 changes: 2 additions & 0 deletions pdns/recursordist/Makefile.am
Expand Up @@ -94,6 +94,7 @@ pdns_recursor_SOURCES = \
base64.cc base64.hh \
cachecleaner.hh \
capabilities.cc capabilities.hh \
circular_buffer.hh \
comment.hh \
dns.hh dns.cc \
dns_random.hh dns_random.cc \
Expand Down Expand Up @@ -211,6 +212,7 @@ testrunner_SOURCES = \
arguments.cc \
base32.cc \
base64.cc base64.hh \
circular_buffer.hh \
dns.cc dns.hh \
dns_random.cc dns_random.hh \
dnslabeltext.cc \
Expand Down
1 change: 1 addition & 0 deletions pdns/recursordist/circular_buffer.hh
2 changes: 1 addition & 1 deletion pdns/remote_logger.hh
Expand Up @@ -30,7 +30,7 @@
#include <thread>

#include "iputils.hh"
#include <boost/circular_buffer.hpp>
#include "circular_buffer.hh"

/* Writes can be submitted and they are atomically accepted. Either the whole write
ends up in the buffer or nothing ends up in the buffer.
Expand Down
2 changes: 1 addition & 1 deletion pdns/statbag.hh
Expand Up @@ -29,7 +29,7 @@
#include "lock.hh"
#include "namespaces.hh"
#include "iputils.hh"
#include <boost/circular_buffer.hpp>
#include "circular_buffer.hh"



Expand Down
2 changes: 1 addition & 1 deletion pdns/syncres.hh
Expand Up @@ -35,8 +35,8 @@
#include "misc.hh"
#include "lwres.hh"
#include <boost/optional.hpp>
#include <boost/circular_buffer.hpp>
#include <boost/utility.hpp>
#include "circular_buffer.hh"
#include "sstuff.hh"
#include "recursor_cache.hh"
#include "recpacketcache.hh"
Expand Down
1 change: 0 additions & 1 deletion pdns/ws-api.cc
Expand Up @@ -24,7 +24,6 @@
#endif

#include <boost/tokenizer.hpp>
#include <boost/circular_buffer.hpp>
#include "namespaces.hh"
#include "ws-api.hh"
#include "json.hh"
Expand Down