This is an automated email from the ASF dual-hosted git repository.
alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/master by this push:
new 9c242ea36 [util] clean up on SCOPED_OPENSSL_NO_PENDING_ERRORS
9c242ea36 is described below
commit 9c242ea367804fac41fc71839fcecb53911314ba
Author: Alexey Serbin <[email protected]>
AuthorDate: Tue Jul 8 15:01:58 2025 -0700
[util] clean up on SCOPED_OPENSSL_NO_PENDING_ERRORS
Add 'const' for ScopedCheckNoPendingSSLErrors instances in the
SCOPED_OPENSSL_NO_PENDING_ERRORS macro and instantiate those only
if DCHECK_IS_ON() since the corresponding constraints are enforced
with the DCHECK_EQ() macro.
The motivation for this change was seeing warnings in QtCreator IDE
on improving const-correctness for ScopedCheckNoPendingSSLErrors
instances as part of the SCOPED_OPENSSL_NO_PENDING_ERRORS macro.
This changelist doesn't contains any functional modifications.
Change-Id: I94a9b6d34b36567b414599fdd10db64c932074d4
Reviewed-on: http://gerrit.cloudera.org:8080/23148
Reviewed-by: KeDeng <[email protected]>
Tested-by: KeDeng <[email protected]>
---
src/kudu/util/openssl_util.h | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/kudu/util/openssl_util.h b/src/kudu/util/openssl_util.h
index 1b186f23e..d9b4f1d7e 100644
--- a/src/kudu/util/openssl_util.h
+++ b/src/kudu/util/openssl_util.h
@@ -83,8 +83,13 @@ typedef struct x509_st X509;
// SCOPED_OPENSSL_NO_PENDING_ERRORS;
// ... use OpenSSL APIs ...
// }
-#define SCOPED_OPENSSL_NO_PENDING_ERRORS \
- kudu::security::internal::ScopedCheckNoPendingSSLErrors
_no_ssl_errors(__PRETTY_FUNCTION__)
+#if DCHECK_IS_ON()
+ #define SCOPED_OPENSSL_NO_PENDING_ERRORS \
+ const kudu::security::internal::ScopedCheckNoPendingSSLErrors \
+ _no_ssl_errors(__PRETTY_FUNCTION__)
+#else // #if DCHECK_IS_ON() ...
+ #define SCOPED_OPENSSL_NO_PENDING_ERRORS (void)0
+#endif // #if DCHECK_IS_ON() ... #else ...
namespace kudu {
namespace security {
@@ -223,7 +228,7 @@ namespace internal {
// Implementation of SCOPED_OPENSSL_NO_PENDING_ERRORS. Use the macro form
// instead of directly instantiating the implementation class.
-struct ScopedCheckNoPendingSSLErrors {
+struct ScopedCheckNoPendingSSLErrors final {
public:
explicit ScopedCheckNoPendingSSLErrors(const char* func)
: func_(func) {