Skip to content

Commit

Permalink
CMake: fail on warnings (#1503)
Browse files Browse the repository at this point in the history
When building with `CMake` (especially the targets `valkey-cli`,
`valkey-server` and `valkey-benchmark`) it is possible to have a
successful build while having warnings.

This PR fixes this - which is aligned with how the `Makefile` is working
today:
- Enable `-Wall` + `-Werror` for valkey targets
- Fixed warning in valkey-cli:jsonStringOutput method

Signed-off-by: Eran Ifrah <[email protected]>
  • Loading branch information
eifrah-aws authored Jan 3, 2025
1 parent fe72c78 commit b3b4bdc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmake/Modules/ValkeySetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ macro (valkey_build_and_install_bin target sources ld_flags libs link_name)
target_link_libraries(${target} execinfo)
endif ()

# Enable all warnings + fail on warning
target_compile_options(${target} PRIVATE -Werror -Wall)

# Install cli tool and create a redis symbolic link
valkey_install_bin(${target})
valkey_create_symlink(${target} ${link_name})
Expand Down
2 changes: 2 additions & 0 deletions src/valkey-cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -2040,6 +2040,8 @@ static sds jsonStringOutput(sds out, const char *p, int len, int mode) {
} else {
assert(0);
}
/* Silence compiler warning */
return NULL;
}

static sds cliFormatReplyJson(sds out, redisReply *r, int mode) {
Expand Down

0 comments on commit b3b4bdc

Please sign in to comment.