Build glfw with all warnings enabled

This commit is contained in:
Kovid Goyal
2019-07-01 10:42:07 +05:30
parent 9bc288cd8e
commit 841c907efc
31 changed files with 370 additions and 406 deletions

119
glfw/wl_init.c vendored
View File

@@ -79,12 +79,12 @@ static _GLFWwindow* findWindowFromDecorationSurface(struct wl_surface* surface,
return window;
}
static void pointerHandleEnter(void* data,
struct wl_pointer* pointer,
static void pointerHandleEnter(void* data UNUSED,
struct wl_pointer* pointer UNUSED,
uint32_t serial,
struct wl_surface* surface,
wl_fixed_t sx,
wl_fixed_t sy)
wl_fixed_t sx UNUSED,
wl_fixed_t sy UNUSED)
{
// Happens in the case we just destroyed the surface.
if (!surface)
@@ -109,10 +109,10 @@ static void pointerHandleEnter(void* data,
_glfwInputCursorEnter(window, true);
}
static void pointerHandleLeave(void* data,
struct wl_pointer* pointer,
static void pointerHandleLeave(void* data UNUSED,
struct wl_pointer* pointer UNUSED,
uint32_t serial,
struct wl_surface* surface)
struct wl_surface* surface UNUSED)
{
_GLFWwindow* window = _glfw.wl.pointerFocus;
@@ -154,9 +154,9 @@ static void setCursor(GLFWCursorShape shape)
wl_surface_commit(surface);
}
static void pointerHandleMotion(void* data,
struct wl_pointer* pointer,
uint32_t time,
static void pointerHandleMotion(void* data UNUSED,
struct wl_pointer* pointer UNUSED,
uint32_t time UNUSED,
wl_fixed_t sx,
wl_fixed_t sy)
{
@@ -209,10 +209,10 @@ static void pointerHandleMotion(void* data,
setCursor(cursorShape);
}
static void pointerHandleButton(void* data,
struct wl_pointer* pointer,
static void pointerHandleButton(void* data UNUSED,
struct wl_pointer* pointer UNUSED,
uint32_t serial,
uint32_t time,
uint32_t time UNUSED,
uint32_t button,
uint32_t state)
{
@@ -296,9 +296,9 @@ static void pointerHandleButton(void* data,
_glfw.wl.xkb.states.modifiers);
}
static void pointerHandleAxis(void* data,
struct wl_pointer* pointer,
uint32_t time,
static void pointerHandleAxis(void* data UNUSED,
struct wl_pointer* pointer UNUSED,
uint32_t time UNUSED,
uint32_t axis,
wl_fixed_t value)
{
@@ -326,8 +326,8 @@ static const struct wl_pointer_listener pointerListener = {
pointerHandleAxis,
};
static void keyboardHandleKeymap(void* data,
struct wl_keyboard* keyboard,
static void keyboardHandleKeymap(void* data UNUSED,
struct wl_keyboard* keyboard UNUSED,
uint32_t format,
int fd,
uint32_t size)
@@ -351,11 +351,11 @@ static void keyboardHandleKeymap(void* data,
}
static void keyboardHandleEnter(void* data,
struct wl_keyboard* keyboard,
uint32_t serial,
static void keyboardHandleEnter(void* data UNUSED,
struct wl_keyboard* keyboard UNUSED,
uint32_t serial UNUSED,
struct wl_surface* surface,
struct wl_array* keys)
struct wl_array* keys UNUSED)
{
// Happens in the case we just destroyed the surface.
if (!surface)
@@ -373,10 +373,10 @@ static void keyboardHandleEnter(void* data,
_glfwInputWindowFocus(window, true);
}
static void keyboardHandleLeave(void* data,
struct wl_keyboard* keyboard,
uint32_t serial,
struct wl_surface* surface)
static void keyboardHandleLeave(void* data UNUSED,
struct wl_keyboard* keyboard UNUSED,
uint32_t serial UNUSED,
struct wl_surface* surface UNUSED)
{
_GLFWwindow* window = _glfw.wl.keyboardFocus;
@@ -388,7 +388,7 @@ static void keyboardHandleLeave(void* data,
}
static void
dispatchPendingKeyRepeats(id_type timer_id, void *data) {
dispatchPendingKeyRepeats(id_type timer_id UNUSED, void *data UNUSED) {
if (_glfw.wl.keyRepeatInfo.keyboardFocus != _glfw.wl.keyboardFocus || _glfw.wl.keyboardRepeatRate == 0) return;
glfw_xkb_handle_key_event(_glfw.wl.keyRepeatInfo.keyboardFocus, &_glfw.wl.xkb, _glfw.wl.keyRepeatInfo.key, GLFW_REPEAT);
changeTimerInterval(&_glfw.wl.eventLoopData, _glfw.wl.keyRepeatInfo.keyRepeatTimer, (1.0 / (double)_glfw.wl.keyboardRepeatRate));
@@ -396,10 +396,10 @@ dispatchPendingKeyRepeats(id_type timer_id, void *data) {
}
static void keyboardHandleKey(void* data,
struct wl_keyboard* keyboard,
uint32_t serial,
uint32_t time,
static void keyboardHandleKey(void* data UNUSED,
struct wl_keyboard* keyboard UNUSED,
uint32_t serial UNUSED,
uint32_t time UNUSED,
uint32_t key,
uint32_t state)
{
@@ -422,9 +422,9 @@ static void keyboardHandleKey(void* data,
toggleTimer(&_glfw.wl.eventLoopData, _glfw.wl.keyRepeatInfo.keyRepeatTimer, repeatable ? 1 : 0);
}
static void keyboardHandleModifiers(void* data,
struct wl_keyboard* keyboard,
uint32_t serial,
static void keyboardHandleModifiers(void* data UNUSED,
struct wl_keyboard* keyboard UNUSED,
uint32_t serial UNUSED,
uint32_t modsDepressed,
uint32_t modsLatched,
uint32_t modsLocked,
@@ -433,7 +433,7 @@ static void keyboardHandleModifiers(void* data,
glfw_xkb_update_modifiers(&_glfw.wl.xkb, modsDepressed, modsLatched, modsLocked, 0, 0, group);
}
static void keyboardHandleRepeatInfo(void* data,
static void keyboardHandleRepeatInfo(void* data UNUSED,
struct wl_keyboard* keyboard,
int32_t rate,
int32_t delay)
@@ -454,7 +454,7 @@ static const struct wl_keyboard_listener keyboardListener = {
keyboardHandleRepeatInfo,
};
static void seatHandleCapabilities(void* data,
static void seatHandleCapabilities(void* data UNUSED,
struct wl_seat* seat,
enum wl_seat_capability caps)
{
@@ -481,9 +481,9 @@ static void seatHandleCapabilities(void* data,
}
}
static void seatHandleName(void* data,
struct wl_seat* seat,
const char* name)
static void seatHandleName(void* data UNUSED,
struct wl_seat* seat UNUSED,
const char* name UNUSED)
{
}
@@ -492,7 +492,7 @@ static const struct wl_seat_listener seatListener = {
seatHandleName,
};
static void wmBaseHandlePing(void* data,
static void wmBaseHandlePing(void* data UNUSED,
struct xdg_wm_base* wmBase,
uint32_t serial)
{
@@ -503,7 +503,7 @@ static const struct xdg_wm_base_listener wmBaseListener = {
wmBaseHandlePing
};
static void registryHandleGlobal(void* data,
static void registryHandleGlobal(void* data UNUSED,
struct wl_registry* registry,
uint32_t name,
const char* interface,
@@ -609,8 +609,8 @@ static void registryHandleGlobal(void* data,
}
static void registryHandleGlobalRemove(void *data,
struct wl_registry *registry,
static void registryHandleGlobalRemove(void *data UNUSED,
struct wl_registry *registry UNUSED,
uint32_t name)
{
_GLFWmonitor* monitor;
@@ -642,19 +642,19 @@ static const struct wl_registry_listener registryListener = {
static void registry_handle_global(void* data,
struct wl_registry* registry,
uint32_t name,
struct wl_registry* registry UNUSED,
uint32_t name UNUSED,
const char* interface,
uint32_t version) {
uint32_t version UNUSED) {
if (strcmp(interface, "zxdg_decoration_manager_v1") == 0) {
bool *has_ssd = (bool*)data;
if (has_ssd) *has_ssd = true;
}
}
static void registry_handle_global_remove(void *data,
struct wl_registry *registry,
uint32_t name) {}
static void registry_handle_global_remove(void *data UNUSED,
struct wl_registry *registry UNUSED,
uint32_t name UNUSED) {}
GLFWAPI const char*
glfwWaylandCheckForServerSideDecorations(void) {
struct wl_display *display = wl_display_connect(NULL);
@@ -694,14 +694,10 @@ int _glfwPlatformInit(void)
return false;
}
_glfw.wl.cursor.theme_load = (PFN_wl_cursor_theme_load)
_glfw_dlsym(_glfw.wl.cursor.handle, "wl_cursor_theme_load");
_glfw.wl.cursor.theme_destroy = (PFN_wl_cursor_theme_destroy)
_glfw_dlsym(_glfw.wl.cursor.handle, "wl_cursor_theme_destroy");
_glfw.wl.cursor.theme_get_cursor = (PFN_wl_cursor_theme_get_cursor)
_glfw_dlsym(_glfw.wl.cursor.handle, "wl_cursor_theme_get_cursor");
_glfw.wl.cursor.image_get_buffer = (PFN_wl_cursor_image_get_buffer)
_glfw_dlsym(_glfw.wl.cursor.handle, "wl_cursor_image_get_buffer");
glfw_dlsym(_glfw.wl.cursor.theme_load, _glfw.wl.cursor.handle, "wl_cursor_theme_load");
glfw_dlsym(_glfw.wl.cursor.theme_destroy, _glfw.wl.cursor.handle, "wl_cursor_theme_destroy");
glfw_dlsym(_glfw.wl.cursor.theme_get_cursor, _glfw.wl.cursor.handle, "wl_cursor_theme_get_cursor");
glfw_dlsym(_glfw.wl.cursor.image_get_buffer, _glfw.wl.cursor.handle, "wl_cursor_image_get_buffer");
_glfw.wl.egl.handle = _glfw_dlopen("libwayland-egl.so.1");
if (!_glfw.wl.egl.handle)
@@ -711,12 +707,9 @@ int _glfwPlatformInit(void)
return false;
}
_glfw.wl.egl.window_create = (PFN_wl_egl_window_create)
_glfw_dlsym(_glfw.wl.egl.handle, "wl_egl_window_create");
_glfw.wl.egl.window_destroy = (PFN_wl_egl_window_destroy)
_glfw_dlsym(_glfw.wl.egl.handle, "wl_egl_window_destroy");
_glfw.wl.egl.window_resize = (PFN_wl_egl_window_resize)
_glfw_dlsym(_glfw.wl.egl.handle, "wl_egl_window_resize");
glfw_dlsym(_glfw.wl.egl.window_create, _glfw.wl.egl.handle, "wl_egl_window_create");
glfw_dlsym(_glfw.wl.egl.window_destroy, _glfw.wl.egl.handle, "wl_egl_window_destroy");
glfw_dlsym(_glfw.wl.egl.window_resize, _glfw.wl.egl.handle, "wl_egl_window_resize");
_glfw.wl.display = wl_display_connect(NULL);
if (!_glfw.wl.display)