summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPovilas Kanapickas <povilas@radix.lt>2020-11-27 18:48:57 +0200
committerPovilas Kanapickas <povilas@radix.lt>2020-11-27 18:48:57 +0200
commitd0847fc23054b4c1478b978087b8fa0a211a5fd1 (patch)
tree9430bd1693226551440d241b4afe9045edafc410
parentb9be5bc03baceeae108e8a09a2559b33400f395f (diff)
Fix unused parameter warnings
-rw-r--r--src/defines.h6
-rw-r--r--src/xserver.cpp4
-rw-r--r--test/xserver-test.cpp8
3 files changed, 15 insertions, 3 deletions
diff --git a/src/defines.h b/src/defines.h
index dd0f9e4..ed238b5 100644
--- a/src/defines.h
+++ b/src/defines.h
@@ -9,4 +9,10 @@
#define DEFAULT_XORG_SERVER "Xorg"
#endif
+#if defined __GNUC__ || defined __clang__
+#define XORG_GTEST_UNUSED __attribute__((unused))
+#else
+#define XORG_GTEST_UNUSED
+#endif
+
#endif
diff --git a/src/xserver.cpp b/src/xserver.cpp
index 9d3706d..82e9393 100644
--- a/src/xserver.cpp
+++ b/src/xserver.cpp
@@ -399,7 +399,7 @@ const std::string& xorg::testing::XServer::GetVersion(void) {
return d_->version;
}
-static int _x_error_handler(Display *dpy, XErrorEvent *err)
+static int _x_error_handler(XORG_GTEST_UNUSED Display *dpy, XErrorEvent *err)
{
std::stringstream error;
switch(err->error_code) {
@@ -435,7 +435,7 @@ static int _x_error_handler(Display *dpy, XErrorEvent *err)
static int _x_io_error_handler(Display *dpy) _X_NORETURN;
-static int _x_io_error_handler(Display *dpy)
+static int _x_io_error_handler(XORG_GTEST_UNUSED Display *dpy)
{
throw xorg::testing::XIOError("Connection to X Server lost. Possible server crash.");
}
diff --git a/test/xserver-test.cpp b/test/xserver-test.cpp
index 785a152..ac37f5f 100644
--- a/test/xserver-test.cpp
+++ b/test/xserver-test.cpp
@@ -9,6 +9,12 @@
#include <gtest/gtest-spi.h>
#include <X11/extensions/XInput2.h>
+#if defined __GNUC__ || defined __clang__
+#define XORG_GTEST_UNUSED __attribute__((unused))
+#else
+#define XORG_GTEST_UNUSED
+#endif
+
using namespace xorg::testing;
TEST(XServer, LogRemoval)
@@ -247,7 +253,7 @@ TEST(XServer, ErrorHandler)
static bool error_handler_triggered = false;
-static int _test_error_handler(Display *dpy, XErrorEvent *error) {
+static int _test_error_handler(XORG_GTEST_UNUSED Display *dpy, XErrorEvent *error) {
error_handler_triggered = true;
if (error->error_code != BadColor)
ADD_FAILURE() << "Error handler triggered with wrong error code\n";