From 9ae2faab7cac6b3a9ba13e53f8bee7db12a18db3 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Thu, 11 Jul 2019 17:09:05 +0200 Subject: [PATCH] Make sure we always compile with BOOST_CB_ENABLE_DEBUG set to 0 (cherry picked from commit 9f6a31fffe1f4bd77fd402f997a5f37a58f72fc5) --- pdns/Makefile.am | 2 ++ pdns/circular_buffer.hh | 34 ++++++++++++++++++++++++++++ pdns/dnsdist-rings.hh | 2 +- pdns/dnsdist.hh | 2 +- pdns/dnsdistdist/Makefile.am | 3 +++ pdns/dnsdistdist/circular_buffer.hh | 1 + pdns/dnsdistdist/tcpiohandler.cc | 3 +-- pdns/recursordist/Makefile.am | 2 ++ pdns/recursordist/circular_buffer.hh | 1 + pdns/remote_logger.hh | 2 +- pdns/statbag.hh | 2 +- pdns/syncres.hh | 2 +- pdns/ws-api.cc | 1 - 13 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 pdns/circular_buffer.hh create mode 120000 pdns/dnsdistdist/circular_buffer.hh create mode 120000 pdns/recursordist/circular_buffer.hh diff --git a/pdns/Makefile.am b/pdns/Makefile.am index 221ef0990..2b7c3045d 100644 --- a/pdns/Makefile.am +++ b/pdns/Makefile.am @@ -160,6 +160,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 \ @@ -295,6 +296,7 @@ pdnsutil_SOURCES = \ bindlexer.l \ bindparser.yy \ cachecleaner.hh \ + circular_buffer.hh \ dbdnsseckeeper.cc \ dnsbackend.cc \ dns.cc \ diff --git a/pdns/circular_buffer.hh b/pdns/circular_buffer.hh new file mode 100644 index 000000000..f9607f8a2 --- /dev/null +++ b/pdns/circular_buffer.hh @@ -0,0 +1,34 @@ +/* + * 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 + +#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 two threads at once +#endif /* BOOST_CB_ENABLE_DEBUG */ + +#include diff --git a/pdns/dnsdist-rings.hh b/pdns/dnsdist-rings.hh index a773ed6e9..8a3e089d5 100644 --- a/pdns/dnsdist-rings.hh +++ b/pdns/dnsdist-rings.hh @@ -25,9 +25,9 @@ #include #include -#include #include +#include "circular_buffer.hh" #include "dnsname.hh" #include "iputils.hh" diff --git a/pdns/dnsdist.hh b/pdns/dnsdist.hh index a96a87b43..389d91099 100644 --- a/pdns/dnsdist.hh +++ b/pdns/dnsdist.hh @@ -31,11 +31,11 @@ #include #include -#include #include #include "bpf-filter.hh" #include "capabilities.hh" +#include "circular_buffer.hh" #include "dnscrypt.hh" #include "dnsdist-cache.hh" #include "dnsdist-dynbpf.hh" diff --git a/pdns/dnsdistdist/Makefile.am b/pdns/dnsdistdist/Makefile.am index 2112afa53..ae22d8d95 100644 --- a/pdns/dnsdistdist/Makefile.am +++ b/pdns/dnsdistdist/Makefile.am @@ -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 \ @@ -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 \ diff --git a/pdns/dnsdistdist/circular_buffer.hh b/pdns/dnsdistdist/circular_buffer.hh new file mode 120000 index 000000000..b0b789565 --- /dev/null +++ b/pdns/dnsdistdist/circular_buffer.hh @@ -0,0 +1 @@ +../circular_buffer.hh \ No newline at end of file diff --git a/pdns/dnsdistdist/tcpiohandler.cc b/pdns/dnsdistdist/tcpiohandler.cc index 959648134..9c25fea0f 100644 --- a/pdns/dnsdistdist/tcpiohandler.cc +++ b/pdns/dnsdistdist/tcpiohandler.cc @@ -1,6 +1,7 @@ #include #include "config.h" +#include "circular_buffer.hh" #include "dolog.hh" #include "iputils.hh" #include "lock.hh" @@ -17,8 +18,6 @@ #include #include -#include - #include "libssl.hh" /* From rfc5077 Section 4. Recommended Ticket Construction */ diff --git a/pdns/recursordist/Makefile.am b/pdns/recursordist/Makefile.am index 12d93f680..092a8c60d 100644 --- a/pdns/recursordist/Makefile.am +++ b/pdns/recursordist/Makefile.am @@ -100,6 +100,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 \ @@ -218,6 +219,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 \ diff --git a/pdns/recursordist/circular_buffer.hh b/pdns/recursordist/circular_buffer.hh new file mode 120000 index 000000000..b0b789565 --- /dev/null +++ b/pdns/recursordist/circular_buffer.hh @@ -0,0 +1 @@ +../circular_buffer.hh \ No newline at end of file diff --git a/pdns/remote_logger.hh b/pdns/remote_logger.hh index 95fd634de..a350729ad 100644 --- a/pdns/remote_logger.hh +++ b/pdns/remote_logger.hh @@ -30,7 +30,7 @@ #include #include "iputils.hh" -#include +#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. diff --git a/pdns/statbag.hh b/pdns/statbag.hh index f36c211f6..a9839693f 100644 --- a/pdns/statbag.hh +++ b/pdns/statbag.hh @@ -29,7 +29,7 @@ #include "lock.hh" #include "namespaces.hh" #include "iputils.hh" -#include +#include "circular_buffer.hh" diff --git a/pdns/syncres.hh b/pdns/syncres.hh index 58390eca6..1a52e7abb 100644 --- a/pdns/syncres.hh +++ b/pdns/syncres.hh @@ -35,8 +35,8 @@ #include "misc.hh" #include "lwres.hh" #include -#include #include +#include "circular_buffer.hh" #include "sstuff.hh" #include "recursor_cache.hh" #include "recpacketcache.hh" diff --git a/pdns/ws-api.cc b/pdns/ws-api.cc index ae62d7dd7..54dde0079 100644 --- a/pdns/ws-api.cc +++ b/pdns/ws-api.cc @@ -24,7 +24,6 @@ #endif #include -#include #include "namespaces.hh" #include "ws-api.hh" #include "json.hh" -- 2.40.0