Skip to content

Commit cc4b879

Browse files
committed
ext/openssl/extconf.rb: do not use -Werror=deprecated-declarations
This is a combined commit of the following commits by mame and nobu: - 0d7d8b2989e1 ("ext/openssl/extconf.rb: do not use -Werror=deprecated-declarations", 2019-12-05) - c3abbc1b2f52 ("ext/openssl/extconf.rb: check with -Werror=deprecated-declarations", 2019-12-05) -Werror=deprecated-declarations should only be used while checking available features, and not for compiling the extension itself. This is a backport to the 2.1 branch from ruby.git. Note that current master (targeting 3.0) completely removed ext/openssl/deprecation.rb.
1 parent 98375ec commit cc4b879

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

ext/openssl/deprecation.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module OpenSSL
33
def self.deprecated_warning_flag
44
unless flag = (@deprecated_warning_flag ||= nil)
55
if try_compile("", flag = "-Werror=deprecated-declarations")
6-
$warnflags << " #{flag}"
6+
$warnflags = "#{@warnflags = $warnflags}" #{flag}"
77
else
88
flag = ""
99
end
@@ -12,6 +12,10 @@ def self.deprecated_warning_flag
1212
flag
1313
end
1414

15+
def self.restore_warning_flag
16+
$warnflags = @warnflags
17+
end
18+
1519
def self.check_func(func, header)
1620
have_func(func, header, deprecated_warning_flag)
1721
end

ext/openssl/extconf.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
Logging::message "=== OpenSSL for Ruby configurator ===\n"
2121

22-
# Add -Werror=deprecated-declarations to $warnflags if available
22+
# Check with -Werror=deprecated-declarations if available
2323
OpenSSL.deprecated_warning_flag
2424

2525
##
@@ -169,5 +169,6 @@ def find_openssl_library
169169
Logging::message "=== Checking done. ===\n"
170170

171171
create_header
172+
OpenSSL.restore_warning_flag
172173
create_makefile("openssl")
173174
Logging::message "Done.\n"

0 commit comments

Comments
 (0)