Commit 0c6ed3db authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

merged trac #409 (use a C++ feature for omitting unused parameters instead of...

merged trac #409 (use a C++ feature for omitting unused parameters instead of compiler dependent "UNUSED_PARAM")


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@3498 e5f2f494-b856-4b98-b285-d166d9295462
parents f38707f7 adb04f0a
......@@ -206,7 +206,6 @@ fi
# gcc specific settings:
if test "X$GXX" = "Xyes"; then
B10_CXXFLAGS="-Wall -Wextra -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare"
UNUSED_PARAM_ATTRIBUTE='__attribute__((unused))'
# Certain versions of gcc (g++) have a bug that incorrectly warns about
# the use of anonymous name spaces even if they're closed in a single
......@@ -225,7 +224,6 @@ CXXFLAGS="$CXXFLAGS_SAVED"
fi dnl GXX = yes
AM_CONDITIONAL(GCC_WERROR_OK, test $werror_ok = 1)
AC_DEFINE_UNQUOTED(UNUSED_PARAM, $UNUSED_PARAM_ATTRIBUTE, Define to compiler keyword indicating a function argument is intentionally unused)
# produce PIC unless we disable shared libraries. need this for python bindings.
if test $enable_shared != "no" -a "X$GXX" = "Xyes"; then
......
......@@ -505,9 +505,7 @@ public:
}
}
void sendCompleted(const asio::error_code& error UNUSED_PARAM,
size_t bytes_sent UNUSED_PARAM)
{
void sendCompleted(const asio::error_code&, size_t) {
// Even if error occurred there's nothing to do. Simply handle
// the next request.
startReceive();
......
......@@ -97,7 +97,7 @@ private:
virtual void startRead(boost::function<void()> read_callback);
virtual int reply(ConstElementPtr envelope, ConstElementPtr newmsg);
virtual bool hasQueuedMsgs() const;
virtual void setTimeout(size_t timeout UNUSED_PARAM) {};
virtual void setTimeout(size_t) {}
virtual size_t getTimeout() const { return 0; };
void setMessage(ConstElementPtr msg) { msg_ = msg; }
......@@ -156,30 +156,25 @@ protected:
};
void
AuthSrvTest::MockSession::establish(const char* socket_file UNUSED_PARAM) {}
AuthSrvTest::MockSession::establish(const char*) {}
void
AuthSrvTest::MockSession::disconnect() {}
void
AuthSrvTest::MockSession::subscribe(string group UNUSED_PARAM,
string instance UNUSED_PARAM)
AuthSrvTest::MockSession::subscribe(string, string)
{}
void
AuthSrvTest::MockSession::unsubscribe(string group UNUSED_PARAM,
string instance UNUSED_PARAM)
AuthSrvTest::MockSession::unsubscribe(string, string)
{}
void
AuthSrvTest::MockSession::startRead(
boost::function<void()> read_callback UNUSED_PARAM)
AuthSrvTest::MockSession::startRead(boost::function<void()>)
{}
int
AuthSrvTest::MockSession::reply(ConstElementPtr envelope UNUSED_PARAM,
ConstElementPtr newmsg UNUSED_PARAM)
{
AuthSrvTest::MockSession::reply(ConstElementPtr, ConstElementPtr) {
return (-1);
}
......@@ -190,8 +185,7 @@ AuthSrvTest::MockSession::hasQueuedMsgs() const {
int
AuthSrvTest::MockSession::group_sendmsg(ConstElementPtr msg, string group,
string instance UNUSED_PARAM,
string to UNUSED_PARAM)
string, string)
{
if (!send_ok_) {
isc_throw(XfroutError, "mock session send is disabled for test");
......@@ -203,10 +197,8 @@ AuthSrvTest::MockSession::group_sendmsg(ConstElementPtr msg, string group,
}
bool
AuthSrvTest::MockSession::group_recvmsg(ConstElementPtr& envelope UNUSED_PARAM,
ConstElementPtr& msg,
bool nonblock UNUSED_PARAM,
int seq UNUSED_PARAM)
AuthSrvTest::MockSession::group_recvmsg(ConstElementPtr&,
ConstElementPtr& msg, bool, int)
{
if (!receive_ok_) {
isc_throw(XfroutError, "mock session receive is disabled for test");
......@@ -234,10 +226,9 @@ AuthSrvTest::MockXfroutClient::disconnect() {
}
int
AuthSrvTest::MockXfroutClient::sendXfroutRequestInfo(
const int tcp_sock UNUSED_PARAM,
const void* msg_data UNUSED_PARAM,
const uint16_t msg_len UNUSED_PARAM)
AuthSrvTest::MockXfroutClient::sendXfroutRequestInfo(const int,
const void*,
const uint16_t)
{
if (!send_ok_) {
isc_throw(XfroutError, "xfrout connection send is disabled for test");
......
......@@ -62,84 +62,82 @@ Element::toWire(std::ostream& ss) const {
// installed files we define the methods here.
//
bool
Element::getValue(long int& t UNUSED_PARAM) {
Element::getValue(long int&) {
return (false);
}
bool
Element::getValue(double& t UNUSED_PARAM) {
Element::getValue(double&) {
return (false);
}
bool
Element::getValue(bool& t UNUSED_PARAM) {
Element::getValue(bool&) {
return (false);
}
bool
Element::getValue(std::string& t UNUSED_PARAM) {
Element::getValue(std::string&) {
return (false);
}
bool
Element::getValue(std::vector<ConstElementPtr>& t UNUSED_PARAM) {
Element::getValue(std::vector<ConstElementPtr>&) {
return (false);
}
bool
Element::getValue(std::map<std::string, ConstElementPtr>& t UNUSED_PARAM) {
Element::getValue(std::map<std::string, ConstElementPtr>&) {
return (false);
}
bool
Element::setValue(const long int v UNUSED_PARAM) {
Element::setValue(const long int) {
return (false);
}
bool
Element::setValue(const double v UNUSED_PARAM) {
Element::setValue(const double) {
return (false);
}
bool
Element::setValue(const bool t UNUSED_PARAM) {
Element::setValue(const bool) {
return (false);
}
bool
Element::setValue(const std::string& v UNUSED_PARAM) {
Element::setValue(const std::string&) {
return (false);
}
bool
Element::setValue(const std::vector<ConstElementPtr>& v UNUSED_PARAM) {
Element::setValue(const std::vector<ConstElementPtr>&) {
return (false);
}
bool
Element::setValue(const std::map<std::string,
ConstElementPtr>& v UNUSED_PARAM)
{
Element::setValue(const std::map<std::string, ConstElementPtr>&) {
return (false);
}
ConstElementPtr
Element::get(const int i UNUSED_PARAM) const {
Element::get(const int) const {
isc_throw(TypeError, "get(int) called on a non-list Element");
}
void
Element::set(const size_t i UNUSED_PARAM, ConstElementPtr element UNUSED_PARAM) {
Element::set(const size_t, ConstElementPtr) {
isc_throw(TypeError, "set(int, element) called on a non-list Element");
}
void
Element::add(ConstElementPtr element UNUSED_PARAM) {
Element::add(ConstElementPtr) {
isc_throw(TypeError, "add() called on a non-list Element");
}
void
Element::remove(const int i UNUSED_PARAM) {
Element::remove(const int) {
isc_throw(TypeError, "remove(int) called on a non-list Element");
}
......@@ -149,36 +147,32 @@ Element::size() const {
}
ConstElementPtr
Element::get(const std::string& name UNUSED_PARAM) const {
Element::get(const std::string&) const {
isc_throw(TypeError, "get(string) called on a non-map Element");
}
void
Element::set(const std::string& name UNUSED_PARAM,
ConstElementPtr element UNUSED_PARAM)
{
Element::set(const std::string&, ConstElementPtr) {
isc_throw(TypeError, "set(name, element) called on a non-map Element");
}
void
Element::remove(const std::string& name UNUSED_PARAM) {
Element::remove(const std::string&) {
isc_throw(TypeError, "remove(string) called on a non-map Element");
}
bool
Element::contains(const std::string& name UNUSED_PARAM) const {
Element::contains(const std::string&) const {
isc_throw(TypeError, "contains(string) called on a non-map Element");
}
ConstElementPtr
Element::find(const std::string& identifier UNUSED_PARAM) const {
Element::find(const std::string&) const {
isc_throw(TypeError, "find(string) called on a non-map Element");
}
bool
Element::find(const std::string& identifier UNUSED_PARAM,
ConstElementPtr t UNUSED_PARAM) const
{
Element::find(const std::string&, ConstElementPtr) const {
return (false);
}
......@@ -725,7 +719,7 @@ Element::fromWire(const std::string& s) {
}
ElementPtr
Element::fromWire(std::stringstream& in, int length) {
Element::fromWire(std::stringstream& in, int) {
//
// Check protocol version
//
......
......@@ -76,7 +76,7 @@ public:
}
void
acceptHandler(const asio::error_code& error UNUSED_PARAM) {
acceptHandler(const asio::error_code&) {
}
void
......
......@@ -4,10 +4,6 @@ AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
AM_CPPFLAGS += $(BOOST_INCLUDES)
AM_CXXFLAGS = $(B10_CXXFLAGS)
# see src/lib/cc/Makefile.am for -Wno-unused-parameter
if USE_GXX
AM_CXXFLAGS += -Wno-unused-parameter
endif
if USE_STATIC_LINK
AM_LDFLAGS = -static
......
......@@ -188,7 +188,7 @@ ConstElementPtr my_config_handler(ConstElementPtr new_config) {
}
ConstElementPtr my_command_handler(const std::string& command,
ConstElementPtr arg UNUSED_PARAM)
ConstElementPtr arg)
{
if (command == "good_command") {
return (createAnswer());
......
......@@ -87,17 +87,15 @@ FakeSession::disconnect() {
}
void
FakeSession::startRead(boost::function<void()> read_callback UNUSED_PARAM) {
FakeSession::startRead(boost::function<void()>) {
}
void
FakeSession::establish(const char* socket_file) {
FakeSession::establish(const char*) {
}
bool
FakeSession::recvmsg(ConstElementPtr& msg, bool nonblock UNUSED_PARAM,
int seq UNUSED_PARAM)
{
FakeSession::recvmsg(ConstElementPtr& msg, bool, int) {
//cout << "[XX] client asks for message " << endl;
if (messages_ &&
messages_->getType() == Element::list &&
......@@ -111,10 +109,7 @@ FakeSession::recvmsg(ConstElementPtr& msg, bool nonblock UNUSED_PARAM,
}
bool
FakeSession::recvmsg(ConstElementPtr& env, ConstElementPtr& msg,
bool nonblock UNUSED_PARAM,
int seq UNUSED_PARAM)
{
FakeSession::recvmsg(ConstElementPtr& env, ConstElementPtr& msg, bool, int) {
//cout << "[XX] client asks for message and env" << endl;
env = ElementPtr();
if (messages_ &&
......@@ -172,7 +167,7 @@ FakeSession::unsubscribe(std::string group, std::string instance) {
int
FakeSession::group_sendmsg(ConstElementPtr msg, std::string group,
std::string to, std::string instance UNUSED_PARAM)
std::string to, std::string)
{
//cout << "[XX] client sends message: " << msg << endl;
//cout << "[XX] to: " << group << " . " << instance << "." << to << endl;
......
......@@ -63,7 +63,7 @@ public:
virtual int reply(isc::data::ConstElementPtr envelope,
isc::data::ConstElementPtr newmsg);
virtual bool hasQueuedMsgs() const;
virtual void setTimeout(size_t milliseconds) {}
virtual void setTimeout(size_t) {}
virtual size_t getTimeout() const { return (0); }
isc::data::ConstElementPtr getFirstMessage(std::string& group,
std::string& to) const;
......
......@@ -1247,72 +1247,65 @@ Nsec3Param::getHash(const Name& name) const {
return (encodeBase32Hex(vector<uint8_t>(digest, digest + SHA1_HASHSIZE)));
}
//
// The following methods are effectively empty, and their parameters are
// unused. To silence compilers that warn unused function parameters,
// we specify a (compiler dependent) special keyword when available.
// It's defined in config.h, and to avoid including this header file from
// installed files we define the methods here.
//
DataSrc::Result
DataSrc::init(isc::data::ConstElementPtr config UNUSED_PARAM) {
DataSrc::init(isc::data::ConstElementPtr) {
return (NOT_IMPLEMENTED);
}
DataSrc::Result
MetaDataSrc::findRRset(const isc::dns::Name& qname UNUSED_PARAM,
const isc::dns::RRClass& qclass UNUSED_PARAM,
const isc::dns::RRType& qtype UNUSED_PARAM,
isc::dns::RRsetList& target UNUSED_PARAM,
uint32_t& flags UNUSED_PARAM,
const isc::dns::Name* zonename UNUSED_PARAM) const
MetaDataSrc::findRRset(const isc::dns::Name&,
const isc::dns::RRClass&,
const isc::dns::RRType&,
isc::dns::RRsetList&,
uint32_t&,
const isc::dns::Name*) const
{
return (NOT_IMPLEMENTED);
}
DataSrc::Result
MetaDataSrc::findExactRRset(const isc::dns::Name& qname UNUSED_PARAM,
const isc::dns::RRClass& qclass UNUSED_PARAM,
const isc::dns::RRType& qtype UNUSED_PARAM,
isc::dns::RRsetList& target UNUSED_PARAM,
uint32_t& flags UNUSED_PARAM,
const isc::dns::Name* zonename UNUSED_PARAM) const
MetaDataSrc::findExactRRset(const isc::dns::Name&,
const isc::dns::RRClass&,
const isc::dns::RRType&,
isc::dns::RRsetList&,
uint32_t&,
const isc::dns::Name*) const
{
return (NOT_IMPLEMENTED);
}
DataSrc::Result
MetaDataSrc::findAddrs(const isc::dns::Name& qname UNUSED_PARAM,
const isc::dns::RRClass& qclass UNUSED_PARAM,
isc::dns::RRsetList& target UNUSED_PARAM,
uint32_t& flags UNUSED_PARAM,
const isc::dns::Name* zonename UNUSED_PARAM) const
MetaDataSrc::findAddrs(const isc::dns::Name&,
const isc::dns::RRClass&,
isc::dns::RRsetList&,
uint32_t&,
const isc::dns::Name*) const
{
return (NOT_IMPLEMENTED);
}
DataSrc::Result
MetaDataSrc::findReferral(const isc::dns::Name& qname UNUSED_PARAM,
const isc::dns::RRClass& qclass UNUSED_PARAM,
isc::dns::RRsetList& target UNUSED_PARAM,
uint32_t& flags UNUSED_PARAM,
const isc::dns::Name* zonename UNUSED_PARAM) const
MetaDataSrc::findReferral(const isc::dns::Name&,
const isc::dns::RRClass&,
isc::dns::RRsetList&,
uint32_t&,
const isc::dns::Name*) const
{
return (NOT_IMPLEMENTED);
}
DataSrc::Result
MetaDataSrc::findPreviousName(const isc::dns::Name& qname UNUSED_PARAM,
isc::dns::Name& target UNUSED_PARAM,
const isc::dns::Name* zonename UNUSED_PARAM) const
MetaDataSrc::findPreviousName(const isc::dns::Name&,
isc::dns::Name&,
const isc::dns::Name*) const
{
return (NOT_IMPLEMENTED);
}
DataSrc::Result
MetaDataSrc::findCoveringNSEC3(const isc::dns::Name& zonename UNUSED_PARAM,
std::string& hash UNUSED_PARAM,
isc::dns::RRsetList& target UNUSED_PARAM) const
MetaDataSrc::findCoveringNSEC3(const isc::dns::Name&,
std::string&,
isc::dns::RRsetList&) const
{
return (NOT_IMPLEMENTED);
}
......
......@@ -235,18 +235,12 @@ StaticDataSrc::findExactRRset(const Name& qname,
}
DataSrc::Result
StaticDataSrc::findPreviousName(const Name& qname UNUSED_PARAM,
Name& target UNUSED_PARAM,
const Name* zonename UNUSED_PARAM) const
{
StaticDataSrc::findPreviousName(const Name&, Name&, const Name*) const {
return (NOT_IMPLEMENTED);
}
DataSrc::Result
StaticDataSrc::findCoveringNSEC3(const Name& zonename UNUSED_PARAM,
string& hash UNUSED_PARAM,
RRsetList& target UNUSED_PARAM) const
{
StaticDataSrc::findCoveringNSEC3(const Name&, string&, RRsetList&) const {
return (NOT_IMPLEMENTED);
}
......@@ -258,7 +252,7 @@ StaticDataSrc::init() {
// Static data source is "configuration less", so the \c config parameter
// is intentionally ignored.
DataSrc::Result
StaticDataSrc::init(isc::data::ConstElementPtr config UNUSED_PARAM) {
StaticDataSrc::init(isc::data::ConstElementPtr) {
return (init());
}
......
......@@ -307,7 +307,7 @@ vector<Zone> zones;
}
DataSrc::Result
TestDataSrc::init(isc::data::ConstElementPtr config UNUSED_PARAM) {
TestDataSrc::init(isc::data::ConstElementPtr) {
return (init());
}
......@@ -623,10 +623,7 @@ TestDataSrc::findPreviousName(const Name& qname,
}
DataSrc::Result
TestDataSrc::findCoveringNSEC3(const Name& zonename UNUSED_PARAM,
string& hash UNUSED_PARAM,
RRsetList& target UNUSED_PARAM) const
{
TestDataSrc::findCoveringNSEC3(const Name&, string&, RRsetList&) const {
return (NOT_IMPLEMENTED);
}
......
......@@ -74,7 +74,7 @@ EDNS::EDNS(const uint8_t version) :
}
EDNS::EDNS(const Name& name, const RRClass& rrclass, const RRType& rrtype,
const RRTTL& ttl, const Rdata& rdata UNUSED_PARAM) :
const RRTTL& ttl, const Rdata&) :
version_((ttl.getValue() & VERSION_MASK) >> VERSION_SHIFT)
{
if (rrtype != RRType::OPT()) {
......@@ -152,7 +152,7 @@ EDNS::toWire(OutputBuffer& buffer, const uint8_t extended_rcode) const {
EDNS*
createEDNSFromRR(const Name& name, const RRClass& rrclass,
const RRType& rrtype, const RRTTL& ttl,
const Rdata& rdata UNUSED_PARAM,
const Rdata& rdata,
uint8_t& extended_rcode)
{
// Create a new EDNS object first for exception guarantee.
......
......@@ -50,7 +50,7 @@ public:
isc::dns::NameComparisonResult* ncr;
};
static int NameComparisonResult_init(s_NameComparisonResult* self UNUSED_PARAM, PyObject* args UNUSED_PARAM);
static int NameComparisonResult_init(s_NameComparisonResult*, PyObject*);
static void NameComparisonResult_destroy(s_NameComparisonResult* self);
static PyObject* NameComparisonResult_getOrder(s_NameComparisonResult* self);
static PyObject* NameComparisonResult_getCommonLabels(s_NameComparisonResult* self);
......@@ -123,9 +123,7 @@ static PyTypeObject name_comparison_result_type = {
};
static int
NameComparisonResult_init(s_NameComparisonResult* self UNUSED_PARAM,
PyObject* args UNUSED_PARAM)
{
NameComparisonResult_init(s_NameComparisonResult*, PyObject*) {
PyErr_SetString(PyExc_NotImplementedError,
"NameComparisonResult can't be built directly");
return (-1);
......
......@@ -220,82 +220,82 @@ Opcode_createStatic(const Opcode& opcode) {
}
PyObject*
Opcode_QUERY(const s_Opcode* self UNUSED_PARAM) {
Opcode_QUERY(const s_Opcode*) {
return (Opcode_createStatic(Opcode::QUERY()));
}
PyObject*
Opcode_IQUERY(const s_Opcode* self UNUSED_PARAM) {
Opcode_IQUERY(const s_Opcode*) {
return (Opcode_createStatic(Opcode::IQUERY()));
}
PyObject*
Opcode_STATUS(const s_Opcode* self UNUSED_PARAM) {
Opcode_STATUS(const s_Opcode*) {
return (Opcode_createStatic(Opcode::STATUS()));
}
PyObject*
Opcode_RESERVED3(const s_Opcode* self UNUSED_PARAM) {
Opcode_RESERVED3(const s_Opcode*) {
return (Opcode_createStatic(Opcode::RESERVED3()));
}
PyObject*
Opcode_NOTIFY(const s_Opcode* self UNUSED_PARAM) {
Opcode_NOTIFY(const s_Opcode*) {
return (Opcode_createStatic(Opcode::NOTIFY()));
}
PyObject*
Opcode_UPDATE(const s_Opcode* self UNUSED_PARAM) {
Opcode_UPDATE(const s_Opcode*) {
return (Opcode_createStatic(Opcode::UPDATE()));
}
PyObject*
Opcode_RESERVED6(const s_Opcode* self UNUSED_PARAM) {
Opcode_RESERVED6(const s_Opcode*) {
return (Opcode_createStatic(Opcode::RESERVED6()));
}
PyObject*
Opcode_RESERVED7(const s_Opcode* self UNUSED_PARAM) {
Opcode_RESERVED7(const s_Opcode*) {
return (Opcode_createStatic(Opcode::RESERVED7()));
}
PyObject*
Opcode_RESERVED8(const s_Opcode* self UNUSED_PARAM) {
Opcode_RESERVED8(const s_Opcode*) {
return (Opcode_createStatic(Opcode::RESERVED8()));
}
PyObject*
Opcode_RESERVED9(const s_Opcode* self UNUSED_PARAM) {
Opcode_RESERVED9(const s_Opcode*) {
return (Opcode_createStatic(Opcode::RESERVED9()));
}
PyObject*