[ovs-dev] [shadow 8/8] Add -Wshadow for compilers that support it.

Justin Pettit jpettit at ovn.org
Wed Feb 28 23:04:13 UTC 2018



> On Feb 28, 2018, at 1:23 PM, Ben Pfaff <blp at ovn.org> wrote:
> 
> On Wed, Feb 28, 2018 at 12:01:03AM -0800, Justin Pettit wrote:
>> Signed-off-by: Justin Pettit <jpettit at ovn.org>
> 
> I get one additional error when this is applied:
> 
> ../lib/stream-ssl.c:1250:15: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
> ../lib/stream-ssl.c:163:31: note: previous declaration is here

Whoops.  I hadn't compiled with openssl.  I fixed it with the incremental at the end of the message.

> After that's fixed then I can ack this:
> Acked-by: Ben Pfaff <blp at ovn.org>

Thanks for the quick reviews.  I pushed this to master.

--Justin


-=-=-=-=-=-=-=-

diff --git a/lib/stream-ssl.c b/lib/stream-ssl.c
index 278468083165..ebb6f3a6c8bb 100644
--- a/lib/stream-ssl.c
+++ b/lib/stream-ssl.c
@@ -1247,12 +1247,12 @@ read_cert_file(const char *file_name, X509 ***certs, size_t *n_certs)
     }
 
     for (;;) {
-        X509 *certificate;
+        X509 *cert;
         int c;
 
         /* Read certificate from file. */
-        certificate = PEM_read_X509(file, NULL, NULL, NULL);
-        if (!certificate) {
+        cert = PEM_read_X509(file, NULL, NULL, NULL);
+        if (!cert) {
             size_t i;
 
             VLOG_ERR("PEM_read_X509 failed reading %s: %s",
@@ -1271,7 +1271,7 @@ read_cert_file(const char *file_name, X509 ***certs, size_t *n_certs)
         if (*n_certs >= allocated_certs) {
             *certs = x2nrealloc(*certs, &allocated_certs, sizeof **certs);
         }
-        (*certs)[(*n_certs)++] = certificate;
+        (*certs)[(*n_certs)++] = cert;
 
         /* Are there additional certificates in the file? */
         do {




More information about the dev mailing list