]> git.lizzy.rs Git - shadowclad.git/commitdiff
Add prelude with UNUSED macro
authoroutfrost <kotlet.bahn@gmail.com>
Sun, 5 Jul 2020 03:50:11 +0000 (05:50 +0200)
committeroutfrost <kotlet.bahn@gmail.com>
Sun, 5 Jul 2020 03:50:11 +0000 (05:50 +0200)
src/engine/_prelude.h [new file with mode: 0644]
src/engine/engine.c
src/engine/input.c
src/engine/ui.c
src/game/input.c

diff --git a/src/engine/_prelude.h b/src/engine/_prelude.h
new file mode 100644 (file)
index 0000000..a97c9ba
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef ENGINE_PRELUDE_H_
+#define ENGINE_PRELUDE_H_
+
+#ifdef __GNUC__
+
+#      define UNUSED __attribute__((unused))
+
+#else // __GNUC__
+
+#      define UNUSED
+
+#endif // __GNUC__
+
+#endif // ENGINE_PRELUDE_H_
index 34c6d143f1362bbbaf6c289f4a496e2b94c9f502..1e7849f7a33dc45cf85d5409406de78a005bd8d7 100644 (file)
@@ -5,6 +5,7 @@
 #include <GL/glxew.h>
 #include <GLFW/glfw3.h>
 
+#include "_prelude.h"
 #include "input.h"
 #include "logger.h"
 #include "performance.h"
@@ -111,6 +112,6 @@ EngineConfig defaultConfig() {
                                .swapInterval = 1 };
 }
 
-static void onGlfwError(int error, const char* description) {
+static void onGlfwError(int error UNUSED, const char* description) {
        logError("GLFW error: %s", description);
 }
index b8431434ff2a1423726a99aaef1cdb13e4edb9ba..df33578353e1d0f74b4489df1a6960ca9e111bbe 100644 (file)
@@ -2,13 +2,14 @@
 
 #include <stdbool.h>
 
+#include "_prelude.h"
 #include "render.h"
 
 static void (*keyboardInputCallback) (int, int, int, int);
 
 
 
-void onKeyboardEvent(GLFWwindow* window, int key, int scancode, int action, int mods) {
+void onKeyboardEvent(GLFWwindow* window UNUSED, int key, int scancode, int action, int mods) {
        if (!(mods & GLFW_MOD_CONTROL)) {
                if (keyboardInputCallback) {
                        keyboardInputCallback(key, scancode, action, mods);
index 7a8da1db5526a99527a69e13592825fccce90f3f..3bd283a17be5efa0af881ec9a057c33e8ac3a08f 100644 (file)
@@ -1,8 +1,9 @@
 #include "ui.h"
 
+#include "_prelude.h"
 #include "render.h"
 
-void resizeStage(GLFWwindow* window, int width, int height) {
+void resizeStage(GLFWwindow* window UNUSED, int width, int height) {
        if (height == 0)
                height = 1;
 
index f52a27e79742ec4bff65c73279399096e4dc4b5f..089291a7c5dfb485d02d382b7da081863747d787 100644 (file)
@@ -2,9 +2,11 @@
 
 #include <GLFW/glfw3.h>
 
+#include "engine/_prelude.h"
+
 #include "player.h"
 
-void keyboardInput(int key, int scancode, int action, int mods) {
+void keyboardInput(int key, int scancode UNUSED, int action, int mods UNUSED) {
        switch (key) {
                case GLFW_KEY_W:
                        if (action == GLFW_PRESS) {