meson: enable more compiler warnings

This commit is contained in:
emersion 2019-02-28 23:15:34 +01:00
parent 4135fafecd
commit 5445d8aad0
7 changed files with 34 additions and 21 deletions

View file

@ -440,7 +440,7 @@ static bool add_signal_matches(struct logind_session *session) {
int ret; int ret;
char str[256]; char str[256];
const char *fmt = "type='signal'," const char fmt[] = "type='signal',"
"sender='org.freedesktop.login1'," "sender='org.freedesktop.login1',"
"interface='org.freedesktop.login1.%s'," "interface='org.freedesktop.login1.%s',"
"member='%s'," "member='%s',"

View file

@ -194,7 +194,7 @@ static void keyboard_handle_keymap(void *data, struct wl_keyboard *wl_keyboard,
// TODO: set keymap // TODO: set keymap
} }
static uint32_t get_current_time_msec() { static uint32_t get_current_time_msec(void) {
struct timespec now; struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now); clock_gettime(CLOCK_MONOTONIC, &now);
return now.tv_nsec / 1000; return now.tv_nsec / 1000;

View file

@ -176,7 +176,7 @@ static void timer_arm(unsigned seconds) {
} }
} }
static void do_updates() { static void do_updates(void) {
printf("Update %d\n", update_stage); printf("Update %d\n", update_stage);
switch (update_stage) { switch (update_stage) {
case 0: case 0:
@ -240,7 +240,7 @@ static void do_updates() {
}; };
} }
static void handle_timer() { static void handle_timer(void) {
printf("Timer dispatched at %d\n", update_stage); printf("Timer dispatched at %d\n", update_stage);
do_updates(); do_updates();
} }

View file

@ -102,7 +102,7 @@ static size_t utf8_offset(char *utf8_str, size_t byte_offset) {
} }
// TODO: would be nicer to have this text display inside the window // TODO: would be nicer to have this text display inside the window
static void show_status() { static void show_status(void) {
printf("State %d:", serial); printf("State %d:", serial);
if (!enabled) { if (!enabled) {
printf(" disabled"); printf(" disabled");

View file

@ -16,16 +16,31 @@ project(
# for a reference about clean library versioning. # for a reference about clean library versioning.
so_version = ['1', '2', '0'] so_version = ['1', '2', '0']
add_project_arguments( add_project_arguments([
[ '-DWLR_SRC_DIR="@0@"'.format(meson.current_source_dir()),
'-DWLR_SRC_DIR="@0@"'.format(meson.current_source_dir()), '-DWLR_USE_UNSTABLE',
'-DWLR_USE_UNSTABLE', ], language: 'c')
'-Wno-unused-parameter', cc = meson.get_compiler('c')
'-Wundef',
], add_project_arguments(cc.get_supported_arguments([
language: 'c', '-Wundef',
) '-Wlogical-op',
'-Wmissing-include-dirs',
'-Wold-style-definition',
'-Wpointer-arith',
'-Winit-self',
'-Wstrict-prototypes',
'-Wredundant-decls',
'-Wimplicit-fallthrough=2',
'-Wendif-labels',
'-Wstrict-aliasing=2',
'-Woverflow',
'-Wno-missing-braces',
'-Wno-missing-field-initializers',
'-Wno-unused-parameter',
]), language: 'c')
conf_data = configuration_data() conf_data = configuration_data()
conf_data.set10('WLR_HAS_LIBCAP', false) conf_data.set10('WLR_HAS_LIBCAP', false)
@ -38,8 +53,6 @@ conf_data.set10('WLR_HAS_XCB_ICCCM', false)
wlr_inc = include_directories('.', 'include') wlr_inc = include_directories('.', 'include')
cc = meson.get_compiler('c')
# Clang complains about some zeroed initializer lists (= {0}), even though they # Clang complains about some zeroed initializer lists (= {0}), even though they
# are valid # are valid
if cc.get_id() == 'clang' if cc.get_id() == 'clang'

View file

@ -312,7 +312,7 @@ static bool gles2_read_pixels(struct wlr_renderer *wlr_renderer,
glGetError(); // Clear the error flag glGetError(); // Clear the error flag
unsigned char *p = data + dst_y * stride; unsigned char *p = (unsigned char *)data + dst_y * stride;
uint32_t pack_stride = width * fmt->bpp / 8; uint32_t pack_stride = width * fmt->bpp / 8;
if (pack_stride == stride && dst_x == 0 && flags != NULL) { if (pack_stride == stride && dst_x == 0 && flags != NULL) {
// Under these particular conditions, we can read the pixels with only // Under these particular conditions, we can read the pixels with only

View file

@ -14,11 +14,11 @@
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "sockets.h" #include "sockets.h"
static const char *lock_fmt = "/tmp/.X%d-lock"; static const char lock_fmt[] = "/tmp/.X%d-lock";
static const char *socket_dir = "/tmp/.X11-unix"; static const char socket_dir[] = "/tmp/.X11-unix";
static const char *socket_fmt = "/tmp/.X11-unix/X%d"; static const char socket_fmt[] = "/tmp/.X11-unix/X%d";
#ifndef __linux__ #ifndef __linux__
static const char *socket_fmt2 = "/tmp/.X11-unix/X%d_"; static const char socket_fmt2[] = "/tmp/.X11-unix/X%d_";
#endif #endif
bool set_cloexec(int fd, bool cloexec) { bool set_cloexec(int fd, bool cloexec) {