summaryrefslogtreecommitdiff
path: root/ext/openssl/deprecation.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-12-05 16:18:22 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-12-05 18:23:01 +0900
commitc3abbc1b2f52015dc839fd96545380dbc11c77a9 (patch)
treeb890e4f35846bc6a95efce1bbd87ed6c3b1785ec /ext/openssl/deprecation.rb
parent4c88107c54b06c1a3e89970eb243c8ac887d84e1 (diff)
ext/openssl/extconf.rb: check with -Werror=deprecated-declarations
This reverts commit 0d7d8b2989e1738dd902d354cc41186899e6b71e, but restore `$warnflags` without the flag, to get rid of using deprecated functions.
Diffstat (limited to 'ext/openssl/deprecation.rb')
-rw-r--r--ext/openssl/deprecation.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/ext/openssl/deprecation.rb b/ext/openssl/deprecation.rb
index 6f08a206b4..afe989ead1 100644
--- a/ext/openssl/deprecation.rb
+++ b/ext/openssl/deprecation.rb
@@ -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)