Skip to content
Snippets Groups Projects
Commit 61bfd3d4 authored by Simon McVittie's avatar Simon McVittie
Browse files

Add and fix some compiler warnings

parent bbd392d5
No related branches found
No related tags found
No related merge requests found
...@@ -38,6 +38,74 @@ if version == 'auto' ...@@ -38,6 +38,74 @@ if version == 'auto'
version = git_version_gen.stdout().strip() version = git_version_gen.stdout().strip()
endif endif
warning_cflags = [
'-Wall',
'-Wextra',
'-Warray-bounds',
'-Wcast-align',
'-Wdeclaration-after-statement',
'-Wdouble-promotion',
'-Wduplicated-branches',
'-Wduplicated-cond',
'-Wformat-nonliteral',
'-Wformat-security',
'-Wformat=2',
'-Wimplicit-function-declaration',
'-Winit-self',
'-Winline',
'-Wjump-misses-init',
'-Wlogical-op',
'-Wmissing-declarations',
'-Wmissing-format-attribute',
'-Wmissing-include-dirs',
'-Wmissing-noreturn',
'-Wmissing-prototypes',
'-Wnested-externs',
'-Wnull-dereference',
'-Wold-style-definition',
'-Wpacked',
'-Wpointer-arith',
'-Wredundant-decls',
'-Wrestrict',
'-Wreturn-type',
'-Wshadow',
'-Wstrict-aliasing',
'-Wstrict-prototypes',
'-Wswitch-default',
'-Wswitch-enum',
'-Wundef',
'-Wunused-but-set-variable',
'-Wwrite-strings',
]
no_warning_cflags = [
'declaration-after-statement',
'missing-field-initializers',
'sign-compare',
'unused-parameter',
]
# This trips some warnings in the libglnx subproject but not in
# pressure-vessel itself
project_warning_cflags = [
'-Wsign-compare',
]
c_compiler = meson.get_compiler('c')
supported_warning_cflags = c_compiler.get_supported_arguments(warning_cflags)
add_global_arguments(supported_warning_cflags, language : 'c')
foreach flag : no_warning_cflags
supported_no_warning_cflags = c_compiler.get_supported_arguments([
'-Wno-error=' + flag,
'-Wno-' + flag,
])
add_global_arguments(supported_no_warning_cflags, language : 'c')
endforeach
supported_warning_cflags = c_compiler.get_supported_arguments(project_warning_cflags)
add_project_arguments(supported_warning_cflags, language : 'c')
scripts = [ scripts = [
'pressure-vessel-wrap.sh', 'pressure-vessel-wrap.sh',
'pressure-vessel-test-ui', 'pressure-vessel-test-ui',
......
...@@ -364,7 +364,7 @@ write_xauth (char *number, FILE *output) ...@@ -364,7 +364,7 @@ write_xauth (char *number, FILE *output)
local_xa = *xa; local_xa = *xa;
if (local_xa.number) if (local_xa.number)
{ {
local_xa.number = "99"; local_xa.number = (char *) "99";
local_xa.number_length = 2; local_xa.number_length = 2;
} }
...@@ -684,7 +684,6 @@ flatpak_run_add_session_dbus_args (FlatpakBwrap *app_bwrap) ...@@ -684,7 +684,6 @@ flatpak_run_add_session_dbus_args (FlatpakBwrap *app_bwrap)
} }
else else
{ {
g_autofree char *user_runtime_dir = flatpak_get_real_xdg_runtime_dir ();
struct stat statbuf; struct stat statbuf;
dbus_session_socket = g_build_filename (user_runtime_dir, "bus", NULL); dbus_session_socket = g_build_filename (user_runtime_dir, "bus", NULL);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment