From 16e5e9541b3de49e397a3d2caa3212db25487648 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 20 Nov 2019 00:45:19 +0100 Subject: [PATCH] Add -Wmissing-prototypes This requires functions without a prototype definition to be static. This allows to detect dead code, export less symbols and put shared functions in headers. --- backend/drm/atomic.c | 6 ---- backend/drm/legacy.c | 4 +-- backend/libinput/events.c | 2 +- backend/wayland/wl_seat.c | 2 +- examples/dmabuf-capture.c | 4 +-- examples/idle.c | 8 ++--- examples/multi-pointer.c | 34 ++++--------------- examples/output-layout.c | 12 +++---- examples/pointer.c | 12 +++---- examples/rotation.c | 10 +++--- examples/simple.c | 12 +++---- examples/tablet.c | 10 +++--- examples/touch.c | 10 +++--- include/backend/drm/drm.h | 5 +++ meson.build | 1 + render/gles2/texture.c | 2 +- render/gles2/util.c | 38 ---------------------- render/meson.build | 1 - types/data_device/wlr_drag.c | 2 +- types/wlr_foreign_toplevel_management_v1.c | 4 +-- types/wlr_output_layout.c | 2 +- types/wlr_screencopy_v1.c | 2 +- types/wlr_server_decoration.c | 3 +- types/wlr_xdg_decoration_v1.c | 3 +- 24 files changed, 66 insertions(+), 123 deletions(-) delete mode 100644 render/gles2/util.c diff --git a/backend/drm/atomic.c b/backend/drm/atomic.c index 023307fc..71b18f98 100644 --- a/backend/drm/atomic.c +++ b/backend/drm/atomic.c @@ -154,9 +154,6 @@ static bool atomic_conn_enable(struct wlr_drm_backend *drm, true); } -bool legacy_crtc_set_cursor(struct wlr_drm_backend *drm, - struct wlr_drm_crtc *crtc, struct gbm_bo *bo); - static bool atomic_crtc_set_cursor(struct wlr_drm_backend *drm, struct wlr_drm_crtc *crtc, struct gbm_bo *bo) { if (!crtc || !crtc->cursor) { @@ -185,9 +182,6 @@ static bool atomic_crtc_set_cursor(struct wlr_drm_backend *drm, return atomic_end(drm->fd, &atom); } -bool legacy_crtc_move_cursor(struct wlr_drm_backend *drm, - struct wlr_drm_crtc *crtc, int x, int y); - static bool atomic_crtc_move_cursor(struct wlr_drm_backend *drm, struct wlr_drm_crtc *crtc, int x, int y) { if (!crtc || !crtc->cursor) { diff --git a/backend/drm/legacy.c b/backend/drm/legacy.c index 79cd05b9..32d68814 100644 --- a/backend/drm/legacy.c +++ b/backend/drm/legacy.c @@ -68,13 +68,13 @@ bool legacy_crtc_move_cursor(struct wlr_drm_backend *drm, return !drmModeMoveCursor(drm->fd, crtc->id, x, y); } -bool legacy_crtc_set_gamma(struct wlr_drm_backend *drm, +static bool legacy_crtc_set_gamma(struct wlr_drm_backend *drm, struct wlr_drm_crtc *crtc, size_t size, uint16_t *r, uint16_t *g, uint16_t *b) { return !drmModeCrtcSetGamma(drm->fd, crtc->id, (uint32_t)size, r, g, b); } -size_t legacy_crtc_get_gamma_size(struct wlr_drm_backend *drm, +static size_t legacy_crtc_get_gamma_size(struct wlr_drm_backend *drm, struct wlr_drm_crtc *crtc) { return (size_t)crtc->legacy_crtc->gamma_size; } diff --git a/backend/libinput/events.c b/backend/libinput/events.c index 19c66f38..fa29ef93 100644 --- a/backend/libinput/events.c +++ b/backend/libinput/events.c @@ -9,7 +9,7 @@ #include "backend/libinput.h" #include "util/signal.h" -struct wlr_libinput_input_device *get_libinput_device_from_device( +static struct wlr_libinput_input_device *get_libinput_device_from_device( struct wlr_input_device *wlr_dev) { assert(wlr_input_device_is_libinput(wlr_dev)); return (struct wlr_libinput_input_device *)wlr_dev; diff --git a/backend/wayland/wl_seat.c b/backend/wayland/wl_seat.c index cbe502e6..f80cf829 100644 --- a/backend/wayland/wl_seat.c +++ b/backend/wayland/wl_seat.c @@ -447,7 +447,7 @@ static struct zwp_pointer_gesture_pinch_v1_listener gesture_pinch_impl = { }; -void relative_pointer_handle_relative_motion(void *data, +static void relative_pointer_handle_relative_motion(void *data, struct zwp_relative_pointer_v1 *relative_pointer, uint32_t utime_hi, uint32_t utime_lo, wl_fixed_t dx, wl_fixed_t dy, wl_fixed_t dx_unaccel, wl_fixed_t dy_unaccel) { diff --git a/examples/dmabuf-capture.c b/examples/dmabuf-capture.c index cbe50e7d..bad8ccac 100644 --- a/examples/dmabuf-capture.c +++ b/examples/dmabuf-capture.c @@ -461,7 +461,7 @@ static void register_cb(struct capture_context *ctx) { &frame_listener, ctx); } -void *vid_encode_thread(void *arg) { +static void *vid_encode_thread(void *arg) { int err = 0; struct capture_context *ctx = arg; @@ -686,7 +686,7 @@ static int init_encoding(struct capture_context *ctx) { struct capture_context *q_ctx = NULL; -void on_quit_signal(int signo) { +static void on_quit_signal(int signo) { printf("\r"); av_log(q_ctx, AV_LOG_WARNING, "Quitting!\n"); q_ctx->quit = true; diff --git a/examples/idle.c b/examples/idle.c index 0641d4fd..0f3a7f80 100644 --- a/examples/idle.c +++ b/examples/idle.c @@ -52,7 +52,7 @@ static const struct org_kde_kwin_idle_timeout_listener idle_timer_listener = { .resumed = handle_resume, }; -int parse_args(int argc, char *argv[]) { +static int parse_args(int argc, char *argv[]) { int c; while ((c = getopt(argc, argv, "c:hs:t:")) != -1) { switch(c) @@ -81,7 +81,7 @@ int parse_args(int argc, char *argv[]) { return 0; } -void *simulate_activity(void *data) { +static void *simulate_activity(void *data) { sleep(simulate_activity_timeout); fprintf(stdout, "simulate user activity\n"); struct thread_args *arg = data; @@ -90,7 +90,7 @@ void *simulate_activity(void *data) { return NULL; } -void *close_program(void *data) { +static void *close_program(void *data) { sleep(close_timeout); struct thread_args *arg = data; org_kde_kwin_idle_timeout_release(arg->timer); @@ -100,7 +100,7 @@ void *close_program(void *data) { return NULL; } -void *main_loop(void *data) { +static void *main_loop(void *data) { struct wl_display *display = data; while (wl_display_dispatch(display) != -1) { ; diff --git a/examples/multi-pointer.c b/examples/multi-pointer.c index 691bc49d..28f6eca8 100644 --- a/examples/multi-pointer.c +++ b/examples/multi-pointer.c @@ -68,7 +68,7 @@ struct sample_keyboard { struct wl_listener destroy; }; -void configure_cursor(struct wlr_cursor *cursor, struct wlr_input_device *device, +static void configure_cursor(struct wlr_cursor *cursor, struct wlr_input_device *device, struct sample_state *sample) { struct sample_output *output; wlr_log(WLR_ERROR, "Configuring cursor %p for device %p", cursor, device); @@ -88,7 +88,7 @@ void configure_cursor(struct wlr_cursor *cursor, struct wlr_input_device *device } } -void output_frame_notify(struct wl_listener *listener, void *data) { +static void output_frame_notify(struct wl_listener *listener, void *data) { struct sample_output *output = wl_container_of(listener, output, frame); struct sample_state *sample = output->sample; struct wlr_output *wlr_output = output->output; @@ -127,27 +127,7 @@ static void cursor_destroy(struct sample_cursor *cursor) { free(cursor); } -void input_remove_notify(struct wl_listener *listener, void *data) { - struct wlr_input_device *device = data; - struct sample_cursor *sample_cursor = wl_container_of(listener, sample_cursor, destroy); - struct sample_state *sample = sample_cursor->sample; - struct sample_cursor *cursor; - wl_list_for_each(cursor, &sample->cursors, link) { - if (cursor->device == device) { - cursor_destroy(cursor); - break; - } - } - struct sample_pointer *pointer; - wl_list_for_each(pointer, &sample->pointers, link) { - if (pointer->device == device) { - free(pointer); - break; - } - } -} - -void output_remove_notify(struct wl_listener *listener, void *data) { +static void output_remove_notify(struct wl_listener *listener, void *data) { struct sample_output *sample_output = wl_container_of(listener, sample_output, destroy); struct sample_state *sample = sample_output->sample; wl_list_remove(&sample_output->frame.link); @@ -161,7 +141,7 @@ void output_remove_notify(struct wl_listener *listener, void *data) { } } -void new_output_notify(struct wl_listener *listener, void *data) { +static void new_output_notify(struct wl_listener *listener, void *data) { struct wlr_output *output = data; struct sample_state *sample = wl_container_of(listener, sample, new_output); struct sample_output *sample_output = calloc(1, sizeof(struct sample_output)); @@ -193,7 +173,7 @@ void new_output_notify(struct wl_listener *listener, void *data) { wl_list_insert(&sample->outputs, &sample_output->link); } -void keyboard_key_notify(struct wl_listener *listener, void *data) { +static void keyboard_key_notify(struct wl_listener *listener, void *data) { struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key); struct sample_state *sample = keyboard->sample; struct wlr_event_keyboard_key *event = data; @@ -209,14 +189,14 @@ void keyboard_key_notify(struct wl_listener *listener, void *data) { } } -void keyboard_destroy_notify(struct wl_listener *listener, void *data) { +static void keyboard_destroy_notify(struct wl_listener *listener, void *data) { struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, destroy); wl_list_remove(&keyboard->destroy.link); wl_list_remove(&keyboard->key.link); free(keyboard); } -void new_input_notify(struct wl_listener *listener, void *data) { +static void new_input_notify(struct wl_listener *listener, void *data) { struct wlr_input_device *device = data; struct sample_state *sample = wl_container_of(listener, sample, new_input); switch (device->type) { diff --git a/examples/output-layout.c b/examples/output-layout.c index d18a83af..2a1cc320 100644 --- a/examples/output-layout.c +++ b/examples/output-layout.c @@ -106,7 +106,7 @@ static void animate_cat(struct sample_state *sample, sample->ts_last = ts; } -void output_frame_notify(struct wl_listener *listener, void *data) { +static void output_frame_notify(struct wl_listener *listener, void *data) { struct sample_output *output = wl_container_of(listener, output, frame); struct sample_state *sample = output->sample; struct timespec ts; @@ -145,7 +145,7 @@ static void update_velocities(struct sample_state *sample, sample->y_vel += y_diff; } -void output_remove_notify(struct wl_listener *listener, void *data) { +static void output_remove_notify(struct wl_listener *listener, void *data) { struct sample_output *sample_output = wl_container_of(listener, sample_output, destroy); struct sample_state *sample = sample_output->sample; wlr_output_layout_remove(sample->layout, sample_output->output); @@ -154,7 +154,7 @@ void output_remove_notify(struct wl_listener *listener, void *data) { free(sample_output); } -void new_output_notify(struct wl_listener *listener, void *data) { +static void new_output_notify(struct wl_listener *listener, void *data) { struct wlr_output *output = data; struct sample_state *sample = wl_container_of(listener, sample, new_output); struct sample_output *sample_output = calloc(1, sizeof(struct sample_output)); @@ -171,7 +171,7 @@ void new_output_notify(struct wl_listener *listener, void *data) { sample_output->destroy.notify = output_remove_notify; } -void keyboard_key_notify(struct wl_listener *listener, void *data) { +static void keyboard_key_notify(struct wl_listener *listener, void *data) { struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key); struct sample_state *sample = keyboard->sample; struct wlr_event_keyboard_key *event = data; @@ -207,14 +207,14 @@ void keyboard_key_notify(struct wl_listener *listener, void *data) { } } -void keyboard_destroy_notify(struct wl_listener *listener, void *data) { +static void keyboard_destroy_notify(struct wl_listener *listener, void *data) { struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, destroy); wl_list_remove(&keyboard->destroy.link); wl_list_remove(&keyboard->key.link); free(keyboard); } -void new_input_notify(struct wl_listener *listener, void *data) { +static void new_input_notify(struct wl_listener *listener, void *data) { struct wlr_input_device *device = data; struct sample_state *sample = wl_container_of(listener, sample, new_input); switch (device->type) { diff --git a/examples/pointer.c b/examples/pointer.c index 4b0e6f46..5e137a1a 100644 --- a/examples/pointer.c +++ b/examples/pointer.c @@ -90,7 +90,7 @@ static void warp_to_touch(struct sample_state *state, wlr_cursor_warp_absolute(state->cursor, dev, x, y); } -void output_frame_notify(struct wl_listener *listener, void *data) { +static void output_frame_notify(struct wl_listener *listener, void *data) { struct sample_output *sample_output = wl_container_of(listener, sample_output, frame); struct sample_state *state = sample_output->state; struct wlr_output *wlr_output = sample_output->output; @@ -221,7 +221,7 @@ static void handle_tablet_tool_axis(struct wl_listener *listener, void *data) { } } -void keyboard_key_notify(struct wl_listener *listener, void *data) { +static void keyboard_key_notify(struct wl_listener *listener, void *data) { struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key); struct sample_state *sample = keyboard->state; struct wlr_event_keyboard_key *event = data; @@ -237,7 +237,7 @@ void keyboard_key_notify(struct wl_listener *listener, void *data) { } } -void output_remove_notify(struct wl_listener *listener, void *data) { +static void output_remove_notify(struct wl_listener *listener, void *data) { struct sample_output *sample_output = wl_container_of(listener, sample_output, destroy); struct sample_state *sample = sample_output->state; wlr_output_layout_remove(sample->layout, sample_output->output); @@ -246,7 +246,7 @@ void output_remove_notify(struct wl_listener *listener, void *data) { free(sample_output); } -void new_output_notify(struct wl_listener *listener, void *data) { +static void new_output_notify(struct wl_listener *listener, void *data) { struct wlr_output *output = data; struct sample_state *sample = wl_container_of(listener, sample, new_output); struct sample_output *sample_output = calloc(1, sizeof(struct sample_output)); @@ -268,14 +268,14 @@ void new_output_notify(struct wl_listener *listener, void *data) { } -void keyboard_destroy_notify(struct wl_listener *listener, void *data) { +static void keyboard_destroy_notify(struct wl_listener *listener, void *data) { struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, destroy); wl_list_remove(&keyboard->destroy.link); wl_list_remove(&keyboard->key.link); free(keyboard); } -void new_input_notify(struct wl_listener *listener, void *data) { +static void new_input_notify(struct wl_listener *listener, void *data) { struct wlr_input_device *device = data; struct sample_state *state = wl_container_of(listener, state, new_input); switch (device->type) { diff --git a/examples/rotation.c b/examples/rotation.c index 6e10721d..3700351a 100644 --- a/examples/rotation.c +++ b/examples/rotation.c @@ -97,14 +97,14 @@ static void update_velocities(struct sample_state *sample, } } -void output_remove_notify(struct wl_listener *listener, void *data) { +static void output_remove_notify(struct wl_listener *listener, void *data) { struct sample_output *sample_output = wl_container_of(listener, sample_output, destroy); wl_list_remove(&sample_output->frame.link); wl_list_remove(&sample_output->destroy.link); free(sample_output); } -void new_output_notify(struct wl_listener *listener, void *data) { +static void new_output_notify(struct wl_listener *listener, void *data) { struct wlr_output *output = data; struct sample_state *sample = wl_container_of(listener, sample, new_output); struct sample_output *sample_output = calloc(1, sizeof(struct sample_output)); @@ -125,7 +125,7 @@ void new_output_notify(struct wl_listener *listener, void *data) { wl_list_insert(&sample->outputs, &sample_output->link); } -void keyboard_key_notify(struct wl_listener *listener, void *data) { +static void keyboard_key_notify(struct wl_listener *listener, void *data) { struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key); struct sample_state *sample = keyboard->sample; struct wlr_event_keyboard_key *event = data; @@ -157,14 +157,14 @@ void keyboard_key_notify(struct wl_listener *listener, void *data) { } } -void keyboard_destroy_notify(struct wl_listener *listener, void *data) { +static void keyboard_destroy_notify(struct wl_listener *listener, void *data) { struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, destroy); wl_list_remove(&keyboard->destroy.link); wl_list_remove(&keyboard->key.link); free(keyboard); } -void new_input_notify(struct wl_listener *listener, void *data) { +static void new_input_notify(struct wl_listener *listener, void *data) { struct wlr_input_device *device = data; struct sample_state *sample = wl_container_of(listener, sample, new_input); switch (device->type) { diff --git a/examples/simple.c b/examples/simple.c index 96f33610..bf2411c8 100644 --- a/examples/simple.c +++ b/examples/simple.c @@ -36,7 +36,7 @@ struct sample_keyboard { struct wl_listener destroy; }; -void output_frame_notify(struct wl_listener *listener, void *data) { +static void output_frame_notify(struct wl_listener *listener, void *data) { struct sample_output *sample_output = wl_container_of(listener, sample_output, frame); struct sample_state *sample = sample_output->sample; @@ -65,7 +65,7 @@ void output_frame_notify(struct wl_listener *listener, void *data) { sample->last_frame = now; } -void output_remove_notify(struct wl_listener *listener, void *data) { +static void output_remove_notify(struct wl_listener *listener, void *data) { struct sample_output *sample_output = wl_container_of(listener, sample_output, destroy); wlr_log(WLR_DEBUG, "Output removed"); @@ -74,7 +74,7 @@ void output_remove_notify(struct wl_listener *listener, void *data) { free(sample_output); } -void new_output_notify(struct wl_listener *listener, void *data) { +static void new_output_notify(struct wl_listener *listener, void *data) { struct wlr_output *output = data; struct sample_state *sample = wl_container_of(listener, sample, new_output); @@ -93,7 +93,7 @@ void new_output_notify(struct wl_listener *listener, void *data) { sample_output->destroy.notify = output_remove_notify; } -void keyboard_key_notify(struct wl_listener *listener, void *data) { +static void keyboard_key_notify(struct wl_listener *listener, void *data) { struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key); struct sample_state *sample = keyboard->sample; struct wlr_event_keyboard_key *event = data; @@ -109,7 +109,7 @@ void keyboard_key_notify(struct wl_listener *listener, void *data) { } } -void keyboard_destroy_notify(struct wl_listener *listener, void *data) { +static void keyboard_destroy_notify(struct wl_listener *listener, void *data) { struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, destroy); wl_list_remove(&keyboard->destroy.link); @@ -117,7 +117,7 @@ void keyboard_destroy_notify(struct wl_listener *listener, void *data) { free(keyboard); } -void new_input_notify(struct wl_listener *listener, void *data) { +static void new_input_notify(struct wl_listener *listener, void *data) { struct wlr_input_device *device = data; struct sample_state *sample = wl_container_of(listener, sample, new_input); switch (device->type) { diff --git a/examples/tablet.c b/examples/tablet.c index d437ff17..d33fb224 100644 --- a/examples/tablet.c +++ b/examples/tablet.c @@ -227,14 +227,14 @@ static void tablet_pad_destroy_notify(struct wl_listener *listener, void *data) free(pstate); } -void output_remove_notify(struct wl_listener *listener, void *data) { +static void output_remove_notify(struct wl_listener *listener, void *data) { struct sample_output *sample_output = wl_container_of(listener, sample_output, destroy); wl_list_remove(&sample_output->frame.link); wl_list_remove(&sample_output->destroy.link); free(sample_output); } -void new_output_notify(struct wl_listener *listener, void *data) { +static void new_output_notify(struct wl_listener *listener, void *data) { struct wlr_output *output = data; struct sample_state *sample = wl_container_of(listener, sample, new_output); struct sample_output *sample_output = calloc(1, sizeof(struct sample_output)); @@ -250,7 +250,7 @@ void new_output_notify(struct wl_listener *listener, void *data) { sample_output->destroy.notify = output_remove_notify; } -void keyboard_key_notify(struct wl_listener *listener, void *data) { +static void keyboard_key_notify(struct wl_listener *listener, void *data) { struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key); struct sample_state *sample = keyboard->sample; struct wlr_event_keyboard_key *event = data; @@ -266,14 +266,14 @@ void keyboard_key_notify(struct wl_listener *listener, void *data) { } } -void keyboard_destroy_notify(struct wl_listener *listener, void *data) { +static void keyboard_destroy_notify(struct wl_listener *listener, void *data) { struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, destroy); wl_list_remove(&keyboard->destroy.link); wl_list_remove(&keyboard->key.link); free(keyboard); } -void new_input_notify(struct wl_listener *listener, void *data) { +static void new_input_notify(struct wl_listener *listener, void *data) { struct wlr_input_device *device = data; struct sample_state *sample = wl_container_of(listener, sample, new_input); switch (device->type) { diff --git a/examples/touch.c b/examples/touch.c index c306ba69..07d44563 100644 --- a/examples/touch.c +++ b/examples/touch.c @@ -140,14 +140,14 @@ static void touch_destroy_notify(struct wl_listener *listener, void *data) { free(tstate); } -void output_remove_notify(struct wl_listener *listener, void *data) { +static void output_remove_notify(struct wl_listener *listener, void *data) { struct sample_output *sample_output = wl_container_of(listener, sample_output, destroy); wl_list_remove(&sample_output->frame.link); wl_list_remove(&sample_output->destroy.link); free(sample_output); } -void new_output_notify(struct wl_listener *listener, void *data) { +static void new_output_notify(struct wl_listener *listener, void *data) { struct wlr_output *output = data; struct sample_state *sample = wl_container_of(listener, sample, new_output); struct sample_output *sample_output = calloc(1, sizeof(struct sample_output)); @@ -163,7 +163,7 @@ void new_output_notify(struct wl_listener *listener, void *data) { sample_output->destroy.notify = output_remove_notify; } -void keyboard_key_notify(struct wl_listener *listener, void *data) { +static void keyboard_key_notify(struct wl_listener *listener, void *data) { struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, key); struct sample_state *sample = keyboard->sample; struct wlr_event_keyboard_key *event = data; @@ -179,14 +179,14 @@ void keyboard_key_notify(struct wl_listener *listener, void *data) { } } -void keyboard_destroy_notify(struct wl_listener *listener, void *data) { +static void keyboard_destroy_notify(struct wl_listener *listener, void *data) { struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, destroy); wl_list_remove(&keyboard->destroy.link); wl_list_remove(&keyboard->key.link); free(keyboard); } -void new_input_notify(struct wl_listener *listener, void *data) { +static void new_input_notify(struct wl_listener *listener, void *data) { struct wlr_input_device *device = data; struct sample_state *sample = wl_container_of(listener, sample, new_input); switch (device->type) { diff --git a/include/backend/drm/drm.h b/include/backend/drm/drm.h index 7f66f9c9..62ade510 100644 --- a/include/backend/drm/drm.h +++ b/include/backend/drm/drm.h @@ -151,4 +151,9 @@ bool set_drm_connector_gamma(struct wlr_output *output, size_t size, bool drm_connector_set_mode(struct wlr_output *output, struct wlr_output_mode *mode); +bool legacy_crtc_set_cursor(struct wlr_drm_backend *drm, + struct wlr_drm_crtc *crtc, struct gbm_bo *bo); +bool legacy_crtc_move_cursor(struct wlr_drm_backend *drm, + struct wlr_drm_crtc *crtc, int x, int y); + #endif diff --git a/meson.build b/meson.build index 7e8305b7..18528df2 100644 --- a/meson.build +++ b/meson.build @@ -34,6 +34,7 @@ add_project_arguments(cc.get_supported_arguments([ '-Wendif-labels', '-Wstrict-aliasing=2', '-Woverflow', + '-Wmissing-prototypes', '-Wno-missing-braces', '-Wno-missing-field-initializers', diff --git a/render/gles2/texture.c b/render/gles2/texture.c index 3aa1c005..9ff88b35 100644 --- a/render/gles2/texture.c +++ b/render/gles2/texture.c @@ -27,7 +27,7 @@ struct wlr_gles2_texture *gles2_get_texture( return (struct wlr_gles2_texture *)wlr_texture; } -struct wlr_gles2_texture *get_gles2_texture_in_context( +static struct wlr_gles2_texture *get_gles2_texture_in_context( struct wlr_texture *wlr_texture) { struct wlr_gles2_texture *texture = gles2_get_texture(wlr_texture); if (!wlr_egl_is_current(texture->egl)) { diff --git a/render/gles2/util.c b/render/gles2/util.c deleted file mode 100644 index 3ac777ee..00000000 --- a/render/gles2/util.c +++ /dev/null @@ -1,38 +0,0 @@ -#include -#include -#include -#include -#include "render/gles2.h" - -const char *gles2_strerror(GLenum err) { - switch (err) { - case GL_INVALID_ENUM: - return "Invalid enum"; - case GL_INVALID_VALUE: - return "Invalid value"; - case GL_INVALID_OPERATION: - return "Invalid operation"; - case GL_OUT_OF_MEMORY: - return "Out of memory"; - case GL_INVALID_FRAMEBUFFER_OPERATION: - return "Invalid framebuffer operation"; - default: - return "Unknown error"; - } -} - -bool _gles2_flush_errors(const char *file, int line) { - GLenum err; - bool failure = false; - while ((err = glGetError()) != GL_NO_ERROR) { - failure = true; - if (err == GL_OUT_OF_MEMORY) { - // The OpenGL context is now undefined - _wlr_log(WLR_ERROR, "[%s:%d] Fatal GL error: out of memory", file, line); - exit(1); - } else { - _wlr_log(WLR_ERROR, "[%s:%d] GL error %d %s", file, line, err, gles2_strerror(err)); - } - } - return failure; -} diff --git a/render/meson.build b/render/meson.build index 3f6bfdca..87577aba 100644 --- a/render/meson.build +++ b/render/meson.build @@ -17,7 +17,6 @@ lib_wlr_render = static_library( 'gles2/renderer.c', 'gles2/shaders.c', 'gles2/texture.c', - 'gles2/util.c', 'wlr_renderer.c', 'wlr_texture.c', ), diff --git a/types/data_device/wlr_drag.c b/types/data_device/wlr_drag.c index b4fe9a8a..cd8695ae 100644 --- a/types/data_device/wlr_drag.c +++ b/types/data_device/wlr_drag.c @@ -244,7 +244,7 @@ static const struct wlr_pointer_grab_interface .cancel = drag_handle_pointer_cancel, }; -uint32_t drag_handle_touch_down(struct wlr_seat_touch_grab *grab, +static uint32_t drag_handle_touch_down(struct wlr_seat_touch_grab *grab, uint32_t time, struct wlr_touch_point *point) { // eat the event return 0; diff --git a/types/wlr_foreign_toplevel_management_v1.c b/types/wlr_foreign_toplevel_management_v1.c index 6aed5eeb..6d256077 100644 --- a/types/wlr_foreign_toplevel_management_v1.c +++ b/types/wlr_foreign_toplevel_management_v1.c @@ -35,12 +35,12 @@ static void toplevel_handle_send_maximized_event(struct wl_resource *resource, wlr_signal_emit_safe(&toplevel->events.request_maximize, &event); } -void foreign_toplevel_handle_set_maximized(struct wl_client *client, +static void foreign_toplevel_handle_set_maximized(struct wl_client *client, struct wl_resource *resource) { toplevel_handle_send_maximized_event(resource, true); } -void foreign_toplevel_handle_unset_maximized(struct wl_client *client, +static void foreign_toplevel_handle_unset_maximized(struct wl_client *client, struct wl_resource *resource) { toplevel_handle_send_maximized_event(resource, false); } diff --git a/types/wlr_output_layout.c b/types/wlr_output_layout.c index 64999fec..498bdf7b 100644 --- a/types/wlr_output_layout.c +++ b/types/wlr_output_layout.c @@ -452,7 +452,7 @@ enum distance_selection_method { FARTHEST }; -struct wlr_output *wlr_output_layout_output_in_direction( +static struct wlr_output *wlr_output_layout_output_in_direction( struct wlr_output_layout *layout, enum wlr_direction direction, struct wlr_output *reference, double ref_lx, double ref_ly, enum distance_selection_method distance_method) { diff --git a/types/wlr_screencopy_v1.c b/types/wlr_screencopy_v1.c index 92caa15d..0ad93fa4 100644 --- a/types/wlr_screencopy_v1.c +++ b/types/wlr_screencopy_v1.c @@ -477,7 +477,7 @@ static const struct zwlr_screencopy_manager_v1_interface manager_impl = { .destroy = manager_handle_destroy, }; -void manager_handle_resource_destroy(struct wl_resource *resource) { +static void manager_handle_resource_destroy(struct wl_resource *resource) { struct wlr_screencopy_v1_client *client = client_from_resource(resource); client_unref(client); diff --git a/types/wlr_server_decoration.c b/types/wlr_server_decoration.c index fd92fd04..5a2d2ef5 100644 --- a/types/wlr_server_decoration.c +++ b/types/wlr_server_decoration.c @@ -138,7 +138,8 @@ void wlr_server_decoration_manager_set_default_mode( } } -void server_decoration_manager_destroy_resource(struct wl_resource *resource) { +static void server_decoration_manager_destroy_resource( + struct wl_resource *resource) { wl_list_remove(wl_resource_get_link(resource)); } diff --git a/types/wlr_xdg_decoration_v1.c b/types/wlr_xdg_decoration_v1.c index 607b75e4..4b5fa61c 100644 --- a/types/wlr_xdg_decoration_v1.c +++ b/types/wlr_xdg_decoration_v1.c @@ -238,7 +238,8 @@ static const struct zxdg_decoration_manager_v1_interface .get_toplevel_decoration = decoration_manager_handle_get_toplevel_decoration, }; -void decoration_manager_handle_resource_destroy(struct wl_resource *resource) { +static void decoration_manager_handle_resource_destroy( + struct wl_resource *resource) { wl_list_remove(wl_resource_get_link(resource)); }