Fix unused parameter errors under -Werror
authorMarcus Holland-Moritz <mhx@fb.com>
Thu, 28 Jan 2016 16:05:32 +0000 (08:05 -0800)
committerfacebook-github-bot-0 <folly-bot@fb.com>
Thu, 28 Jan 2016 16:20:24 +0000 (08:20 -0800)
Summary:
D2872406 enables -Werror=unused-parameter, which in conjunction with mode/opt
(which eliminates asserts) causes two files in folly/io/async to fail to compile.
This change works around the error.

Reviewed By: vchalyshev

Differential Revision: D2874625

fb-gh-sync-id: 97104679f964390c5df88ee7831af7df243a152a

folly/io/async/AsyncTimeout.cpp
folly/io/async/EventHandler.cpp

index 7b6ab3db67e81c8af0ada0541f67c2ce9ee06673..0fedd6fb19560e4ee97cfde384038a0dc4f675a6 100644 (file)
@@ -142,6 +142,9 @@ void AsyncTimeout::libeventCallback(int fd, short events, void* arg) {
   AsyncTimeout* timeout = reinterpret_cast<AsyncTimeout*>(arg);
   assert(fd == -1);
   assert(events == EV_TIMEOUT);
+  // prevent unused variable warnings
+  (void)fd;
+  (void)events;
 
   // double check that ev_flags gets reset when the timeout is not running
   assert((event_ref_flags(&timeout->event_) & ~EVLIST_INTERNAL) == EVLIST_INIT);
index ab5cad6bdf39e833ea8de142d8205fdf952c60c5..a8ae4bf0fecd7a8243fa1d3f7cf2deb0f5033ba8 100644 (file)
@@ -147,6 +147,7 @@ void EventHandler::ensureNotRegistered(const char* fn) {
 void EventHandler::libeventCallback(int fd, short events, void* arg) {
   EventHandler* handler = reinterpret_cast<EventHandler*>(arg);
   assert(fd == handler->event_.ev_fd);
+  (void)fd; // prevent unused variable warnings
 
   auto observer = handler->eventBase_->getExecutionObserver();
   if (observer) {