]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Cleanup: remove many unused-parameter warnings from tests and stubs
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 8 Jul 2017 18:20:41 +0000 (06:20 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 8 Jul 2017 18:20:41 +0000 (06:20 +1200)
13 files changed:
include/unitTestMain.h
src/tests/stub_MemBuf.cc
src/tests/stub_SBuf.cc
src/tests/stub_cbdata.cc
src/tests/stub_fatal.cc
src/tests/stub_libmem.cc
src/tests/stub_tools.cc
test-suite/VirtualDeleteOperator.cc
test-suite/debug.cc
test-suite/mem_hdr_test.cc
test-suite/mem_node_test.cc
test-suite/splay.cc
test-suite/syntheticoperators.cc

index f7691f40efdc7c78d750c5aa60e621bf84db35e2..3ef6dd92fd5b5888af40799bef000c4686f2c0a7 100644 (file)
@@ -22,7 +22,7 @@
 #include <cppunit/TestRunner.h>
 
 int
-main( int argc, char* argv[] )
+main(int, char *[])
 {
 #if ENABLE_DEBUG_SECTION
     Debug::Levels[ENABLE_DEBUG_SECTION] = 99;
index fac0e68060f35017adc7cc875769c27d74f1abf7..efee5d1807b7299954b80563c463777d7b7866a5 100644 (file)
 
 mb_size_t MemBuf::spaceSize() const STUB_RETVAL(0)
 mb_size_t MemBuf::potentialSpaceSize() const STUB_RETVAL(0)
-void MemBuf::consume(mb_size_t sz) STUB
-void MemBuf::appended(mb_size_t sz) STUB
-void MemBuf::truncate(mb_size_t sz) STUB
+void MemBuf::consume(mb_size_t) STUB
+void MemBuf::appended(mb_size_t) STUB
+void MemBuf::truncate(mb_size_t) STUB
 void MemBuf::terminate() STUB
-void MemBuf::init(mb_size_t szInit, mb_size_t szMax) STUB
+void MemBuf::init(mb_size_t, mb_size_t) STUB
 void MemBuf::init() STUB
 void MemBuf::clean() STUB
 void MemBuf::reset() STUB
 int MemBuf::isNull() const STUB_RETVAL(1)
 FREE *MemBuf::freeFunc() STUB_RETVAL(NULL)
 void MemBuf::append(const char *, int) STUB
-void MemBuf::vappendf(const char *fmt, va_list ap) STUB
+void MemBuf::vappendf(const char *, va_list) STUB
 
-void memBufReport(MemBuf * mb) STUB
+void memBufReport(MemBuf *) STUB
 
index d1bca7d84adaa396b943227a26affa783049a052..74422a101dcae7a64714d6eecdf9edc0cd804c67 100644 (file)
@@ -23,45 +23,45 @@ std::ostream& SBufStats::dump(std::ostream &os) const STUB_RETVAL(os)
 SBufStats& SBufStats::operator +=(const SBufStats&) STUB_RETVAL(*this)
 
 SBuf::SBuf() {}
-SBuf::SBuf(const SBuf &S) {}
-SBuf::SBuf(const char *S, size_type n) {}
-SBuf::SBuf(const char *S) {}
-SBuf::SBuf(const std::string &s) {}
+SBuf::SBuf(const SBuf &) {}
+SBuf::SBuf(const char *, size_type) {}
+SBuf::SBuf(const char *) {}
+SBuf::SBuf(const std::string &) {}
 SBuf::~SBuf() {}
-SBuf& SBuf::assign(const SBuf &S) STUB_RETVAL(*this)
-SBuf& SBuf::assign(const char *S, size_type n) STUB_RETVAL(*this)
+SBuf& SBuf::assign(const SBuf &) STUB_RETVAL(*this)
+SBuf& SBuf::assign(const char *, size_type) STUB_RETVAL(*this)
 void clear() STUB
-SBuf& SBuf::append(const SBuf & S) STUB_RETVAL(*this)
-SBuf& SBuf::append(const char * S, size_type Ssize) STUB_RETVAL(*this)
-SBuf& Printf(const char *fmt, ...);
-SBuf& SBuf::appendf(const char *fmt, ...) STUB_RETVAL(*this)
-SBuf& SBuf::vappendf(const char *fmt, va_list vargs) STUB_RETVAL(*this)
+SBuf& SBuf::append(const SBuf &) STUB_RETVAL(*this)
+SBuf& SBuf::append(const char *, size_type) STUB_RETVAL(*this)
+SBuf& Printf(const char *, ...);
+SBuf& SBuf::appendf(const char *, ...) STUB_RETVAL(*this)
+SBuf& SBuf::vappendf(const char *, va_list) STUB_RETVAL(*this)
 std::ostream& SBuf::print(std::ostream &os) const STUB_RETVAL(os)
 std::ostream& SBuf::dump(std::ostream &os) const STUB_RETVAL(os)
-void SBuf::setAt(size_type pos, char toset) STUB
-int SBuf::compare(const SBuf &S, const SBufCaseSensitive isCaseSensitive, const size_type n) const STUB_RETVAL(-1)
-int SBuf::compare(const char *s, const SBufCaseSensitive isCaseSensitive, const size_type n) const STUB_RETVAL(-1)
-bool SBuf::startsWith(const SBuf &S, const SBufCaseSensitive isCaseSensitive) const STUB_RETVAL(false)
-bool SBuf::operator ==(const SBuf & S) const STUB_RETVAL(false)
-bool SBuf::operator !=(const SBuf & S) const STUB_RETVAL(false)
-SBuf SBuf::consume(size_type n) STUB_RETVAL(*this)
+void SBuf::setAt(size_type, char) STUB
+int SBuf::compare(const SBuf &, const SBufCaseSensitive, const size_type) const STUB_RETVAL(-1)
+int SBuf::compare(const char *, const SBufCaseSensitive, const size_type) const STUB_RETVAL(-1)
+bool SBuf::startsWith(const SBuf &, const SBufCaseSensitive) const STUB_RETVAL(false)
+bool SBuf::operator ==(const SBuf &) const STUB_RETVAL(false)
+bool SBuf::operator !=(const SBuf &) const STUB_RETVAL(false)
+SBuf SBuf::consume(size_type) STUB_RETVAL(*this)
 const SBufStats& SBuf::GetStats() STUB_RETVAL(SBuf::stats)
-SBuf::size_type SBuf::copy(char *dest, size_type n) const STUB_RETVAL(0)
+SBuf::size_type SBuf::copy(char *, size_type) const STUB_RETVAL(0)
 const char* SBuf::rawContent() const STUB_RETVAL(NULL)
-char *SBuf::rawSpace(size_type minSize) STUB_RETVAL(NULL)
-void SBuf::forceSize(size_type newSize) STUB
+char *SBuf::rawSpace(size_type) STUB_RETVAL(NULL)
+void SBuf::forceSize(size_type) STUB
 const char* SBuf::c_str() STUB_RETVAL("")
-void SBuf::reserveCapacity(size_type minCapacity) STUB
+void SBuf::reserveCapacity(size_type) STUB
 SBuf::size_type SBuf::reserve(const SBufReservationRequirements &) STUB_RETVAL(0)
-SBuf& SBuf::chop(size_type pos, size_type n) STUB_RETVAL(*this)
-SBuf& SBuf::trim(const SBuf &toRemove, bool atBeginning, bool atEnd) STUB_RETVAL(*this)
-SBuf SBuf::substr(size_type pos, size_type n) const STUB_RETVAL(*this)
-SBuf::size_type SBuf::find(char c, size_type startPos) const STUB_RETVAL(SBuf::npos)
-SBuf::size_type SBuf::find(const SBuf & str, size_type startPos) const STUB_RETVAL(SBuf::npos)
-SBuf::size_type SBuf::rfind(char c, size_type endPos) const STUB_RETVAL(SBuf::npos)
-SBuf::size_type SBuf::rfind(const SBuf &str, size_type endPos) const STUB_RETVAL(SBuf::npos)
-SBuf::size_type SBuf::findFirstOf(const CharacterSet &set, size_type startPos) const STUB_RETVAL(SBuf::npos)
-SBuf::size_type SBuf::findFirstNotOf(const CharacterSet &set, size_type startPos) const STUB_RETVAL(SBuf::npos)
+SBuf& SBuf::chop(size_type, size_type) STUB_RETVAL(*this)
+SBuf& SBuf::trim(const SBuf &, bool, bool) STUB_RETVAL(*this)
+SBuf SBuf::substr(size_type, size_type) const STUB_RETVAL(*this)
+SBuf::size_type SBuf::find(char, size_type) const STUB_RETVAL(SBuf::npos)
+SBuf::size_type SBuf::find(const SBuf &, size_type) const STUB_RETVAL(SBuf::npos)
+SBuf::size_type SBuf::rfind(char, size_type) const STUB_RETVAL(SBuf::npos)
+SBuf::size_type SBuf::rfind(const SBuf &, size_type) const STUB_RETVAL(SBuf::npos)
+SBuf::size_type SBuf::findFirstOf(const CharacterSet &, size_type) const STUB_RETVAL(SBuf::npos)
+SBuf::size_type SBuf::findFirstNotOf(const CharacterSet &, size_type) const STUB_RETVAL(SBuf::npos)
 void SBuf::toLower() STUB
 void SBuf::toUpper() STUB
 
index f1576169bced663f1c0c3e1fc69f7e5452f5b720..628e1e71e7ba23963eae40508e91262991ff7b52 100644 (file)
@@ -13,8 +13,7 @@
 #include "tests/STUB.h"
 
 void cbdataRegisterWithCacheManager(void) STUB
-void *cbdataInternalAlloc(cbdata_type type, const char *, int sz) {
-//STUB_RETVAL(NULL)
+void *cbdataInternalAlloc(cbdata_type, const char *, int sz) {
     return xcalloc(1, sz);
 }
 void *cbdataInternalFree(void *p, const char *, int) {
@@ -22,15 +21,15 @@ void *cbdataInternalFree(void *p, const char *, int) {
     return nullptr;
 }
 #if USE_CBDATA_DEBUG
-void cbdataInternalLockDbg(const void *p, const char *, int) STUB
-void cbdataInternalUnlockDbg(const void *p, const char *, int) STUB
-int cbdataInternalReferenceDoneValidDbg(void **p, void **tp, const char *, int) STUB_RETVAL(0)
+void cbdataInternalLockDbg(const void *, const char *, int) STUB
+void cbdataInternalUnlockDbg(const void *, const char *, int) STUB
+int cbdataInternalReferenceDoneValidDbg(void **, void **, const char *, int) STUB_RETVAL(0)
 #else
-void cbdataInternalLock(const void *p) STUB
-void cbdataInternalUnlock(const void *p) STUB
-int cbdataInternalReferenceDoneValid(void **p, void **tp) STUB_RETVAL(0)
+void cbdataInternalLock(const void *) STUB
+void cbdataInternalUnlock(const void *) STUB
+int cbdataInternalReferenceDoneValid(void **, void **) STUB_RETVAL(0)
 #endif
 
-int cbdataReferenceValid(const void *p) STUB_RETVAL(0)
+int cbdataReferenceValid(const void *) STUB_RETVAL(0)
 cbdata_type cbdataInternalAddType(cbdata_type, const char *, int) STUB_RETVAL(CBDATA_UNKNOWN)
 
index 0d06130ccdfa84c546da837fc1e56161a7b39120..c2c5e08da3714efee7d28a2e1ed4e2cb58763e2f 100644 (file)
@@ -11,9 +11,9 @@
 #define STUB_API "fatal.cc"
 #include "tests/STUB.h"
 
-void fatal(const char *message) STUB
-void fatal_common(const char *message) STUB
-void fatalf(const char *fmt,...) STUB
-void fatalvf(const char *fmt, va_list args) STUB
-void fatal_dump(const char *message) STUB
+void fatal(const char *) STUB
+void fatal_common(const char *) STUB
+void fatalf(const char *...) STUB
+void fatalvf(const char *, va_list) STUB
+void fatal_dump(const char *) STUB
 
index 6b4c5660744ab5f5b4a8c44264d666b3e9cb84ac..26d5e3a3b349142d7148bdc4827c17b7d765aa07 100644 (file)
@@ -17,7 +17,7 @@ void Mem::AllocatorProxy::freeOne(void *address) {xfree(address);}
 int Mem::AllocatorProxy::inUseCount() const {return 0;}
 //static MemPoolMeter tmpMemPoolMeter;
 //MemPoolMeter const &Mem::AllocatorProxy::getMeter() const STUB_RETVAL(tmpMemPoolMeter)
-int Mem::AllocatorProxy::getStats(MemPoolStats * stats) STUB_RETVAL(0)
+int Mem::AllocatorProxy::getStats(MemPoolStats *) STUB_RETVAL(0)
 
 #include "mem/forward.h"
 void Mem::Init() STUB_NOP
@@ -32,7 +32,7 @@ void memInitModule(void) STUB
 void memCleanModule(void) STUB
 void memConfigure(void) STUB
 
-void * memAllocate(mem_type type)
+void * memAllocate(mem_type)
 {
     // let's waste plenty of memory. This should cover any possible need
     return xmalloc(64*1024);
@@ -81,29 +81,29 @@ MemPools::MemPools() :
     defaultIsChunked(false)
 {}
 void MemPools::flushMeters() STUB
-MemImplementingAllocator * MemPools::create(const char *label, size_t obj_size) STUB_RETVAL(NULL);
-void MemPools::setIdleLimit(ssize_t new_idle_limit) STUB
+MemImplementingAllocator * MemPools::create(const char *, size_t) STUB_RETVAL(nullptr);
+void MemPools::setIdleLimit(ssize_t) STUB
 ssize_t MemPools::idleLimit() const STUB_RETVAL(0)
-void MemPools::clean(time_t maxage) STUB
+void MemPools::clean(time_t) STUB
 void MemPools::setDefaultPoolChunking(bool const &) STUB
 
 //MemAllocator::MemAllocator(char const *aLabel);
-char const *MemAllocator::objectType() const STUB_RETVAL(NULL)
+char const *MemAllocator::objectType() const STUB_RETVAL(nullptr)
 int MemAllocator::inUseCount() STUB_RETVAL(0)
 size_t MemAllocator::RoundedSize(size_t minSize) STUB_RETVAL(minSize)
 
-//MemImplementingAllocator::MemImplementingAllocator(char const *aLabel, size_t aSize) STUB_NOP
+//MemImplementingAllocator::MemImplementingAllocator(char const *, size_t) STUB_NOP
 //MemImplementingAllocator::~MemImplementingAllocator();
 MemPoolMeter const &MemImplementingAllocator::getMeter() const STUB_RETSTATREF(MemPoolMeter)
 MemPoolMeter &MemImplementingAllocator::getMeter() STUB_RETSTATREF(MemPoolMeter)
 void MemImplementingAllocator::flushMetersFull() STUB
 void MemImplementingAllocator::flushMeters() STUB
-void *MemImplementingAllocator::alloc() STUB_RETVAL(NULL)
+void *MemImplementingAllocator::alloc() STUB_RETVAL(nullptr)
 void MemImplementingAllocator::freeOne(void *) STUB
 
-MemPoolIterator * memPoolIterate(void) STUB_RETVAL(NULL)
-MemImplementingAllocator * memPoolIterateNext(MemPoolIterator * iter) STUB_RETVAL(NULL)
-void memPoolIterateDone(MemPoolIterator ** iter) STUB
-int memPoolGetGlobalStats(MemPoolGlobalStats * stats) STUB_RETVAL(0)
+MemPoolIterator * memPoolIterate(void) STUB_RETVAL(nullptr)
+MemImplementingAllocator * memPoolIterateNext(MemPoolIterator *) STUB_RETVAL(nullptr)
+void memPoolIterateDone(MemPoolIterator **) STUB
+int memPoolGetGlobalStats(MemPoolGlobalStats *) STUB_RETVAL(0)
 int memPoolsTotalAllocated(void) STUB_RETVAL(0)
 
index 1cabe761109b272af67527e5e88f6f2c12c2ccfd..e708d03d407a8844dcbd84d59f3e60c872bd3f7d 100644 (file)
@@ -19,16 +19,16 @@ void releaseServerSockets(void) STUB_NOP
 char * dead_msg(void) STUB_RETVAL(NULL)
 void mail_warranty(void) STUB
 void dumpMallocStats(void) STUB
-void squid_getrusage(struct rusage *r) STUB
-double rusage_cputime(struct rusage *r) STUB_RETVAL(0)
-int rusage_maxrss(struct rusage *r) STUB_RETVAL(0)
-int rusage_pagefaults(struct rusage *r) STUB_RETVAL(0)
+void squid_getrusage(struct rusage *) STUB
+double rusage_cputime(struct rusage *) STUB_RETVAL(0)
+int rusage_maxrss(struct rusage *) STUB_RETVAL(0)
+int rusage_pagefaults(struct rusage *) STUB_RETVAL(0)
 void PrintRusage(void) STUB
-void death(int sig) STUB
-void BroadcastSignalIfAny(int& sig) STUB
-void sigusr2_handle(int sig) STUB
-void debug_trap(const char *message) STUB
-void sig_child(int sig) STUB
+void death(int) STUB
+void BroadcastSignalIfAny(int &) STUB
+void sigusr2_handle(int) STUB
+void debug_trap(const char *) STUB
+void sig_child(int) STUB
 const char * getMyHostname(void) STUB_RETVAL(NULL)
 const char * uniqueHostname(void) STUB_RETVAL(NULL)
 void leave_suid(void) STUB_NOP
@@ -63,16 +63,16 @@ int NumberOfKids() STUB_RETVAL(0)
 //SBuf ProcessRoles() STUB_RETVAL(SBuf())
 void setMaxFD(void) STUB
 void setSystemLimits(void) STUB
-void squid_signal(int sig, SIGHDLR * func, int flags) STUB
+void squid_signal(int, SIGHDLR *, int) STUB
 void logsFlush(void) STUB
-void debugObj(int section, int level, const char *label, void *obj, ObjPackMethod pm) STUB
+void debugObj(int, int, const char *, void *, ObjPackMethod) STUB
 void parseEtcHosts(void) STUB
 int getMyPort(void) STUB_RETVAL(0)
-void setUmask(mode_t mask) STUB
-void strwordquote(MemBuf * mb, const char *str) STUB
+void setUmask(mode_t) STUB
+void strwordquote(MemBuf *, const char *) STUB
 void keepCapabilities(void) STUB
-void restoreCapabilities(bool keep) STUB
-pid_t WaitForOnePid(pid_t pid, PidStatus &status, int flags) STUB_RETVAL(0)
+void restoreCapabilities(bool) STUB
+pid_t WaitForOnePid(pid_t, PidStatus &, int) STUB_RETVAL(0)
 
 #if _SQUID_WINDOWS_
 SBuf WindowsErrorMessage(DWORD) STUB_RETVAL(SBuf())
index 7e6da930c1f1a6c3dda4c511297193e899b3a038..b73418832efc64a783acade7b644d082d3c65741 100644 (file)
@@ -91,7 +91,7 @@ ChildVirtual::operator delete(void *address)
 ChildVirtual::~ChildVirtual() {}
 
 int
-main(int argc, char **argv)
+main(int, char *[])
 {
     assert (BaseVirtual::Calls.news() == 0);
     assert (BaseVirtual::Calls.deletes() == 0);
@@ -107,8 +107,8 @@ main(int argc, char **argv)
     assert (BaseVirtual::Calls.deletes() == 0);
     assert (ChildVirtual::Calls.news() == 1);
     assert (ChildVirtual::Calls.deletes() == 1);
-    // deleting NULL works.
-    BaseVirtual::DeleteABase(NULL);
+    // deleting nullptr works.
+    BaseVirtual::DeleteABase(nullptr);
     assert (BaseVirtual::Calls.news() == 0);
     assert (BaseVirtual::Calls.deletes() == 0);
     assert (ChildVirtual::Calls.news() == 1);
index b39443fac794d35c5b235eacc5e52eb7d5d11d1f..0fbcfb4c7cf4bdd619a89c530b86b9b0dacd89c9 100644 (file)
@@ -46,7 +46,7 @@ StreamTest::getACString() const
 }
 
 int
-main(int argc, char **argv)
+main(int, char *[])
 {
     Debug::Levels[1] = 8;
     debugs (1,1,"test" << "string");
index b950671c721f01ef250aa400f294a90d0df0970b..b71bcbe2d62c19c6401f60e3d8ba5cc355e70132 100644 (file)
@@ -17,8 +17,9 @@
 #include <iostream>
 #include <sstream>
 
-/*For  a reason required on some platforms */
-unsigned int TextException::FileNameHash(const char *fname)
+// required on some platforms
+unsigned int
+TextException::FileNameHash(const char *)
 {
     return 0;
 }
@@ -99,7 +100,7 @@ testHdrVisit()
 }
 
 int
-main(int argc, char **argv)
+main(int, char *[])
 {
     assert (mem_node::InUseCount() == 0);
     testLowAndHigh();
index 46d0550b589498a4c22417ec0fb0e8aa85ee90e0..15668b89d87abf67e446fa8010af2e6aacb8f42d 100644 (file)
 
 #include <iostream>
 
-#if 0
-/* TODO: put this in a libTest */
-void
-xassert(const char *msg, const char *file, int line)
-{
-    std::cout << "Assertion failed: (" << msg << ") at " << file << ":" << line << std::endl;
-    exit(EXIT_FAILURE);
-}
-#endif
-
 int
-main(int argc, char **argv)
+main(int, char *[])
 {
     mem_node *aNode = new mem_node(0);
     assert (aNode);
index c07889987263590196dca8ad1cac514a6d43b864..17a690b656529772ce67afcfa004af35e1cb0294 100644 (file)
@@ -69,7 +69,7 @@ SplayCheck::BeginWalk()
 }
 
 void
-SplayCheck::WalkVoid(void *const &node, void *state)
+SplayCheck::WalkVoid(void *const &node, void *)
 {
     intnode *A = (intnode *)node;
     CheckNode(*A);
@@ -92,13 +92,13 @@ SplayCheck::CheckNode(intnode const &A)
 }
 
 void
-SplayCheck::WalkNode (intnode *const &a, void *state)
+SplayCheck::WalkNode (intnode *const &a, void *)
 {
     CheckNode (*a);
 }
 
 void
-SplayCheck::WalkNodeRef (intnode const &a, void *state)
+SplayCheck::WalkNodeRef (intnode const &a, void *)
 {
     CheckNode (a);
 }
@@ -127,7 +127,7 @@ destintref (intnode &)
 {}
 
 int
-main(int argc, char *argv[])
+main(int, char *[])
 {
     std::mt19937 generator;
     xuniform_int_distribution<int> distribution;
index 02e0a4aaf6ff8aaad08cb3ae2c0de7f7dc7978b7..6cc8fba9a1db06fbee455af2007c14319b5f9313 100644 (file)
@@ -151,7 +151,7 @@ CheckSyntheticWorks()
 }
 
 int
-main(int argc, char **argv)
+main(int, char *[])
 {
     CheckHasExplicitWorks();
     CheckSyntheticWorks();