Discussion:
[PATCH 2/2] openssl: Fix unused variable compiler warning on fedora 17
Ben Greear via curl-library
2018-11-28 17:20:45 UTC
Permalink
From: Ben Greear <***@candelatech.com>

ctx_options was not used, so the compiler warned. Add
a (void)(ctx_options) line to make the compiler happy.

Hopefully that is the right fix...

Signed-off-by: Ben Greear <***@candelatech.com>
---
lib/vtls/openssl.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c
index 720e87d..a3041b4 100644
--- a/lib/vtls/openssl.c
+++ b/lib/vtls/openssl.c
@@ -2167,6 +2167,7 @@ set_ssl_version_min_max(long *ctx_options, struct connectdata *conn,
}
#else
(void)sockindex;
+ (void)ctx_options;
failf(data, OSSL_PACKAGE " was built without TLS 1.3 support");
return CURLE_NOT_BUILT_IN;
#endif
--
2.7.5

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquett
Daniel Stenberg via curl-library
2018-11-30 23:01:17 UTC
Permalink
i = part;
- for(o = enc; *i; ++o, ++i)
- *o = (*i == ' ') ? '+' : *i;
+ for(o = enc; *i; ++o, ++i) {
+ if (*i == ' ')
+ *o = '+';
+ else
+ *o = *i;
+ }
This is a broken compiler that warns about this. I really prefer the existing
one-line version to this 4-line replacement.
--
/ daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiq
Ben Greear via curl-library
2018-11-30 23:08:36 UTC
Permalink
i = part;
- for(o = enc; *i; ++o, ++i)
- *o = (*i == ' ') ? '+' : *i;
+ for(o = enc; *i; ++o, ++i) {
+ if (*i == ' ')
+ *o = '+';
+ else
+ *o = *i;
+ }
This is a broken compiler that warns about this. I really prefer the existing one-line version to this 4-line replacement.
Well yes, it would be great if the compiler wasn't broken, but still nice to
allow curl to compile (with -Werror) on weird/broken-ish compilers.

I think a few lines of extra code is a small price to pay.

Thanks,
Ben
--
Ben Greear <***@candelatech.com>
Candela Technologies Inc http://www.candelatech.com

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.s
Ben Greear via curl-library
2018-12-09 20:05:14 UTC
Permalink
This is a broken compiler that warns about this. I really prefer the existing one-line version to this 4-line replacement.
Well yes, it would be great if the compiler wasn't broken, but still nice to allow curl to compile (with -Werror) on weird/broken-ish compilers.
I think a few lines of extra code is a small price to pay.
Everything's a ballance of course. What's the price/benefit trade-off?
We would gain an ancient compiler to build warning-free at the price of slightly less readable code (which of course is debatable and we could argue how much of a problem it would be, but I also don't want to open the flood gates for fixing warnings when it is so obviously wrong in the compiler).
In this case, it seems mostly one or two persons will gain from fixing the build for the ancient compiler (that even could be updated) while more than one or two persons will potentially risk something by needlessly complicating the code.
So my stance on this patch is still: thanks, but no thanks.
Ok, thanks for considering it.

Ben
--
Ben Greear <***@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiqu
Daniel Stenberg via curl-library
2018-11-30 23:04:59 UTC
Permalink
ctx_options was not used, so the compiler warned. Add a (void)(ctx_options)
line to make the compiler happy.
What OpenSSL version do you have installed to get this warning? Maybe it
should rather disable set_ssl_version_min_max() completely?
--
/ daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.htm
Ben Greear via curl-library
2018-11-30 23:10:08 UTC
Permalink
ctx_options was not used, so the compiler warned. Add a (void)(ctx_options) line to make the compiler happy.
What OpenSSL version do you have installed to get this warning? Maybe it should rather disable set_ssl_version_min_max() completely?
rpm -qa | grep openssl
...
openssl-1.0.0k-1.fc17.i686
openssl-devel-1.0.0k-1.fc17.i686

Before I rebased, it compiled OK, so I guess there was some change in that
code to cause the warning. I do not know enough about what it is trying to do
to be certain of the proper fix.

Thanks,
Ben
--
Ben Greear <***@candelatech.com>
Candela Technologies Inc http://www.candelatech.com

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/
Daniel Stenberg via curl-library
2018-12-07 10:39:28 UTC
Permalink
Post by Ben Greear via curl-library
Before I rebased, it compiled OK, so I guess there was some change in that
code to cause the warning. I do not know enough about what it is trying to
do to be certain of the proper fix.
I've pushed it here: https://github.com/curl/curl/pull/3347
--
/ daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etique
Loading...