Skip to content

Commit

Permalink
Enable some more compiler warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Tristan Partin <[email protected]>
  • Loading branch information
tristan957 committed Oct 22, 2023
1 parent be19d6a commit 2cb4c58
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
18 changes: 17 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,24 @@ add_project_arguments(
add_project_arguments(
cc.get_supported_arguments(
'-D_POSIX_C_SOURCE=200112L',
'-Wconversion',
'-Wdeclaration-after-statement',
'-Wconversion'
'-Wdouble-promotion',
'-Wduplicated-branches',
'-Wduplicated-cond',
'-Wendif-labels',
'-Wformat=2',
'-Wformat-overflow=2',
'-Wformat-signedness',
'-Wformat-truncation=1',
'-Winit-self',
'-Wlogical-op',
'-Wmissing-prototypes',
'-Wnull-dereference',
'-Wno-return-local-addr',
'-Wshadow',
'-Wuninitialized',
'-Wvla',
),
language: 'c'
)
Expand Down
6 changes: 3 additions & 3 deletions tests/merr-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ test_merr_long_path(void)
g_assert_cmpint(err, !=, 0);

expected_sz = (size_t)snprintf(
expected, sizeof(expected), "%*s:%d: %s (%d)", MERR_MAX_PATH_LENGTH, merr_file(err),
expected, sizeof(expected), "%*s:%d: %s (%d)", (int)MERR_MAX_PATH_LENGTH, merr_file(err),
merr_lineno(err), strerror(merr_errno(err)), merr_errno(err));
found_sz = merr_strerrorx(err, found, sizeof(found), ctx_stringify);
g_assert_cmpuint(found_sz, ==, expected_sz);
Expand Down Expand Up @@ -100,11 +100,11 @@ test_merr_with_context(void)
err = merrx(ENOENT, 2); line = __LINE__;
#ifndef MERR_PLAIN
expected_sz = (size_t)snprintf(
expected, sizeof(expected), "%s:%d: %s (%d): %s (%u)", file, merr_lineno(err),
expected, sizeof(expected), "%s:%d: %s (%d): %s (%d)", file, merr_lineno(err),
strerror(merr_errno(err)), merr_errno(err), ctx_stringify(merr_ctx(err)), merr_ctx(err));
#else
expected_sz = (size_t)snprintf(
expected, sizeof(expected), "%s (%d): %s (%u)",
expected, sizeof(expected), "%s (%d): %s (%d)",
strerror(merr_errno(err)), merr_errno(err), ctx_stringify(merr_ctx(err)), merr_ctx(err));
#endif

Expand Down

0 comments on commit 2cb4c58

Please sign in to comment.