summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-04-01 15:18:00 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-04-01 18:34:25 +0900
commit919b175afc389f8df6a3caa05ffdd28f5fc4bfca (patch)
tree463cd4f0bac9306be6e354d7d6ef9cb16f6a0353
parent552f05ef273d99dabd5c463de69aac6290dec119 (diff)
[ruby/etc] Deprecate names under `Struct`
https://github.com/ruby/etc/commit/25c538120c
-rw-r--r--ext/etc/etc.c8
-rw-r--r--ext/etc/extconf.rb5
2 files changed, 13 insertions, 0 deletions
diff --git a/ext/etc/etc.c b/ext/etc/etc.c
index 2f3fbb737b..3bad435a19 100644
--- a/ext/etc/etc.c
+++ b/ext/etc/etc.c
@@ -54,6 +54,12 @@ char *getlogin();
#define RUBY_ETC_VERSION "1.1.0"
+#ifdef HAVE_RB_DEPRECATE_CONSTANT
+void rb_deprecate_constant(VALUE mod, const char *name);
+#else
+# define rb_deprecate_constant(mod,name) ((void)(mod),(void)(name))
+#endif
+
#include "constdefs.h"
/* call-seq:
@@ -1165,6 +1171,7 @@ Init_etc(void)
rb_define_const(mEtc, "Passwd", sPasswd);
#endif
rb_define_const(rb_cStruct, "Passwd", sPasswd); /* deprecated name */
+ rb_deprecate_constant(rb_cStruct, "Passwd");
rb_extend_object(sPasswd, rb_mEnumerable);
rb_define_singleton_method(sPasswd, "each", etc_each_passwd, 0);
@@ -1200,6 +1207,7 @@ Init_etc(void)
rb_define_const(mEtc, "Group", sGroup);
#endif
rb_define_const(rb_cStruct, "Group", sGroup); /* deprecated name */
+ rb_deprecate_constant(rb_cStruct, "Group");
rb_extend_object(sGroup, rb_mEnumerable);
rb_define_singleton_method(sGroup, "each", etc_each_group, 0);
#endif
diff --git a/ext/etc/extconf.rb b/ext/etc/extconf.rb
index 435fbe7f3d..b6ae7700da 100644
--- a/ext/etc/extconf.rb
+++ b/ext/etc/extconf.rb
@@ -47,6 +47,11 @@ if !File.exist?("#{srcdir}/depend")
%x[#{RbConfig.ruby} #{srcdir}/mkconstants.rb -o #{srcdir}/constdefs.h]
end
+decl = [
+ "void rb_deprecate_constant(VALUE, const char *);",
+]
+have_func('rb_deprecate_constant(Qnil, "None")', [decl])
+
$distcleanfiles << "constdefs.h"
create_makefile("etc")