}
void request() {
- (void) input();
- (void) input.read();
+ senf::IGNORE( input() );
+ senf::IGNORE( input.read() );
}
};
ppi::connect(source,target);
ppi::init();
- (void) target.request();
+ senf::IGNORE( target.request() );
BOOST_CHECK( true );
}
prefix_ void senf::ppi::module::DiscardSink::request()
{
- (void) input();
+ senf::IGNORE( input() );
}
///////////////////////////////cc.e////////////////////////////////////////
# ifdef BOOST_HAS_TYPE_TRAITS_INTRINSICS
senf::Packet packet (FooPacket::create());
- (void) packet.annotation<InvalidAnnotation>();
+ senf::IGNORE( packet.annotation<InvalidAnnotation>() );
# else
# endif
int main(int argc, char const ** argv)
{
// Link in logger library ...
- (void) senf::log::StreamRegistry::instance();
+ senf::IGNORE( senf::log::StreamRegistry::instance() );
for (int i (1); i<argc; ++i) {
senf::detail::PacketRegistryImplBase::clear();
void *handle = dlopen(argv[i], RTLD_NOW | RTLD_GLOBAL);
#include <senf/config.hh>
#include <stdint.h>
#include <stdio.h>
+#include "senf/Utils/IgnoreValue.hh"
//#include "FIFORunner.mpp"
#define prefix_
static void * entries[SENF_DEBUG_BACKTRACE_NUMCALLERS];
// We don't care if the write commands below fail, we just give our best to inform the user
- (void) write(1, "\n\n*** Scheduler task hanging (pid ",34);
+ senf::IGNORE( write(1, "\n\n*** Scheduler task hanging (pid ",34) );
static char pid[7];
::snprintf(pid, 7, "%6d", ::getpid());
pid[6] = 0;
- (void) write(1, pid, 6);
- (void) write(1, "): ", 3);
- (void) write(1, runningName_.c_str(), runningName_.size());
- (void) write(1, " at\n ", 3);
+ senf::IGNORE( write(1, pid, 6) );
+ senf::IGNORE( write(1, "): ", 3) );
+ senf::IGNORE( write(1, runningName_.c_str(), runningName_.size()) );
+ senf::IGNORE( write(1, " at\n ", 3) );
#ifdef SENF_DEBUG
unsigned nEntries( ::backtrace(entries, SENF_DEBUG_BACKTRACE_NUMCALLERS) );
for (unsigned i (0); i < nEntries; ++i) {
- write(1, " 0x", 3);
+ senf::IGNORE( write(1, " 0x", 3) );
for (unsigned j (sizeof(void*)); j > 0; --j) {
uintptr_t v ( reinterpret_cast<uintptr_t>(entries[i]) >> (8*(j-1)) );
- (void) write(1, &(hex[ (v >> 4) & 0x0f ]), 1);
- (void) write(1, &(hex[ (v ) & 0x0f ]), 1);
+ senf::IGNORE( write(1, &(hex[ (v >> 4) & 0x0f ]), 1) );
+ senf::IGNORE( write(1, &(hex[ (v ) & 0x0f ]), 1) );
}
}
#endif
- (void) write(1, "\n", 1);
+ senf::IGNORE( write(1, "\n", 1) );
#ifdef SENF_DEBUG
- (void) write(1, "Task was initialized at\n", 24);
- (void) write(1, runningBacktrace_.c_str(), runningBacktrace_.size());
+ senf::IGNORE( write(1, "Task was initialized at\n", 24) );
+ senf::IGNORE( write(1, runningBacktrace_.c_str(), runningBacktrace_.size()) );
#endif
- (void) write(1, "\n", 1);
+ senf::IGNORE( write(1, "\n", 1) );
if (watchdogAbort_)
assert(false);
}
// Custom includes
#include <senf/Utils/senfassert.hh>
#include <senf/Utils/signalnames.hh>
+#include "senf/Utils/IgnoreValue.hh"
//#include "SignalEvent.mpp"
#define prefix_
// The manpage says, si_signo is unused in linux so we set it here
siginfo->si_signo = signal;
// We can't do much on error anyway so we ignore errors here
- (void) write(instance().sigPipe_[1], siginfo, sizeof(*siginfo));
+ senf::IGNORE( write(instance().sigPipe_[1], siginfo, sizeof(*siginfo)) );
}
prefix_ void senf::scheduler::SignalEvent::v_run()
#ifdef HAVE_TIMERFD
#include <sys/timerfd.h>
#endif
+#include "senf/Utils/IgnoreValue.hh"
//#include "TimerSource.mpp"
#define prefix_
return;
static char data = '\xD0';
// If the write fails there's not much we can do anyways ...
- (void) write(static_cast<POSIXTimerSource*>(siginfo->si_value.sival_ptr)->timerPipe_[1],
- &data, sizeof(data));
+ senf::IGNORE( write(static_cast<POSIXTimerSource*>(siginfo->si_value.sival_ptr)->timerPipe_[1],
+ &data, sizeof(data)) );
}
prefix_ void senf::scheduler::detail::POSIXTimerSource::signal(int events)
char data;
// This should never fail since we are reading a single character from a signaled
// filedescriptor
- (void) read(timerPipe_[0], &data, sizeof(data));
+ senf::IGNORE( read(timerPipe_[0], &data, sizeof(data)) );
timeoutEnabled_ = false;
}
{
uint64_t expirations (0);
// We ignore the return value since we ignore the value read anyways
- (void) read(timerfd_, &expirations, sizeof(expirations));
+ senf::IGNORE( read(timerfd_, &expirations, sizeof(expirations)) );
}
prefix_ void senf::scheduler::detail::TimerFDTimerSource::reschedule()
int n = read(sock,buffer,1024);
if (n == 4 && strncmp(buffer,"QUIT",4) == 0)
break;
- (void) write(sock,buffer,n);
+ senf::IGNORE( write(sock,buffer,n) );
}
if (shutdown(sock, SHUT_RDWR) < 0) fail("server_v4","shutdown()");
int n = read(sock,buffer,1024);
if (n == 4 && strncmp(buffer,"QUIT",4) == 0)
break;
- (void) write(sock,buffer,n);
+ senf::IGNORE( write(sock,buffer,n) );
}
if (shutdown(sock, SHUT_RDWR) < 0) fail("server_v6","shutdown()");
int n = read(sock,buffer,1024);
if (n == 4 && strncmp(buffer,"QUIT",4) == 0)
break;
- (void) write(sock,buffer,n);
+ senf::IGNORE( write(sock,buffer,n) );
}
if (shutdown(sock, SHUT_RDWR) < 0) fail("client_v4","shutdown()");
int n = read(sock,buffer,1024);
if (n == 4 && strncmp(buffer,"QUIT",4) == 0)
break;
- (void) write(sock,buffer,n);
+ senf::IGNORE( write(sock,buffer,n) );
}
if (shutdown(sock, SHUT_RDWR) < 0) fail("client_v6","shutdown()");
// Custom includes
#include <senf/Utils/Exception.hh>
+#include "senf/Utils/IgnoreValue.hh"
#define prefix_
///////////////////////////////ct.p////////////////////////////////////////
// to the corresponding (static) policy of this class. Throws
// std::bad_cast on failure
-# define SP_CheckPolicy(x1,x2,SomePolicy) \
- (void) dynamic_cast<BOOST_PP_CAT(SomePolicy,_) const &>( \
- other.BOOST_PP_CAT(the,SomePolicy)());
+# define SP_CheckPolicy(x1,x2,SomePolicy) \
+ senf::IGNORE( dynamic_cast<BOOST_PP_CAT(SomePolicy,_) const &>( \
+ other.BOOST_PP_CAT(the,SomePolicy)()) );
try {
BOOST_PP_SEQ_FOR_EACH( SP_CheckPolicy, , SENF_SOCKET_POLICIES )
// Custom includes
#include "Buffer.hh"
+#include "IgnoreValue.hh"
#include <senf/Utils/auto_unit_test.hh>
#include <boost/test/test_tools.hpp>
+#include "senf/Utils/IgnoreValue.hh"
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
// Just check for compile errors, the rest can't be checked
SENF_SCOPED_BUFFER(char, buf, size);
- (void) buf;
-
+ senf::IGNORE( buf );
+
BOOST_CHECK( true );
}
#include <senf/Utils/senfassert.hh>
#include <senf/Utils/Range.hh>
#include "Server.hh"
+#include "senf/Utils/IgnoreValue.hh"
//#include "Executor.mpp"
#define prefix_
{
if (skipping())
return "";
- (void) cwd(); // ensure, cwd is live.
+ senf::IGNORE( cwd() ); // ensure, cwd is live.
return "/" + senf::stringJoin(
senf::make_transform_range(
boost::make_iterator_range(boost::next(cwd_.begin()), cwd_.end()),
SENF_LOG(( "Executing: " << command ));
if (! skipping())
- (void) cwd(); // Prune the cwd path of expired entries
+ senf::IGNORE( cwd() ); // Prune the cwd path of expired entries
try {
switch(command.builtin()) {
{
if (dir.size() == 1 && *dir.begin() == WordToken("-")) {
cwd_.swap(oldCwd_);
- (void) cwd(); // Prune any expired items
+ senf::IGNORE( cwd() ); // Prune any expired items
}
else {
// We need to use a temporary so an error somewhere while traversing the dir does not cause
#include <boost/bind.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/at.hpp>
+#include "senf/Utils/IgnoreValue.hh"
// ///////////////////////////mpp.p////////////////////////////////////////
#elif BOOST_PP_IS_ITERATING // ////////////////////////////////////////////
if ( nArgs > BOOST_PP_ITERATION() )
throw SyntaxErrorException("invalid number of arguments");
int nDefaults ( BOOST_PP_ITERATION() - nArgs );
- (void) nDefaults;
+ senf::IGNORE( nDefaults );
typedef typename boost::range_reverse_iterator<const ParseCommandInfo::ArgumentsRange>::type
riterator;
if ( nArgs > BOOST_PP_ITERATION() )
throw SyntaxErrorException("invalid number of arguments");
int nDefaults ( BOOST_PP_ITERATION() - nArgs );
- (void) nDefaults;
+ senf::IGNORE( nDefaults );
typedef typename boost::range_reverse_iterator<const ParseCommandInfo::ArgumentsRange>::type
riterator;
.arg( "text", default_value = "" ) )
);
- (void) cbNode;
+ senf::IGNORE( cbNode );
SENF_CHECK_NO_THROW(
parser.parse("test/cb 111 222.4",
.typeName("number")
));
- (void) refvar;
+ senf::IGNORE( refvar );
dir.add("crefvar", fty::Variable(boost::cref(var))
.doc("Current blorg limit")
--- /dev/null
+// $Id$
+//
+// Copyright (C) 2010
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+// Stefan Bund <g0dil@berlios.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// 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.,
+// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+/** \file
+ \brief IgnoreValue inline template implementation */
+
+//#include "IgnoreValue.ih"
+
+// Custom includes
+
+#define prefix_ inline
+///////////////////////////////cti.p///////////////////////////////////////
+
+template <class T>
+prefix_ void senf::IGNORE(T const &)
+{}
+
+template <class T>
+prefix_ void senf::IGNORE(T const *)
+{}
+
+///////////////////////////////cti.e///////////////////////////////////////
+#undef prefix_
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// comment-column: 40
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// End:
--- /dev/null
+// $Id$
+//
+// Copyright (C) 2010
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+// Stefan Bund <g0dil@berlios.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// 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.,
+// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+/** \file
+ \brief IgnoreValue public header */
+
+#ifndef HH_SENF_senf_Utils_IgnoreValue_
+#define HH_SENF_senf_Utils_IgnoreValue_ 1
+
+// Custom includes
+
+//#include "IgnoreValue.mpp"
+///////////////////////////////hh.p////////////////////////////////////////
+
+namespace senf {
+
+ /** \brief Explicitly ignore a value
+
+ To explicitly ingore a value (e.g. the return value of a function), pass that value to
+ senf::IGNORE(). This has the added benefit of silencing \em any warnings about ignored
+ values by g++.
+ */
+ template <class T>
+ void IGNORE(T const &);
+ template <class T>
+ void IGNORE(T const *);
+
+}
+
+///////////////////////////////hh.e////////////////////////////////////////
+//#include "IgnoreValue.cci"
+//#include "IgnoreValue.ct"
+#include "IgnoreValue.cti"
+#endif
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// comment-column: 40
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// End:
// Custom includes
#include "TypeIdValue.hh"
+#include "IgnoreValue.hh"
#include <senf/Utils/auto_unit_test.hh>
#include <boost/test/test_tools.hpp>
SENF_AUTO_UNIT_TEST(typeIdValue)
{
// We don't care for the ordering, just that the following compiles
- (void) ( senf::typeIdValue<int>() < senf::typeIdValue<float>() );
+ senf::IGNORE( senf::typeIdValue<int>() < senf::typeIdValue<float>() );
BOOST_CHECK ( senf::typeIdValue<int>() != senf::typeIdValue<float>() );
BOOST_CHECK ( senf::typeIdValue<int>() == senf::typeIdValue<int>() );
}
// Custom includes
#include <iostream>
#include "singleton.hh"
+#include "IgnoreValue.hh"
#include <senf/Utils/auto_unit_test.hh>
#include <boost/test/test_tools.hpp>
SENF_AUTO_UNIT_TEST(singletonAlive)
{
- (void) AliveTest1::instance();
- (void) AliveTest2::instance();
+ senf::IGNORE( AliveTest1::instance() );
+ senf::IGNORE( AliveTest2::instance() );
BOOST_CHECK( (test1Alive && !test2Alive) || (!test1Alive && test2Alive) );
BOOST_CHECK( AliveTest1::alive() );