icinga2
icinga2 copied to clipboard
Fix compiler warnings
@julianbrost Would you prefer me finish this or have this merged "ASAP" not to have it laying around for too long?
Btw. any idea what's the matter with the unused OpenSSL functions?
TODO
- [x] Have a look at Windows
@julianbrost Would you prefer me finish this or have this merged "ASAP" not to have it laying around for too long?
What are the thing you would or wouldn't do in each case?
But I'd rather keep this PR at a reviewable size rather than growing it to some monster nobody got time for to review.
Btw. any idea what's the matter with the unused OpenSSL functions?
Which ones do you mean?
@julianbrost Would you prefer me finish this or have this merged "ASAP" not to have it laying around for too long?
What are the thing you would or wouldn't do in each case?
But I'd rather keep this PR at a reviewable size rather than growing it to some monster nobody got time for to review.
I'm done anyway with not Windows-specific stuff.
Btw. any idea what's the matter with the unused OpenSSL functions?
Which ones do you mean?
lib/base/tlsutility.cpp:33:13: warning: unused function 'OpenSSLLockingCallback' [-Wunused-function]
lib/base/tlsutility.cpp:41:22: warning: unused function 'OpenSSLIDCallback' [-Wunused-function]
Btw. any idea what's the matter with the unused OpenSSL functions?
Which ones do you mean?
lib/base/tlsutility.cpp:33:13: warning: unused function 'OpenSSLLockingCallback' [-Wunused-function] lib/base/tlsutility.cpp:41:22: warning: unused function 'OpenSSLIDCallback' [-Wunused-function]
They are used with some functions up-to-date OpenSSL versions no longer use. So figure out if it's still used in any OpenSSL version we have to support and if so, put it in #ifdef
, otherwise remove it.
Oh, that's the point! They are inside #ifdef
s... but reported as unused?!
They are inside #ifdef CRYPTO_LOCK
, not some version check. So probably some "do it if that version of OpenSSL already supports it", now it's no longer used and some defines were left there so that they don't actively break code.
To me they seem to be still used. (Just search for them via Ctrl+F in the same file.) And the usages are in identical ifdefs.
Used with this macro that expands to nothing (i.e. no use of the function):
# define CRYPTO_set_locking_callback(func)
Which is inside:
# if OPENSSL_API_COMPAT < 0x10100000L
So looks like that function was deprecated with 1.1.0, and I think CentOS 7 still uses an older version (:
Cool. /s
Actually this PR has never been about compiler warnings cleanup by itself. I as a dev just don’t want to get spammed with them as that hides everything else. I consider the current amount of warnings just fine. Apropos! Do you remember my TODO list? Its only point is checkboxed because I actually took a look at Windows (compiler warnings). Not more and not less. I decided not to care (for now), primarily to get this done. So no reason to overengineer anything.
Or to say it with your wording:
But I'd rather keep this PR at a reviewable size rather than growing it to some monster nobody got time for to review.
By the way. Depending on the bison/flex version one can get these warnings:
build/tools/mkclass/class_lexer.cc:2090:58: warning: unused parameter 'yyscanner' [-Wunused-parameter]
static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
^
build/tools/mkclass/class_lexer.cc:2434:43: warning: unused parameter 'yyscanner' [-Wunused-parameter]
void *yyalloc (yy_size_t size , yyscan_t yyscanner)
^
build/tools/mkclass/class_lexer.cc:2439:58: warning: unused parameter 'yyscanner' [-Wunused-parameter]
void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
^
build/tools/mkclass/class_lexer.cc:2451:36: warning: unused parameter 'yyscanner' [-Wunused-parameter]
void yyfree (void * ptr , yyscan_t yyscanner)
@yhabteab You as a Mac user can fix these easily:
- brew install bison
- brew install flex
- cmake: add -DBISON_EXECUTABLE=/usr/local/Cellar/bison/3.8.2/bin/bison -DFLEX_EXECUTABLE=/usr/local/Cellar/flex/2.6.4_2/bin/flex
Used with this macro that expands to nothing (i.e. no use of the function):
# define CRYPTO_set_locking_callback(func)
Which is inside:
# if OPENSSL_API_COMPAT < 0x10100000L
So looks like that function was deprecated with 1.1.0, and I think CentOS 7 still uses an older version (:
Yes, 1.0.2k. Good to know. https://github.com/openssl/openssl/issues/1260#issuecomment-405846524