From: Remi Gacogne Date: Fri, 24 Apr 2020 13:36:08 +0000 (+0200) Subject: Fix warnings about dup/missing prototypes X-Git-Tag: dnsdist-1.5.0-rc2~11^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=050e6877ab46b3492d935553e77e1ced3d410959;p=thirdparty%2Fpdns.git Fix warnings about dup/missing prototypes --- diff --git a/modules/geoipbackend/geoipbackend.cc b/modules/geoipbackend/geoipbackend.cc index 2238ababdf..d812efa315 100644 --- a/modules/geoipbackend/geoipbackend.cc +++ b/modules/geoipbackend/geoipbackend.cc @@ -519,7 +519,7 @@ string getGeoForLua(const std::string& ip, int qaint) return ""; } -bool queryGeoLocation(const Netmask& addr, GeoIPNetmask& gl, double& lat, double& lon, +static bool queryGeoLocation(const Netmask& addr, GeoIPNetmask& gl, double& lat, double& lon, boost::optional& alt, boost::optional& prec) { for(auto const& gi: s_geoip_files) { diff --git a/modules/lmdbbackend/lmdbbackend.cc b/modules/lmdbbackend/lmdbbackend.cc index 624a4c1432..56096cd460 100644 --- a/modules/lmdbbackend/lmdbbackend.cc +++ b/modules/lmdbbackend/lmdbbackend.cc @@ -231,13 +231,13 @@ void serFromString(const string_view& str, DNSResourceRecord& rr) } -std::string serializeContent(uint16_t qtype, const DNSName& domain, const std::string& content) +static std::string serializeContent(uint16_t qtype, const DNSName& domain, const std::string& content) { auto drc = DNSRecordContent::mastermake(qtype, 1, content); return drc->serialize(domain, false); } -std::shared_ptr deserializeContentZR(uint16_t qtype, const DNSName& qname, const std::string& content) +static std::shared_ptr deserializeContentZR(uint16_t qtype, const DNSName& qname, const std::string& content) { if(qtype == QType::A && content.size() == 4) { return std::make_shared(*((uint32_t*)content.c_str())); diff --git a/pdns/auth-caches.cc b/pdns/auth-caches.cc index c33575a23d..4fd75bb74a 100644 --- a/pdns/auth-caches.cc +++ b/pdns/auth-caches.cc @@ -20,6 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include "auth-caches.hh" #include "auth-querycache.hh" #include "auth-packetcache.hh" diff --git a/pdns/base32.cc b/pdns/base32.cc index 16d9d4bab4..b07ed50cee 100644 --- a/pdns/base32.cc +++ b/pdns/base32.cc @@ -33,7 +33,7 @@ /* based on freebsd:src/contrib/opie/libopie/btoe.c extract: get bit ranges from a char* */ /* NOTE: length should not exceed 8; all callers inside PowerDNS only pass length=5 though */ -unsigned char extract_bits(const char *s, int start, int length) +static unsigned char extract_bits(const char *s, int start, int length) { uint16_t x; unsigned char cl, cc; diff --git a/pdns/bindparser.yy b/pdns/bindparser.yy index df05341467..4557c832a1 100644 --- a/pdns/bindparser.yy +++ b/pdns/bindparser.yy @@ -22,7 +22,8 @@ extern "C" int yyparse(void); int yylex(void); void yyrestart(FILE *); - int yywrap() + int yywrap(void); + int yywrap(void) { return 1; } diff --git a/pdns/common_startup.hh b/pdns/common_startup.hh index 45c8045c0c..9ce7101b94 100644 --- a/pdns/common_startup.hh +++ b/pdns/common_startup.hh @@ -45,7 +45,6 @@ extern std::shared_ptr N; extern vector > g_udpReceivers; extern int avg_latency; extern std::unique_ptr TN; -extern ArgvMap & arg( void ); extern void declareArguments(); extern void declareStats(); extern void mainthread(); diff --git a/pdns/dnsbulktest.cc b/pdns/dnsbulktest.cc index a93866e99d..5570728b91 100644 --- a/pdns/dnsbulktest.cc +++ b/pdns/dnsbulktest.cc @@ -215,7 +215,7 @@ struct SendReceive unsigned int d_receiveds, d_receiveerrors, d_senderrors; }; -void usage(po::options_description &desc) { +static void usage(po::options_description &desc) { cerr << "Usage: dnsbulktest [OPTION].. IPADDRESS PORTNUMBER [LIMIT]"< #include "dnsname.hh" #include "namespaces.hh" +#include "dnswriter.hh" namespace { void appendSplit(vector& ret, string& segment, char c) diff --git a/pdns/dnsreplay.cc b/pdns/dnsreplay.cc index f82d6542b0..c7cda449bb 100644 --- a/pdns/dnsreplay.cc +++ b/pdns/dnsreplay.cc @@ -93,7 +93,7 @@ namespace po = boost::program_options; po::variables_map g_vm; -const struct timeval operator*(float fact, const struct timeval& rhs) +static const struct timeval operator*(float fact, const struct timeval& rhs) { // cout<<"In: "<& compacted) +static void compactAnswerSet(MOADNSParser::answers_t orig, set& compacted) { for(MOADNSParser::answers_t::const_iterator i=orig.begin(); i != orig.end(); ++i) if(i->first.d_place==DNSResourceRecord::ANSWER) compacted.insert(i->first); } -bool isRcodeOk(int rcode) +static bool isRcodeOk(int rcode) { return rcode==0 || rcode==3; } set > s_origbetterset; -bool isRootReferral(const MOADNSParser::answers_t& answers) +static bool isRootReferral(const MOADNSParser::answers_t& answers) { if(answers.empty()) return false; @@ -296,7 +296,7 @@ bool isRootReferral(const MOADNSParser::answers_t& answers) } vector flightTimes; -void accountFlightTime(qids_t::const_iterator iter) +static void accountFlightTime(qids_t::const_iterator iter) { if(flightTimes.empty()) flightTimes.resize(2050); @@ -310,7 +310,7 @@ void accountFlightTime(qids_t::const_iterator iter) flightTimes[mdiff]++; } -uint64_t countLessThan(unsigned int msec) +static uint64_t countLessThan(unsigned int msec) { uint64_t ret=0; for(unsigned int i = 0 ; i < msec && i < flightTimes.size() ; ++i) { @@ -319,7 +319,7 @@ uint64_t countLessThan(unsigned int msec) return ret; } -void emitFlightTimes() +static void emitFlightTimes() { uint64_t totals = countLessThan(flightTimes.size()); unsigned int limits[]={1, 2, 3, 4, 5, 10, 20, 30, 40, 50, 100, 200, 500, 1000, (unsigned int) flightTimes.size()}; @@ -338,7 +338,7 @@ void emitFlightTimes() } } -void measureResultAndClean(qids_t::const_iterator iter) +static void measureResultAndClean(qids_t::const_iterator iter) { const QuestionData& qd=*iter; accountFlightTime(iter); @@ -406,7 +406,7 @@ void measureResultAndClean(qids_t::const_iterator iter) std::unique_ptr s_socket = nullptr; -void receiveFromReference() +static void receiveFromReference() try { string packet; @@ -469,7 +469,7 @@ catch(...) exit(1); } -void pruneQids() +static void pruneQids() { struct timeval now; gettimeofday(&now, 0); @@ -491,7 +491,7 @@ void pruneQids() } } -void printStats(uint64_t origWaitingFor=0, uint64_t weWaitingFor=0) +static void printStats(uint64_t origWaitingFor=0, uint64_t weWaitingFor=0) { format headerfmt ("%|9t|Questions - Pend. - Drop = Answers = (On time + Late) = (Err + Ok)\n"); format datafmt("%s%|9t|%d %|21t|%d %|29t|%d %|36t|%d %|47t|%d %|57t|%d %|66t|%d %|72t|%d\n"); @@ -511,7 +511,7 @@ void printStats(uint64_t origWaitingFor=0, uint64_t weWaitingFor=0) } -void houseKeeping() +static void houseKeeping() { static timeval last; @@ -703,7 +703,7 @@ static bool sendPacketFromPR(PcapPacketReader& pr, const ComboAddress& remote, i return sent; } -void usage(po::options_description &desc) { +static void usage(po::options_description &desc) { cerr << "Usage: dnsreplay [OPTIONS] FILENAME [IP-ADDRESS] [PORT]"< statmap_t; statmap_t statmap; -unsigned int liveQuestions() +static unsigned int liveQuestions() { unsigned int ret=0; for(statmap_t::value_type& val : statmap) { @@ -107,7 +107,7 @@ struct LiveCounts } }; -void visitor(const StatNode* node, const StatNode::Stat& selfstat, const StatNode::Stat& childstat) +static void visitor(const StatNode* node, const StatNode::Stat& selfstat, const StatNode::Stat& childstat) { // 20% servfails, >100 children, on average less than 2 copies of a query // >100 different subqueries @@ -123,7 +123,7 @@ void visitor(const StatNode* node, const StatNode::Stat& selfstat, const StatNod } } -const struct timeval operator-(const struct pdns_timeval& lhs, const struct pdns_timeval& rhs) +static const struct timeval operator-(const struct pdns_timeval& lhs, const struct pdns_timeval& rhs) { struct timeval a{lhs.tv_sec, static_cast(lhs.tv_usec)}, b{rhs.tv_sec, static_cast(rhs.tv_usec)}; return operator-(a,b); diff --git a/pdns/dnstcpbench.cc b/pdns/dnstcpbench.cc index eef6227290..922c05ff22 100644 --- a/pdns/dnstcpbench.cc +++ b/pdns/dnstcpbench.cc @@ -51,7 +51,7 @@ unsigned int g_timeoutMsec; AtomicCounter g_networkErrors, g_otherErrors, g_OK, g_truncates, g_authAnswers, g_timeOuts; ComboAddress g_dest; -unsigned int makeUsec(const struct timeval& tv) +static unsigned int makeUsec(const struct timeval& tv) { return 1000000*tv.tv_sec + tv.tv_usec; } @@ -69,7 +69,7 @@ struct BenchQuery time_t answerSecond; }; -void doQuery(BenchQuery* q) +static void doQuery(BenchQuery* q) try { vector packet; @@ -185,7 +185,7 @@ static void* worker(void*) return 0; } -void usage(po::options_description &desc) { +static void usage(po::options_description &desc) { cerr<<"Syntax: dnstcpbench REMOTE [PORT] < QUERIES"<&parts, Utility::pid_t ppid); string DLCurrentConfigHandler(const vector&parts, Utility::pid_t ppid); string DLListZones(const vector&parts, Utility::pid_t ppid); string DLTokenLogin(const vector&parts, Utility::pid_t ppid); -uint64_t udpErrorStats(const std::string& str); diff --git a/pdns/fuzz_dnsdistcache.cc b/pdns/fuzz_dnsdistcache.cc index 8b2ed7d1fe..8b670fe470 100644 --- a/pdns/fuzz_dnsdistcache.cc +++ b/pdns/fuzz_dnsdistcache.cc @@ -22,6 +22,8 @@ #include "dnsdist-cache.hh" +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size); + extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (size > std::numeric_limits::max()) { diff --git a/pdns/fuzz_moadnsparser.cc b/pdns/fuzz_moadnsparser.cc index ea5fe25e9f..2605ea8204 100644 --- a/pdns/fuzz_moadnsparser.cc +++ b/pdns/fuzz_moadnsparser.cc @@ -31,6 +31,8 @@ static void init() reportAllTypes(); } +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size); + extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { static bool initialized = false; diff --git a/pdns/fuzz_packetcache.cc b/pdns/fuzz_packetcache.cc index faea016920..1658b18f55 100644 --- a/pdns/fuzz_packetcache.cc +++ b/pdns/fuzz_packetcache.cc @@ -25,6 +25,8 @@ StatBag S; +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size); + extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (size > std::numeric_limits::max()) { diff --git a/pdns/fuzz_proxyprotocol.cc b/pdns/fuzz_proxyprotocol.cc index d138d6faac..25885c8883 100644 --- a/pdns/fuzz_proxyprotocol.cc +++ b/pdns/fuzz_proxyprotocol.cc @@ -22,6 +22,8 @@ #include "proxy-protocol.hh" +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size); + extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { std::vector values; diff --git a/pdns/fuzz_zoneparsertng.cc b/pdns/fuzz_zoneparsertng.cc index 442555b122..3285860a9d 100644 --- a/pdns/fuzz_zoneparsertng.cc +++ b/pdns/fuzz_zoneparsertng.cc @@ -33,6 +33,8 @@ static void init() reportAllTypes(); } +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size); + extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { static bool initialized = false; diff --git a/pdns/ixfrdist-stats.hh b/pdns/ixfrdist-stats.hh index 4c8b25b846..addfe06003 100644 --- a/pdns/ixfrdist-stats.hh +++ b/pdns/ixfrdist-stats.hh @@ -96,3 +96,5 @@ class ixfrdistStats { return ret; }; }; + +extern string doGetStats(); diff --git a/pdns/ixfrdist-web.cc b/pdns/ixfrdist-web.cc index 485e720bcd..dababdc3fd 100644 --- a/pdns/ixfrdist-web.cc +++ b/pdns/ixfrdist-web.cc @@ -25,8 +25,6 @@ #include "iputils.hh" #include "ixfrdist-stats.hh" -string doGetStats(); - IXFRDistWebServer::IXFRDistWebServer(const ComboAddress &listenAddress, const NetmaskGroup &acl, const string &loglevel) : d_ws(std::unique_ptr(new WebServer(listenAddress.toString(), listenAddress.getPort()))) { diff --git a/pdns/ixfrdist.cc b/pdns/ixfrdist.cc index 7d9a0eb027..0ad22589ef 100644 --- a/pdns/ixfrdist.cc +++ b/pdns/ixfrdist.cc @@ -271,7 +271,7 @@ static void updateCurrentZoneInfo(const DNSName& domain, std::shared_ptr lastCheck; diff --git a/pdns/ixplore.cc b/pdns/ixplore.cc index 9b525de1b0..b68e884a86 100644 --- a/pdns/ixplore.cc +++ b/pdns/ixplore.cc @@ -46,7 +46,7 @@ ArgvMap &arg() return theArg; } -void usage() { +static void usage() { cerr<<"Syntax: ixplore diff ZONE BEFORE_FILE AFTER_FILE"< g_getGeo; @@ -527,7 +527,7 @@ typedef struct AuthLuaRecordContext static thread_local unique_ptr s_lua_record_ctx; -void setupLuaRecords() +static void setupLuaRecords() { LuaContext& lua = *s_LUA->getLua(); diff --git a/pdns/notify.cc b/pdns/notify.cc index dace6775c0..597b833492 100644 --- a/pdns/notify.cc +++ b/pdns/notify.cc @@ -52,7 +52,7 @@ ArgvMap &arg() return arg; } -void usage() { +static void usage() { cerr<<"Syntax: pdns_notify IP_ADDRESS/HOSTNAME[:PORT] DOMAIN"< nifs_t; nifs_t g_nifs; -void syslogFmt(const boost::format& fmt) +static void syslogFmt(const boost::format& fmt) { cerr<<"nproxy: "< nsec3; typedef set nsec3set; -string nsec3Hash(const DNSName &qname, const string &salt, unsigned int iters) +static string nsec3Hash(const DNSName &qname, const string &salt, unsigned int iters) { NSEC3PARAMRecordContent ns3prc; ns3prc.d_iterations = iters; @@ -45,7 +45,7 @@ string nsec3Hash(const DNSName &qname, const string &salt, unsigned int iters) return toBase32Hex(hashQNameWithSalt(ns3prc, qname)); } -void proveOrDeny(const nsec3set &nsec3s, const DNSName &qname, const string &salt, unsigned int iters, set &proven, set &denied) +static void proveOrDeny(const nsec3set &nsec3s, const DNSName &qname, const string &salt, unsigned int iters, set &proven, set &denied) { string hashed = nsec3Hash(qname, salt, iters); @@ -79,7 +79,7 @@ void proveOrDeny(const nsec3set &nsec3s, const DNSName &qname, const string &sal } } -void usage() { +static void usage() { cerr<<"nsec3dig"< makeSOAContent(const SOAData& sd); diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 53b6fc5256..712c9cc6cb 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -371,11 +371,6 @@ unsigned int getRecursorThreadId() return t_id; } -int getMTaskerTID() -{ - return MT->getTid(); -} - static bool isDistributorThread() { if (t_id == 0) { @@ -3488,19 +3483,13 @@ template void *voider(const boost::function& func) return func(); } -vector& operator+=(vector&a, const vector& b) -{ - a.insert(a.end(), b.begin(), b.end()); - return a; -} - -vector >& operator+=(vector >&a, const vector >& b) +static vector& operator+=(vector&a, const vector& b) { a.insert(a.end(), b.begin(), b.end()); return a; } -vector >& operator+=(vector >&a, const vector >& b) +static vector >& operator+=(vector >&a, const vector >& b) { a.insert(a.end(), b.begin(), b.end()); return a; @@ -3747,7 +3736,7 @@ retryWithName: } } -FDMultiplexer* getMultiplexer() +static FDMultiplexer* getMultiplexer() { FDMultiplexer* ret; for(const auto& i : FDMultiplexer::getMultiplexerMap()) { @@ -4060,7 +4049,7 @@ static void setupNODThread() } } -void parseNODWhitelist(const std::string& wlist) +static void parseNODWhitelist(const std::string& wlist) { vector parts; stringtok(parts, wlist, ",; "); diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index cf2a2b63b0..406f5b074d 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -51,7 +51,7 @@ ArgvMap &arg() return arg; } -void loadMainConfig(const std::string& configdir) +static void loadMainConfig(const std::string& configdir) { ::arg().set("config-dir","Location of configuration directory (pdns.conf)")=configdir; ::arg().set("default-ttl","Seconds a result is valid if not set otherwise")="3600"; @@ -149,7 +149,7 @@ void loadMainConfig(const std::string& configdir) UeberBackend::go(); } -bool rectifyZone(DNSSECKeeper& dk, const DNSName& zone, bool quiet = false, bool rectifyTransaction = true) +static bool rectifyZone(DNSSECKeeper& dk, const DNSName& zone, bool quiet = false, bool rectifyTransaction = true) { string output; string error; @@ -166,7 +166,7 @@ bool rectifyZone(DNSSECKeeper& dk, const DNSName& zone, bool quiet = false, bool return ret; } -void dbBench(const std::string& fname) +static void dbBench(const std::string& fname) { ::arg().set("query-cache-ttl")="0"; ::arg().set("negquery-cache-ttl")="0"; @@ -209,7 +209,7 @@ void dbBench(const std::string& fname) cout<<"Packet cache reports: "< domainInfo; @@ -230,7 +230,7 @@ bool rectifyAllZones(DNSSECKeeper &dk, bool quiet = false) return result; } -int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, const vector* suppliedrecords=0) +static int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, const vector* suppliedrecords=0) { uint64_t numerrors=0, numwarnings=0; @@ -604,7 +604,7 @@ int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone, const vect return EXIT_FAILURE; } -int checkAllZones(DNSSECKeeper &dk, bool exitOnError) +static int checkAllZones(DNSSECKeeper &dk, bool exitOnError) { UeberBackend B("default"); vector domainInfo; @@ -648,7 +648,7 @@ int checkAllZones(DNSSECKeeper &dk, bool exitOnError) return EXIT_FAILURE; } -int increaseSerial(const DNSName& zone, DNSSECKeeper &dk) +static int increaseSerial(const DNSName& zone, DNSSECKeeper &dk) { UeberBackend B("default"); SOAData sd; @@ -698,7 +698,7 @@ int increaseSerial(const DNSName& zone, DNSSECKeeper &dk) return 0; } -int deleteZone(const DNSName &zone) { +static int deleteZone(const DNSName &zone) { UeberBackend B; DomainInfo di; if (! B.getDomainInfo(zone, di)) { @@ -713,7 +713,7 @@ int deleteZone(const DNSName &zone) { return EXIT_FAILURE; } -void listKey(DomainInfo const &di, DNSSECKeeper& dk, bool printHeader = true) { +static void listKey(DomainInfo const &di, DNSSECKeeper& dk, bool printHeader = true) { if (printHeader) { cout<<"Zone Type Size Algorithm ID Location Keytag"<& cmds) { +static int createSlaveZone(const vector& cmds) { UeberBackend B; DomainInfo di; DNSName zone(cmds[1]); @@ -1186,7 +1186,7 @@ int createSlaveZone(const vector& cmds) { return EXIT_SUCCESS; } -int changeSlaveZoneMaster(const vector& cmds) { +static int changeSlaveZoneMaster(const vector& cmds) { UeberBackend B; DomainInfo di; DNSName zone(cmds[1]); @@ -1211,7 +1211,7 @@ int changeSlaveZoneMaster(const vector& cmds) { } // add-record ZONE name type [ttl] "content" ["content"] -int addOrReplaceRecord(bool addOrReplace, const vector& cmds) { +static int addOrReplaceRecord(bool addOrReplace, const vector& cmds) { DNSResourceRecord rr; vector newrrs; DNSName zone(cmds[1]); @@ -1302,7 +1302,7 @@ int addOrReplaceRecord(bool addOrReplace, const vector& cmds) { } // delete-rrset zone name type -int deleteRRSet(const std::string& zone_, const std::string& name_, const std::string& type_) +static int deleteRRSet(const std::string& zone_, const std::string& name_, const std::string& type_) { UeberBackend B; DomainInfo di; @@ -1325,7 +1325,7 @@ int deleteRRSet(const std::string& zone_, const std::string& name_, const std::s return EXIT_SUCCESS; } -int listAllZones(const string &type="") { +static int listAllZones(const string &type="") { int kindFilter = -1; if (type.size()) { @@ -1364,17 +1364,17 @@ int listAllZones(const string &type="") { return 0; } -bool testAlgorithm(int algo) +static bool testAlgorithm(int algo) { return DNSCryptoKeyEngine::testOne(algo); } -bool testAlgorithms() +static bool testAlgorithms() { return DNSCryptoKeyEngine::testAll(); } -void testSpeed(DNSSECKeeper& dk, const DNSName& zone, const string& remote, int cores) +static void testSpeed(DNSSECKeeper& dk, const DNSName& zone, const string& remote, int cores) { DNSResourceRecord rr; rr.qname=DNSName("blah")+zone; @@ -1420,7 +1420,7 @@ void testSpeed(DNSSECKeeper& dk, const DNSName& zone, const string& remote, int cerr<<"Net speed: "<& values, bool clobber) { +static int addOrSetMeta(const DNSName& zone, const string& kind, const vector& values, bool clobber) { UeberBackend B("default"); DomainInfo di; diff --git a/pdns/rcpgenerator.cc b/pdns/rcpgenerator.cc index bebe2d3ecc..72e5c08060 100644 --- a/pdns/rcpgenerator.cc +++ b/pdns/rcpgenerator.cc @@ -310,7 +310,7 @@ static inline uint8_t hextodec(uint8_t val) } -void HEXDecode(const char* begin, const char* end, string& out) +static void HEXDecode(const char* begin, const char* end, string& out) { if(end - begin == 1 && *begin=='-') { out.clear(); diff --git a/pdns/rec_channel_rec.cc b/pdns/rec_channel_rec.cc index 6f964fda06..5ecca53444 100644 --- a/pdns/rec_channel_rec.cc +++ b/pdns/rec_channel_rec.cc @@ -1316,7 +1316,7 @@ vector* pleaseGetTimeouts() return ret; } -string doGenericTopRemotes(pleaseremotefunc_t func) +static string doGenericTopRemotes(pleaseremotefunc_t func) { typedef map counts_t; counts_t counts; @@ -1384,7 +1384,7 @@ static DNSName nopFilter(const DNSName& name) return name; } -string doGenericTopQueries(pleasequeryfunc_t func, boost::function filter=nopFilter) +static string doGenericTopQueries(pleasequeryfunc_t func, boost::function filter=nopFilter) { typedef pair query_t; typedef map counts_t; diff --git a/pdns/receiver.cc b/pdns/receiver.cc index 599e47fdc9..42da510c58 100644 --- a/pdns/receiver.cc +++ b/pdns/receiver.cc @@ -101,7 +101,7 @@ const char *funnytext= This file is where it all happens - main is here, as are the two pivotal threads qthread() and athread() */ -void daemonize(void) +static void daemonize(void) { if(fork()) exit(0); // bye bye diff --git a/pdns/recursordist/test-nod_cc.cc b/pdns/recursordist/test-nod_cc.cc index 2f307b4d2a..9748b55783 100644 --- a/pdns/recursordist/test-nod_cc.cc +++ b/pdns/recursordist/test-nod_cc.cc @@ -9,7 +9,7 @@ using namespace nod; BOOST_AUTO_TEST_SUITE(nod_cc) -bool pdns_exception(PDNSException const& ex) { return true; } +static bool pdns_exception(PDNSException const& ex) { return true; } BOOST_AUTO_TEST_CASE(test_basic) { diff --git a/pdns/recursordist/test-rpzloader_cc.cc b/pdns/recursordist/test-rpzloader_cc.cc index 8769c6eb17..16fb153b51 100644 --- a/pdns/recursordist/test-rpzloader_cc.cc +++ b/pdns/recursordist/test-rpzloader_cc.cc @@ -5,6 +5,8 @@ #endif #include "rpzloader.hh" +#include "syncres.hh" + #include // Provide stubs for some symbols diff --git a/pdns/recursordist/test-secpoll_cc.cc b/pdns/recursordist/test-secpoll_cc.cc index 3fd5bd2f0d..b1f89dd345 100644 --- a/pdns/recursordist/test-secpoll_cc.cc +++ b/pdns/recursordist/test-secpoll_cc.cc @@ -12,31 +12,31 @@ BOOST_AUTO_TEST_SUITE(test_secpoll_cc) -bool checkBasicMessage1(const PDNSException& ex) +static bool checkBasicMessage1(const PDNSException& ex) { BOOST_CHECK_EQUAL(ex.reason, "Had empty answer on NOERROR RCODE"); return true; } -bool checkBasicMessage2(const PDNSException& ex) +static bool checkBasicMessage2(const PDNSException& ex) { BOOST_CHECK_EQUAL(ex.reason, "RCODE was not NOERROR but " + RCode::to_s(1)); return true; } -bool checkBasicMessage3(const PDNSException& ex) +static bool checkBasicMessage3(const PDNSException& ex) { BOOST_CHECK_EQUAL(ex.reason, "No TXT record found in response"); return true; } -bool checkBasicMessage4(const PDNSException& ex) +static bool checkBasicMessage4(const PDNSException& ex) { BOOST_CHECK(ex.reason.find("Could not parse status number: stoi") == 0); return true; } -bool checkBasicMessage5(const PDNSException& ex) +static bool checkBasicMessage5(const PDNSException& ex) { BOOST_CHECK(ex.reason.find("Could not parse status number: stoi") == 0); return true; diff --git a/pdns/recursordist/test-syncres_cc.cc b/pdns/recursordist/test-syncres_cc.cc index dcdb0d48fb..f7a06bb1a4 100644 --- a/pdns/recursordist/test-syncres_cc.cc +++ b/pdns/recursordist/test-syncres_cc.cc @@ -22,11 +22,6 @@ ArgvMap& arg() return theArg; } -int getMTaskerTID() -{ - return 0; -} - void primeRootNSZones(bool) { } diff --git a/pdns/recursordist/test-syncres_cc.hh b/pdns/recursordist/test-syncres_cc.hh index 2b909b242f..06eca8a1e6 100644 --- a/pdns/recursordist/test-syncres_cc.hh +++ b/pdns/recursordist/test-syncres_cc.hh @@ -31,11 +31,6 @@ extern GlobalStateHolder g_luaconfs; -ArgvMap& arg(); -int getMTaskerTID(); - -void primeHints(void); - void initSR(bool debug = false); void initSR(std::unique_ptr& sr, bool dnssec = false, bool debug = false, time_t fakeNow = 0); diff --git a/pdns/recursordist/test-syncres_cc2.cc b/pdns/recursordist/test-syncres_cc2.cc index 2b60aaad07..cc804adc59 100644 --- a/pdns/recursordist/test-syncres_cc2.cc +++ b/pdns/recursordist/test-syncres_cc2.cc @@ -5,7 +5,7 @@ BOOST_AUTO_TEST_SUITE(syncres_cc2) -void do_test_referral_depth(bool limited) +static void do_test_referral_depth(bool limited) { std::unique_ptr sr; initSR(sr); diff --git a/pdns/recursordist/testrunner.cc b/pdns/recursordist/testrunner.cc index 1aff2b5a15..0dc784936c 100644 --- a/pdns/recursordist/testrunner.cc +++ b/pdns/recursordist/testrunner.cc @@ -29,7 +29,7 @@ #include #include -bool init_unit_test() +static bool init_unit_test() { reportAllTypes(); return true; diff --git a/pdns/reczones.cc b/pdns/reczones.cc index 64621ba7c8..5b65d12167 100644 --- a/pdns/reczones.cc +++ b/pdns/reczones.cc @@ -249,7 +249,7 @@ ComboAddress parseIPAndPort(const std::string& input, uint16_t port) } -void convertServersForAD(const std::string& input, SyncRes::AuthDomain& ad, const char* sepa, bool verbose=true) +static void convertServersForAD(const std::string& input, SyncRes::AuthDomain& ad, const char* sepa, bool verbose=true) { vector servers; stringtok(servers, input, sepa); @@ -268,13 +268,7 @@ void convertServersForAD(const std::string& input, SyncRes::AuthDomain& ad, cons g_log< newmap) +static void* pleaseUseNewSDomainsMap(std::shared_ptr newmap) { SyncRes::setDomainMap(newmap); return 0; diff --git a/pdns/sdig.cc b/pdns/sdig.cc index c1baff02d6..560780b63b 100644 --- a/pdns/sdig.cc +++ b/pdns/sdig.cc @@ -38,7 +38,7 @@ static void usage() << endl; } -const string nameForClass(uint16_t qclass, uint16_t qtype) +static const string nameForClass(uint16_t qclass, uint16_t qtype) { if (qtype == QType::OPT) return "IN"; @@ -57,7 +57,7 @@ const string nameForClass(uint16_t qclass, uint16_t qtype) } } -void fillPacket(vector& packet, const string& q, const string& t, +static void fillPacket(vector& packet, const string& q, const string& t, bool dnssec, const boost::optional ednsnm, bool recurse, uint16_t xpfcode, uint16_t xpfversion, uint64_t xpfproto, char* xpfsrc, char* xpfdst, @@ -102,7 +102,7 @@ void fillPacket(vector& packet, const string& q, const string& t, } } -void printReply(const string& reply, bool showflags, bool hidesoadetails) +static void printReply(const string& reply, bool showflags, bool hidesoadetails) { MOADNSParser mdp(false, reply); cout << "Reply to question for qname='" << mdp.d_qname.toString() diff --git a/pdns/secpoll.cc b/pdns/secpoll.cc index 31299d7c0a..77e6a08a4c 100644 --- a/pdns/secpoll.cc +++ b/pdns/secpoll.cc @@ -25,12 +25,13 @@ #include "dnsrecords.hh" #include "pdnsexception.hh" #include "misc.hh" +#include "secpoll.hh" bool isReleaseVersion(const std::string &version) { return std::count(version.begin(), version.end(), '.') == 2; } -void setSecPollToUnknownOnOK(int &secPollStatus) { +static void setSecPollToUnknownOnOK(int &secPollStatus) { if(secPollStatus == 1) // it was ok, now it is unknown secPollStatus = 0; } diff --git a/pdns/ssqlite3.cc b/pdns/ssqlite3.cc index 0c0eb207aa..34fc86da48 100644 --- a/pdns/ssqlite3.cc +++ b/pdns/ssqlite3.cc @@ -37,7 +37,8 @@ * * copied from sqlite 3.3.6 // cmouse */ -int pdns_sqlite3_clear_bindings(sqlite3_stmt *pStmt){ +#if SQLITE_VERSION_NUMBER < 3003009 +static int pdns_sqlite3_clear_bindings(sqlite3_stmt *pStmt){ int i; int rc = SQLITE_OK; for(i=1; rc==SQLITE_OK && i<=sqlite3_bind_parameter_count(pStmt); i++){ @@ -45,6 +46,7 @@ int pdns_sqlite3_clear_bindings(sqlite3_stmt *pStmt){ } return rc; } +#endif static string SSQLite3ErrorString(sqlite3 *db) { diff --git a/pdns/stubquery.cc b/pdns/stubquery.cc index 1da9644a2d..27954eead1 100644 --- a/pdns/stubquery.cc +++ b/pdns/stubquery.cc @@ -15,7 +15,7 @@ ArgvMap &arg() return theArg; } -void usage() { +static void usage() { cerr<<"stubquery"<& p, int outsock) { g_rs.submitResponse(*p, false); diff --git a/pdns/test-dnsrecords_cc.cc b/pdns/test-dnsrecords_cc.cc index b1a60c94e1..441f6464d0 100644 --- a/pdns/test-dnsrecords_cc.cc +++ b/pdns/test-dnsrecords_cc.cc @@ -250,7 +250,7 @@ BOOST_AUTO_TEST_CASE(test_record_types) { } } -bool test_dnsrecords_cc_predicate( std::exception const &ex ) { return true; } +static bool test_dnsrecords_cc_predicate( std::exception const &ex ) { return true; } // these *MUST NOT* parse properly! BOOST_AUTO_TEST_CASE(test_record_types_bad_values) { diff --git a/pdns/testrunner.cc b/pdns/testrunner.cc index 0ea154593f..ea38f33a8f 100644 --- a/pdns/testrunner.cc +++ b/pdns/testrunner.cc @@ -19,7 +19,7 @@ ArgvMap &arg() } -bool init_unit_test() { +static bool init_unit_test() { reportAllTypes(); return true; } diff --git a/pdns/tsigutils.cc b/pdns/tsigutils.cc index 7e75731993..40f49a9119 100644 --- a/pdns/tsigutils.cc +++ b/pdns/tsigutils.cc @@ -25,6 +25,7 @@ #include "dns_random.hh" #include "misc.hh" #include "pdnsexception.hh" +#include "tsigutils.hh" #include /* diff --git a/pdns/ueberbackend.cc b/pdns/ueberbackend.cc index 5fd0a3936e..4d3e4795d6 100644 --- a/pdns/ueberbackend.cc +++ b/pdns/ueberbackend.cc @@ -480,7 +480,7 @@ UeberBackend::UeberBackend(const string &pname) backends=BackendMakers().all(pname=="key-only"); } -void del(DNSBackend* d) +static void del(DNSBackend* d) { delete d; } diff --git a/pdns/ws-auth.cc b/pdns/ws-auth.cc index 57453b0346..22c54dae28 100644 --- a/pdns/ws-auth.cc +++ b/pdns/ws-auth.cc @@ -147,7 +147,7 @@ static string htmlescape(const string &s) { return result; } -void printtable(ostringstream &ret, const string &ringname, const string &title, int limit=10) +static void printtable(ostringstream &ret, const string &ringname, const string &title, int limit=10) { int tot=0; int entries=0; @@ -2253,7 +2253,7 @@ static void apiServerSearchData(HttpRequest* req, HttpResponse* resp) { resp->setBody(doc); } -void apiServerCacheFlush(HttpRequest* req, HttpResponse* resp) { +static void apiServerCacheFlush(HttpRequest* req, HttpResponse* resp) { if(req->method != "PUT") throw HttpMethodNotAllowedException(); diff --git a/pdns/zone2ldap.cc b/pdns/zone2ldap.cc index b7ebcb3c31..6e514a5123 100644 --- a/pdns/zone2ldap.cc +++ b/pdns/zone2ldap.cc @@ -56,7 +56,7 @@ map g_entries; map g_recorddata; map > g_recordttl; -std::string encode_non_ascii( const std::string &input ) { +static std::string encode_non_ascii( const std::string &input ) { std::ostringstream out; for ( auto i : input ) { diff --git a/pdns/zoneparser-tng.cc b/pdns/zoneparser-tng.cc index 0dc2b64670..5a4f8336f8 100644 --- a/pdns/zoneparser-tng.cc +++ b/pdns/zoneparser-tng.cc @@ -222,7 +222,7 @@ bool ZoneParserTNG::getTemplateLine() return true; } -void chopComment(string& line) +static void chopComment(string& line) { if(line.find(';')==string::npos) return; @@ -240,7 +240,7 @@ void chopComment(string& line) line.resize(pos); } -bool findAndElide(string& line, char c) +static bool findAndElide(string& line, char c) { string::size_type pos, len = line.length(); bool inQuote=false;