Skip to content

Commit

Permalink
Fix warnings about dup/missing prototypes
Browse files Browse the repository at this point in the history
  • Loading branch information
rgacogne committed Apr 24, 2020
1 parent e5ec884 commit 050e687
Show file tree
Hide file tree
Showing 54 changed files with 144 additions and 182 deletions.
2 changes: 1 addition & 1 deletion modules/geoipbackend/geoipbackend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>& alt, boost::optional<int>& prec)
{
for(auto const& gi: s_geoip_files) {
Expand Down
4 changes: 2 additions & 2 deletions modules/lmdbbackend/lmdbbackend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<DNSRecordContent> deserializeContentZR(uint16_t qtype, const DNSName& qname, const std::string& content)
static std::shared_ptr<DNSRecordContent> deserializeContentZR(uint16_t qtype, const DNSName& qname, const std::string& content)
{
if(qtype == QType::A && content.size() == 4) {
return std::make_shared<ARecordContent>(*((uint32_t*)content.c_str()));
Expand Down
1 change: 1 addition & 0 deletions pdns/auth-caches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion pdns/base32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion pdns/bindparser.yy
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 0 additions & 1 deletion pdns/common_startup.hh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ extern std::shared_ptr<UDPNameserver> N;
extern vector<std::shared_ptr<UDPNameserver> > g_udpReceivers;
extern int avg_latency;
extern std::unique_ptr<TCPNameserver> TN;
extern ArgvMap & arg( void );
extern void declareArguments();
extern void declareStats();
extern void mainthread();
Expand Down
2 changes: 1 addition & 1 deletion pdns/dnsbulktest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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]"<<endl;
cerr << desc << "\n";
}
Expand Down
7 changes: 4 additions & 3 deletions pdns/dnsgram.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

StatBag S;

struct tm* pdns_localtime_r(const uint32_t* then, struct tm* tm)
static struct tm* pdns_localtime_r(const uint32_t* then, struct tm* tm)
{
time_t t = *then;

Expand All @@ -49,7 +49,8 @@ struct tm* pdns_localtime_r(const uint32_t* then, struct tm* tm)

int32_t g_clientQuestions, g_clientResponses, g_serverQuestions, g_serverResponses, g_skipped;
struct pdns_timeval g_lastanswerTime, g_lastquestionTime;
void makeReport(const struct pdns_timeval& tv)

static void makeReport(const struct pdns_timeval& tv)
{
int64_t clientdiff = g_clientQuestions - g_clientResponses;
int64_t serverdiff = g_serverQuestions - g_serverResponses;
Expand Down Expand Up @@ -100,7 +101,7 @@ void makeReport(const struct pdns_timeval& tv)
g_skipped=0;
}

void usage() {
static void usage() {
cerr<<"syntax: dnsgram INFILE..."<<endl;
}

Expand Down
1 change: 1 addition & 0 deletions pdns/dnslabeltext.rl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <string>
#include "dnsname.hh"
#include "namespaces.hh"
#include "dnswriter.hh"

namespace {
void appendSplit(vector<string>& ret, string& segment, char c)
Expand Down
32 changes: 16 additions & 16 deletions pdns/dnsreplay.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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: "<<rhs.tv_sec<<" + "<<rhs.tv_usec<<"\n";
struct timeval ret;
Expand Down Expand Up @@ -121,7 +121,7 @@ const struct timeval operator*(float fact, const struct timeval& rhs)
}

bool g_pleaseQuit;
void pleaseQuitHandler(int)
static void pleaseQuitHandler(int)
{
g_pleaseQuit=true;
}
Expand Down Expand Up @@ -164,7 +164,7 @@ class DNSIDManager : public boost::noncopyable
} s_idmanager;


void setSocketBuffer(int fd, int optname, uint32_t size)
static void setSocketBuffer(int fd, int optname, uint32_t size)
{
uint32_t psize=0;
socklen_t len=sizeof(psize);
Expand Down Expand Up @@ -225,7 +225,7 @@ unsigned int s_wednserrors, s_origdnserrors, s_duplicates;



void WeOrigSlowQueriesDelta(int& weOutstanding, int& origOutstanding, int& weSlow, int& origSlow)
static void WeOrigSlowQueriesDelta(int& weOutstanding, int& origOutstanding, int& weSlow, int& origSlow)
{
struct timeval now;
gettimeofday(&now, 0);
Expand Down Expand Up @@ -265,21 +265,21 @@ void WeOrigSlowQueriesDelta(int& weOutstanding, int& origOutstanding, int& weSlo
}
}

void compactAnswerSet(MOADNSParser::answers_t orig, set<DNSRecord>& compacted)
static void compactAnswerSet(MOADNSParser::answers_t orig, set<DNSRecord>& 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<pair<DNSName,uint16_t> > s_origbetterset;

bool isRootReferral(const MOADNSParser::answers_t& answers)
static bool isRootReferral(const MOADNSParser::answers_t& answers)
{
if(answers.empty())
return false;
Expand All @@ -296,7 +296,7 @@ bool isRootReferral(const MOADNSParser::answers_t& answers)
}

vector<uint32_t> flightTimes;
void accountFlightTime(qids_t::const_iterator iter)
static void accountFlightTime(qids_t::const_iterator iter)
{
if(flightTimes.empty())
flightTimes.resize(2050);
Expand All @@ -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) {
Expand All @@ -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()};
Expand All @@ -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);
Expand Down Expand Up @@ -406,7 +406,7 @@ void measureResultAndClean(qids_t::const_iterator iter)

std::unique_ptr<Socket> s_socket = nullptr;

void receiveFromReference()
static void receiveFromReference()
try
{
string packet;
Expand Down Expand Up @@ -469,7 +469,7 @@ catch(...)
exit(1);
}

void pruneQids()
static void pruneQids()
{
struct timeval now;
gettimeofday(&now, 0);
Expand All @@ -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");
Expand All @@ -511,7 +511,7 @@ void printStats(uint64_t origWaitingFor=0, uint64_t weWaitingFor=0)

}

void houseKeeping()
static void houseKeeping()
{
static timeval last;

Expand Down Expand Up @@ -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]"<<endl;
cerr << desc << "\n";
}
Expand Down
2 changes: 1 addition & 1 deletion pdns/dnsscan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ using namespace ::boost::multi_index;
#include "namespaces.hh"
StatBag S;

void usage() {
static void usage() {
cerr<<"syntax: dnsscan INFILE ..."<<endl;
}

Expand Down
6 changes: 3 additions & 3 deletions pdns/dnsscope.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ struct QuestionData
typedef map<QuestionIdentifier, QuestionData> statmap_t;
statmap_t statmap;

unsigned int liveQuestions()
static unsigned int liveQuestions()
{
unsigned int ret=0;
for(statmap_t::value_type& val : statmap) {
Expand Down Expand Up @@ -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
Expand All @@ -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<suseconds_t>(lhs.tv_usec)}, b{rhs.tv_sec, static_cast<suseconds_t>(rhs.tv_usec)};
return operator-(a,b);
Expand Down
6 changes: 3 additions & 3 deletions pdns/dnstcpbench.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -69,7 +69,7 @@ struct BenchQuery
time_t answerSecond;
};

void doQuery(BenchQuery* q)
static void doQuery(BenchQuery* q)
try
{
vector<uint8_t> packet;
Expand Down Expand Up @@ -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"<<endl;
cerr<<"Where QUERIES is one query per line, format: qname qtype, just 1 space"<<endl;
cerr<<desc<<endl;
Expand Down
2 changes: 1 addition & 1 deletion pdns/dnswasher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class IPCipherObfuscator : public IPObfuscator
};


void usage() {
static void usage() {
cerr<<"Syntax: dnswasher INFILE1 [INFILE2..] OUTFILE"<<endl;
}

Expand Down
1 change: 0 additions & 1 deletion pdns/dynhandler.hh
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,3 @@ string DLNotifyRetrieveHandler(const vector<string>&parts, Utility::pid_t ppid);
string DLCurrentConfigHandler(const vector<string>&parts, Utility::pid_t ppid);
string DLListZones(const vector<string>&parts, Utility::pid_t ppid);
string DLTokenLogin(const vector<string>&parts, Utility::pid_t ppid);
uint64_t udpErrorStats(const std::string& str);
2 changes: 2 additions & 0 deletions pdns/fuzz_dnsdistcache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint16_t>::max()) {
Expand Down
2 changes: 2 additions & 0 deletions pdns/fuzz_moadnsparser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 2 additions & 0 deletions pdns/fuzz_packetcache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint16_t>::max()) {
Expand Down
2 changes: 2 additions & 0 deletions pdns/fuzz_proxyprotocol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<ProxyProtocolValue> values;
Expand Down
2 changes: 2 additions & 0 deletions pdns/fuzz_zoneparsertng.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 2 additions & 0 deletions pdns/ixfrdist-stats.hh
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,5 @@ class ixfrdistStats {
return ret;
};
};

extern string doGetStats();
2 changes: 0 additions & 2 deletions pdns/ixfrdist-web.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<WebServer>(new WebServer(listenAddress.toString(), listenAddress.getPort())))
{
Expand Down
2 changes: 1 addition & 1 deletion pdns/ixfrdist.cc
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ static void updateCurrentZoneInfo(const DNSName& domain, std::shared_ptr<ixfrinf
// FIXME: also report zone size?
}

void updateThread(const string& workdir, const uint16_t& keep, const uint16_t& axfrTimeout, const uint16_t& soaRetry, const uint32_t axfrMaxRecords) {
static void updateThread(const string& workdir, const uint16_t& keep, const uint16_t& axfrTimeout, const uint16_t& soaRetry, const uint32_t axfrMaxRecords) {
setThreadName("ixfrdist/update");
std::map<DNSName, time_t> lastCheck;

Expand Down
Loading

0 comments on commit 050e687

Please sign in to comment.