Skip to content

PS-10045: fix compiler warnings in kmipcore/kmipclient and tighten ma…#31

Open
lukin-oleksiy wants to merge 1 commit into
Percona-Lab:masterfrom
lukin-oleksiy:PS-10045-fix_all_warnings
Open

PS-10045: fix compiler warnings in kmipcore/kmipclient and tighten ma…#31
lukin-oleksiy wants to merge 1 commit into
Percona-Lab:masterfrom
lukin-oleksiy:PS-10045-fix_all_warnings

Conversation

@lukin-oleksiy
Copy link
Copy Markdown
Contributor

Fix compiler warnings in kmipcore/kmipclient and tighten maintainer warning mode

https://perconadev.atlassian.net/browse/PS-10045

  • add/cleanup maintainer warning profiles in kmipcore and kmipclient CMake (target-scoped flags, optional WARNINGS_AS_ERRORS)
  • fix warning diagnostics across sources:
    • remove unused variables in kmipcore tests and kmippp
    • fix conversion/sign-conversion and cast-qual warnings
    • fix shadowed names and extra semicolons
    • fix struct/class forward-declaration mismatch
    • initialize missing designated fields in tests/examples
  • improve OpenSSL compatibility handling in NetClientOpenSSL (version-aware certificate getter and method selection)
  • add threads linkage in kmipclient CMake for platforms requiring explicit pthread
  • silence known third-party clang warning in googletest target setup

Result: clean warning output in maintainer-mode builds for local project code.

…intainer warning mode

https://perconadev.atlassian.net/browse/PS-10045

- add/cleanup maintainer warning profiles in kmipcore and kmipclient CMake
  (target-scoped flags, optional WARNINGS_AS_ERRORS)
- fix warning diagnostics across sources:
  - remove unused variables in kmipcore tests and kmippp
  - fix conversion/sign-conversion and cast-qual warnings
  - fix shadowed names and extra semicolons
  - fix struct/class forward-declaration mismatch
  - initialize missing designated fields in tests/examples
- improve OpenSSL compatibility handling in NetClientOpenSSL
  (version-aware certificate getter and method selection)
- add threads linkage in kmipclient CMake for platforms requiring explicit pthread
- silence known third-party clang warning in googletest target setup

Result: clean warning output in maintainer-mode builds for local project code.
#define KMIPCLIENT_VERSION_MINOR 2
/** @brief kmipclient semantic version patch component. */
#define KMIPCLIENT_VERSION_PATCH 1
#define KMIPCLIENT_VERSION_PATCH 3
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the jump from 1 to 3? skipping 2


KmipClient::KmipClient(
NetClient &net_client,
NetClient &transport,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be just name change? was there a conflict with the variable name? net_client used elsewehre?

SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY);
BIO_set_conn_hostname(new_bio.get(), m_host.c_str());
BIO_set_conn_port(new_bio.get(), m_port.c_str());
BIO_set_conn_hostname(new_bio.get(), m_host.data());
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does it know to use how many bytes without explicit length being passed?

Comment on lines -270 to 273
assert(first_id == 1);
assert(second_id == 2);
assert(first_id != second_id);
req.add_batch_item(item2);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where are these assertions now?

bool threw = false;
try {
(void) ResponseMessage::fromElement(response_message);
assert(false);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we place a dummy assert() block all over? in try blocks?

Comment thread kmipcore/CMakeLists.txt
Comment on lines +24 to +63
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(
${target_name}
PRIVATE
-Weverything
-Wno-c++98-compat
-Wno-c++98-compat-pedantic
-Wno-pre-c++20-compat
-Wno-c++20-compat
-Wno-padded
-Wno-switch-enum
-Wno-unsafe-buffer-usage
-Wno-covered-switch-default
-Wno-documentation
-Wno-exit-time-destructors
-Wno-global-constructors
-Wno-missing-prototypes
-Wno-newline-eof
-Wno-nrvo
-Wno-weak-vtables
)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(
${target_name}
PRIVATE
-Wall
-Wextra
-Wpedantic
-Wcast-qual
-Wconversion
-Wdouble-promotion
-Wformat=2
-Wnull-dereference
-Woverloaded-virtual
-Wshadow
-Wsign-conversion
-Wundef
-Wuseless-cast
)
endif()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WHy do we need these special blocks? I dont see such things in PS code or anywhere?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants