From da2deaceb8b959c7c4bdbc18f254e3686c09cc13 Mon Sep 17 00:00:00 2001 From: Kazuki Yamaguchi Date: Sun, 16 Feb 2020 11:38:54 +0000 Subject: extconf.rb: get rid of -Werror=deprecated-declarations No function needs -Werror=deprecated-declarations flag to check availability any more. This also fixes -Werror=deprecated-declarations erroneously carrying on to the actual compilation, resulting in an compilation error on some environment. Fixes: https://github.com/ruby/openssl/pull/331 --- ext/openssl/deprecation.rb | 23 ----------------------- ext/openssl/extconf.rb | 16 ++++++---------- 2 files changed, 6 insertions(+), 33 deletions(-) delete mode 100644 ext/openssl/deprecation.rb diff --git a/ext/openssl/deprecation.rb b/ext/openssl/deprecation.rb deleted file mode 100644 index 6af7d562..00000000 --- a/ext/openssl/deprecation.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true -module OpenSSL - def self.deprecated_warning_flag - unless flag = (@deprecated_warning_flag ||= nil) - if try_compile("", flag = "-Werror=deprecated-declarations") - $warnflags << " #{flag}" - else - flag = "" - end - @deprecated_warning_flag = flag - end - flag - end - - def self.check_func(func, header) - have_func(func, header, deprecated_warning_flag) - end - - def self.check_func_or_macro(func, header) - check_func(func, header) or - have_macro(func, header) && $defs.push("-DHAVE_#{func.upcase}") - end -end diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb index a60c6af6..f424bf01 100644 --- a/ext/openssl/extconf.rb +++ b/ext/openssl/extconf.rb @@ -12,16 +12,12 @@ =end require "mkmf" -require File.expand_path('../deprecation', __FILE__) dir_config("openssl") dir_config("kerberos") Logging::message "=== OpenSSL for Ruby configurator ===\n" -# Add -Werror=deprecated-declarations to $warnflags if available -OpenSSL.deprecated_warning_flag - ## # Adds -DOSSL_DEBUG for compilation and some more targets when GCC is used # To turn it on, use: --with-debug or --enable-debug @@ -118,7 +114,7 @@ engines = %w{builtin_engines openbsd_dev_crypto dynamic 4758cca aep atalla chil cswift nuron sureware ubsec padlock capi gmp gost cryptodev aesni cloudhsm} engines.each { |name| - OpenSSL.check_func_or_macro("ENGINE_load_#{name}", "openssl/engine.h") + have_func("ENGINE_load_#{name}()", "openssl/engine.h") } if ($mswin || $mingw) && have_macro("LIBRESSL_VERSION_NUMBER", "openssl/opensslv.h") @@ -130,9 +126,9 @@ have_func("EC_curve_nist2nid") have_func("X509_REVOKED_dup") have_func("X509_STORE_CTX_get0_store") have_func("SSL_CTX_set_alpn_select_cb") -OpenSSL.check_func_or_macro("SSL_CTX_set1_curves_list", "openssl/ssl.h") -OpenSSL.check_func_or_macro("SSL_CTX_set_ecdh_auto", "openssl/ssl.h") -OpenSSL.check_func_or_macro("SSL_get_server_tmp_key", "openssl/ssl.h") +have_func("SSL_CTX_set1_curves_list(NULL, NULL)", "openssl/ssl.h") +have_func("SSL_CTX_set_ecdh_auto(NULL, 0)", "openssl/ssl.h") +have_func("SSL_get_server_tmp_key(NULL, NULL)", "openssl/ssl.h") have_func("SSL_is_server") # added in 1.1.0 @@ -166,8 +162,8 @@ have_func("X509_CRL_up_ref") have_func("X509_STORE_up_ref") have_func("SSL_SESSION_up_ref") have_func("EVP_PKEY_up_ref") -OpenSSL.check_func_or_macro("SSL_CTX_set_tmp_ecdh_callback", "openssl/ssl.h") # removed -OpenSSL.check_func_or_macro("SSL_CTX_set_min_proto_version", "openssl/ssl.h") +have_func("SSL_CTX_set_tmp_ecdh_callback(NULL, NULL)", "openssl/ssl.h") # removed +have_func("SSL_CTX_set_min_proto_version(NULL, 0)", "openssl/ssl.h") have_func("SSL_CTX_get_security_level") have_func("X509_get0_notBefore") have_func("SSL_SESSION_get_protocol_version") -- cgit v1.2.3