diff options
author | Daniel Bevenius <daniel.bevenius@gmail.com> | 2017-06-13 20:42:21 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-06-21 22:43:06 +0200 |
commit | 5b3e5fac38014b88ceeb672572c46dbaf40e36cc (patch) | |
tree | 901cc1e49ebf9d09f21d7b90417ed3d4ee8dee61 | |
parent | c27ffadf8e297a6c085a491ad34124979bc4f04d (diff) | |
download | node-new-5b3e5fac38014b88ceeb672572c46dbaf40e36cc.tar.gz |
src: remove void casts for clear_error_on_return
There are a number of void casts of clear_error_on_return which is a
usage of the RAII idiom. The ClearErrorOnReturn struct only has a
destructor and no constructor which I believe was an issue in GCC
prior to version 4.8.0, which lead to a unused variable warning.
I'm wondering if these cast could be removed since GCC 4.8.5 or newer
is required now. An alternative solution would be to add an empty
constructor which should work allowing the compiler to detect that a
variable is used only for its side-effects.
Not sure if this was the sole reason for having these casts but wanted
to bring it up just in case.
Refs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10416
PR-URL: https://github.com/nodejs/node/pull/13669
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
-rw-r--r-- | src/node_crypto.cc | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 579ba3c65d..9d196c10cc 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -768,7 +768,6 @@ void SecureContext::AddCACert(const FunctionCallbackInfo<Value>& args) { SecureContext* sc; ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); ClearErrorOnReturn clear_error_on_return; - (void) &clear_error_on_return; // Silence compiler warning. if (args.Length() != 1) { return env->ThrowTypeError("CA certificate argument is mandatory"); @@ -806,7 +805,6 @@ void SecureContext::AddCRL(const FunctionCallbackInfo<Value>& args) { } ClearErrorOnReturn clear_error_on_return; - (void) &clear_error_on_return; // Silence compiler warning. BIO *bio = LoadBIO(env, args[0]); if (!bio) @@ -872,7 +870,6 @@ void SecureContext::AddRootCerts(const FunctionCallbackInfo<Value>& args) { SecureContext* sc; ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); ClearErrorOnReturn clear_error_on_return; - (void) &clear_error_on_return; // Silence compiler warning. if (!root_cert_store) { root_cert_store = NewRootCertStore(); @@ -901,7 +898,6 @@ void SecureContext::SetCiphers(const FunctionCallbackInfo<Value>& args) { ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); Environment* env = sc->env(); ClearErrorOnReturn clear_error_on_return; - (void) &clear_error_on_return; // Silence compiler warning. if (args.Length() != 1) { return env->ThrowTypeError("Ciphers argument is mandatory"); @@ -948,7 +944,6 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo<Value>& args) { ASSIGN_OR_RETURN_UNWRAP(&sc, args.This()); Environment* env = sc->env(); ClearErrorOnReturn clear_error_on_return; - (void) &clear_error_on_return; // Silence compiler warning. // Auto DH is not supported in openssl 1.0.1, so dhparam needs // to be specified explicitly @@ -1073,7 +1068,6 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) { SecureContext* sc; ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); ClearErrorOnReturn clear_error_on_return; - (void) &clear_error_on_return; // Silence compiler warning. if (args.Length() < 1) { return env->ThrowTypeError("PFX certificate argument is mandatory"); @@ -1697,7 +1691,6 @@ void SSLWrap<Base>::GetPeerCertificate( Environment* env = w->ssl_env(); ClearErrorOnReturn clear_error_on_return; - (void) &clear_error_on_return; // Silence unused variable warning. Local<Object> result; Local<Object> info; @@ -1894,7 +1887,6 @@ void SSLWrap<Base>::Renegotiate(const FunctionCallbackInfo<Value>& args) { ASSIGN_OR_RETURN_UNWRAP(&w, args.Holder()); ClearErrorOnReturn clear_error_on_return; - (void) &clear_error_on_return; // Silence unused variable warning. bool yes = SSL_renegotiate(w->ssl_) == 1; args.GetReturnValue().Set(yes); @@ -2644,7 +2636,6 @@ int Connection::HandleSSLError(const char* func, ZeroStatus zs, SyscallStatus ss) { ClearErrorOnReturn clear_error_on_return; - (void) &clear_error_on_return; // Silence unused variable warning. if (rv > 0) return rv; @@ -4259,7 +4250,6 @@ void Sign::SignFinal(const FunctionCallbackInfo<Value>& args) { md_value = new unsigned char[md_len]; ClearErrorOnReturn clear_error_on_return; - (void) &clear_error_on_return; // Silence compiler warning. Error err = sign->SignFinal( buf, @@ -4382,7 +4372,6 @@ SignBase::Error Verify::VerifyFinal(const char* key_pem, return kSignNotInitialised; ClearErrorOnReturn clear_error_on_return; - (void) &clear_error_on_return; // Silence compiler warning. EVP_PKEY* pkey = nullptr; BIO* bp = nullptr; @@ -4614,7 +4603,6 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) { size_t out_len = 0; ClearErrorOnReturn clear_error_on_return; - (void) &clear_error_on_return; // Silence compiler warning. bool r = Cipher<operation, EVP_PKEY_cipher_init, EVP_PKEY_cipher>( kbuf, @@ -4922,7 +4910,6 @@ void DiffieHellman::ComputeSecret(const FunctionCallbackInfo<Value>& args) { } ClearErrorOnReturn clear_error_on_return; - (void) &clear_error_on_return; // Silence compiler warning. BIGNUM* key = nullptr; if (args.Length() == 0) { @@ -6165,7 +6152,6 @@ void SetEngine(const FunctionCallbackInfo<Value>& args) { unsigned int flags = args[1]->Uint32Value(); ClearErrorOnReturn clear_error_on_return; - (void) &clear_error_on_return; // Silence compiler warning. const node::Utf8Value engine_id(env->isolate(), args[0]); ENGINE* engine = ENGINE_by_id(*engine_id); |