[前][次][番号順一覧][スレッド一覧]

ruby-changes:59090

From: Nobuyoshi <ko1@a...>
Date: Thu, 5 Dec 2019 20:50:41 +0900 (JST)
Subject: [ruby-changes:59090] c3abbc1b2f (master): ext/openssl/extconf.rb: check with -Werror=deprecated-declarations

https://git.ruby-lang.org/ruby.git/commit/?id=c3abbc1b2f

From c3abbc1b2f52015dc839fd96545380dbc11c77a9 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Thu, 5 Dec 2019 16:18:22 +0900
Subject: 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.

diff --git a/ext/openssl/deprecation.rb b/ext/openssl/deprecation.rb
index 6f08a20..afe989e 100644
--- a/ext/openssl/deprecation.rb
+++ b/ext/openssl/deprecation.rb
@@ -1,7 +1,23 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/deprecation.rb#L1
 # 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)
diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb
index 5726007..264130b 100644
--- a/ext/openssl/extconf.rb
+++ b/ext/openssl/extconf.rb
@@ -19,6 +19,9 @@ dir_config("kerberos") https://github.com/ruby/ruby/blob/trunk/ext/openssl/extconf.rb#L19
 
 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") https://github.com/ruby/ruby/blob/trunk/ext/openssl/extconf.rb#L169
 Logging::message "=== Checking done. ===\n"
 
 create_header
+OpenSSL.restore_warning_flag
 create_makefile("openssl")
 Logging::message "Done.\n"
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]