1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

ext/openssl/extconf.rb: check with -Werror=deprecated-declarations

This reverts commit 0d7d8b2989,
but restore `$warnflags` without the flag, to get rid of using
deprecated functions.
This commit is contained in:
Nobuyoshi Nakada 2019-12-05 16:18:22 +09:00
parent 4c88107c54
commit c3abbc1b2f
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60
2 changed files with 21 additions and 1 deletions

View file

@ -1,7 +1,23 @@
# frozen_string_literal: false
module OpenSSL
def self.deprecated_warning_flag
unless flag = (@deprecated_warning_flag ||= nil)
if try_compile("", flag = "-Werror=deprecated-declarations")
$warnflags = "#{@warnflags = $warnflags}" #{flag}"
else
flag = ""
end
@deprecated_warning_flag = flag
end
flag
end
def self.restore_warning_flag
$warnflags = @warnflags
end
def self.check_func(func, header)
have_func(func, header)
have_func(func, header, deprecated_warning_flag)
end
def self.check_func_or_macro(func, header)

View file

@ -19,6 +19,9 @@ dir_config("kerberos")
Logging::message "=== OpenSSL for Ruby configurator ===\n"
# Check with -Werror=deprecated-declarations 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
@ -166,5 +169,6 @@ have_func("EVP_PBE_scrypt")
Logging::message "=== Checking done. ===\n"
create_header
OpenSSL.restore_warning_flag
create_makefile("openssl")
Logging::message "Done.\n"