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

[ruby/etc] Deprecate names under Struct

25c538120c
This commit is contained in:
Nobuyoshi Nakada 2020-04-01 15:18:00 +09:00
parent bd0a7d8dd5
commit 78b6eb9f9f
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60
2 changed files with 13 additions and 0 deletions

View file

@ -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

View file

@ -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")