From 82e9e866ecf9b304a8a6ddc1ed04861c4c55c3b2 Mon Sep 17 00:00:00 2001 From: Consolatis <35009135+Consolatis@users.noreply.github.com> Date: Tue, 31 Jan 2023 03:35:13 +0100 Subject: [PATCH] Enable more compiler warnings --- meson.build | 25 ++++++++++++++++++------- src/common/dir.c | 2 +- src/common/scene-helpers.c | 1 + src/common/string-helpers.c | 1 + src/config/rcxml.c | 2 +- src/config/session.c | 3 ++- src/cursor.c | 14 +++++++------- src/debug.c | 1 + src/key-state.c | 1 + src/resistance.c | 1 + src/server.c | 1 + src/xbm/tokenize.c | 4 ++-- 12 files changed, 37 insertions(+), 19 deletions(-) diff --git a/meson.build b/meson.build index 87d359dc..ecd26d9a 100644 --- a/meson.build +++ b/meson.build @@ -19,13 +19,24 @@ add_project_arguments( cc = meson.get_compiler('c') -add_project_arguments(cc.get_supported_arguments( - [ - '-Wno-unused-parameter', - '-Wundef', - ]), - language: 'c', -) +add_project_arguments(cc.get_supported_arguments([ + '-Wundef', + '-Wlogical-op', + '-Wmissing-include-dirs', + '-Wold-style-definition', + '-Wpointer-arith', + '-Winit-self', + '-Wstrict-prototypes', + '-Wimplicit-fallthrough=2', + '-Wendif-labels', + '-Wstrict-aliasing=2', + '-Woverflow', + '-Wmissing-prototypes', + '-Walloca', + '-Wunused-macros', + + '-Wno-unused-parameter', +]), language: 'c') version='"@0@"'.format(meson.project_version()) git = find_program('git', native: true, required: false) diff --git a/src/common/dir.c b/src/common/dir.c index 8e241530..85dfea14 100644 --- a/src/common/dir.c +++ b/src/common/dir.c @@ -73,7 +73,7 @@ build_theme_path(struct ctx *ctx, char *prefix, const char *path) } } -char * +static char * find_dir(struct ctx *ctx) { char *debug = getenv("LABWC_DEBUG_DIR_CONFIG_AND_THEME"); diff --git a/src/common/scene-helpers.c b/src/common/scene-helpers.c index 6bda9bd7..ee941358 100644 --- a/src/common/scene-helpers.c +++ b/src/common/scene-helpers.c @@ -2,6 +2,7 @@ #include #include +#include "common/scene-helpers.h" struct wlr_scene_rect * lab_wlr_scene_get_rect(struct wlr_scene_node *node) diff --git a/src/common/string-helpers.c b/src/common/string-helpers.c index 8513ee0c..3900d673 100644 --- a/src/common/string-helpers.c +++ b/src/common/string-helpers.c @@ -2,6 +2,7 @@ #include #include #include +#include "common/string-helpers.h" static void rtrim(char **s) diff --git a/src/config/rcxml.c b/src/config/rcxml.c index 4d3bf6d9..cbb0ca83 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -530,7 +530,7 @@ rcxml_parse_xml(struct buf *b) } static void -rcxml_init() +rcxml_init(void) { static bool has_run; diff --git a/src/config/session.c b/src/config/session.c index 71855c9e..09f4dc01 100644 --- a/src/config/session.c +++ b/src/config/session.c @@ -11,6 +11,7 @@ #include "common/mem.h" #include "common/spawn.h" #include "common/string-helpers.h" +#include "config/session.h" static bool isfile(const char *path) @@ -51,7 +52,7 @@ error: free(value.buf); } -void +static void read_environment_file(const char *filename) { char *line = NULL; diff --git a/src/cursor.c b/src/cursor.c index 299c76b7..2728e901 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -515,7 +515,7 @@ cursor_update_focus(struct server *server) /*cursor_has_moved*/ false); } -void +static void handle_constraint_commit(struct wl_listener *listener, void *data) { struct seat *seat = wl_container_of(listener, seat, constraint_commit); @@ -523,7 +523,7 @@ handle_constraint_commit(struct wl_listener *listener, void *data) assert(constraint->surface = data); } -void +static void destroy_constraint(struct wl_listener *listener, void *data) { struct constraint *constraint = wl_container_of(listener, constraint, @@ -621,7 +621,7 @@ cursor_motion(struct wl_listener *listener, void *data) process_cursor_motion(seat->server, event->time_msec); } -void +static void cursor_motion_absolute(struct wl_listener *listener, void *data) { /* @@ -890,7 +890,7 @@ cursor_button_release(struct seat *seat, struct wlr_pointer_button_event *event) } } -void +static void cursor_button(struct wl_listener *listener, void *data) { /* @@ -943,7 +943,7 @@ compare_delta(const struct wlr_pointer_axis_event *event, double *accum) return 0; } -bool +static bool handle_cursor_axis(struct server *server, struct cursor_context *ctx, struct wlr_pointer_axis_event *event) { @@ -989,7 +989,7 @@ handle_cursor_axis(struct server *server, struct cursor_context *ctx, return handled; } -void +static void cursor_axis(struct wl_listener *listener, void *data) { /* @@ -1016,7 +1016,7 @@ cursor_axis(struct wl_listener *listener, void *data) } } -void +static void cursor_frame(struct wl_listener *listener, void *data) { /* diff --git a/src/debug.c b/src/debug.c index 9ad0910b..b0548e74 100644 --- a/src/debug.c +++ b/src/debug.c @@ -2,6 +2,7 @@ #include #include #include "common/scene-helpers.h" +#include "debug.h" #include "labwc.h" #include "node.h" #include "ssd.h" diff --git a/src/key-state.c b/src/key-state.c index 2175e46d..f95d480c 100644 --- a/src/key-state.c +++ b/src/key-state.c @@ -2,6 +2,7 @@ #include #include #include +#include "key-state.h" #define MAX_PRESSED_KEYS (16) diff --git a/src/resistance.c b/src/resistance.c index 2f40ca15..9d1afb70 100644 --- a/src/resistance.c +++ b/src/resistance.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only #include "config/rcxml.h" #include "labwc.h" +#include "resistance.h" #include "view.h" struct edges { diff --git a/src/server.c b/src/server.c index 7fbc3805..3d36526c 100644 --- a/src/server.c +++ b/src/server.c @@ -159,6 +159,7 @@ server_global_filter(const struct wl_client *client, const struct wl_global *glo { const struct wl_interface *iface = wl_global_get_interface(global); struct server *server = (struct server *)data; + /* Silence unused var compiler warnings */ (void)iface; (void)server; #if HAVE_XWAYLAND diff --git a/src/xbm/tokenize.c b/src/xbm/tokenize.c index 218d0bd2..4675c0f0 100644 --- a/src/xbm/tokenize.c +++ b/src/xbm/tokenize.c @@ -30,7 +30,7 @@ add_token(enum token_type token_type) } static void -get_identifier_token() +get_identifier_token(void) { struct token *token = tokens + nr_tokens - 1; token->name[token->pos] = current_buffer_position[0]; @@ -79,7 +79,7 @@ get_number_token(void) } static void -get_special_char_token() +get_special_char_token(void) { struct token *token = tokens + nr_tokens - 1; token->name[0] = current_buffer_position[0];