ruby-changes:51072
From: nobu <ko1@a...>
Date: Sat, 28 Apr 2018 10:45:56 +0900 (JST)
Subject: [ruby-changes:51072] nobu:r63279 (trunk): mjit_config.h: expand min header name
nobu 2018-04-28 10:45:52 +0900 (Sat, 28 Apr 2018) New Revision: 63279 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63279 Log: mjit_config.h: expand min header name * Makefile.in, win32/Makefile.sub (mjit_config.h): expand min header name, including the version number and the suffix. * mjit.c (init_header_filename): the version number and the suffix are now included in the header name. Modified files: trunk/Makefile.in trunk/common.mk trunk/mjit.c trunk/win32/Makefile.sub Index: Makefile.in =================================================================== --- Makefile.in (revision 63278) +++ Makefile.in (revision 63279) @@ -562,7 +562,7 @@ mjit_config.h: https://github.com/ruby/ruby/blob/trunk/Makefile.in#L562 echo '#define RUBY_MJIT_CONFIG_H 1'; \ echo; \ sep=; \ - quote MJIT_HEADER_INSTALL_DIR "$(MJIT_HEADER_INSTALL_DIR)"; \ + quote MJIT_MIN_HEADER_NAME "/$(MJIT_HEADER_INSTALL_DIR)/$(MJIT_MIN_HEADER_NAME)"; \ sep=,; \ quote "MJIT_CC_COMMON " $(MJIT_CC); \ quote "MJIT_CFLAGS $${archs:+ MJIT_ARCHFLAG}" -w; \ Index: common.mk =================================================================== --- common.mk (revision 63278) +++ common.mk (revision 63279) @@ -60,7 +60,8 @@ RDOCOUT = $(EXTOUT)/rdoc https://github.com/ruby/ruby/blob/trunk/common.mk#L60 HTMLOUT = $(EXTOUT)/html CAPIOUT = doc/capi MJIT_HEADER = rb_mjit_header.h -MJIT_MIN_HEADER = $(MJIT_HEADER_BUILD_DIR)/rb_mjit_min_header-$(RUBY_PROGRAM_VERSION).h +MJIT_MIN_HEADER_NAME = rb_mjit_min_header-$(RUBY_PROGRAM_VERSION).h +MJIT_MIN_HEADER = $(MJIT_HEADER_BUILD_DIR)/$(MJIT_MIN_HEADER_NAME) MJIT_HEADER_BUILD_DIR = $(EXTOUT)/include/$(arch) INITOBJS = dmyext.$(OBJEXT) dmyenc.$(OBJEXT) Index: win32/Makefile.sub =================================================================== --- win32/Makefile.sub (revision 63278) +++ win32/Makefile.sub (revision 63279) @@ -1281,7 +1281,7 @@ mjit_config.h: https://github.com/ruby/ruby/blob/trunk/win32/Makefile.sub#L1281 #ifndef RUBY_MJIT_CONFIG_H #define RUBY_MJIT_CONFIG_H 1 -#define MJIT_HEADER_INSTALL_DIR "$(MJIT_HEADER_INSTALL_DIR)" +#define MJIT_MIN_HEADER_NAME "/$(MJIT_HEADER_INSTALL_DIR)/$(MJIT_MIN_HEADER_NAME)" <<KEEP @ @(set sep=#define MJIT_CC_COMMON ) & \ Index: mjit.c =================================================================== --- mjit.c (revision 63278) +++ mjit.c (revision 63279) @@ -1184,8 +1184,6 @@ mjit_get_iseq_func(struct rb_iseq_consta https://github.com/ruby/ruby/blob/trunk/mjit.c#L1184 return body->jit_func; } -/* A name of the header file included in any C file generated by MJIT for iseqs. */ -#define RUBY_MJIT_HEADER_NAME "rb_mjit_min_header-" /* GCC and CLANG executable paths. TODO: The paths should absolute ones to prevent changing C compiler for security reasons. */ #define CC_PATH CC_COMMON_ARGS[0] @@ -1200,9 +1198,8 @@ init_header_filename(void) https://github.com/ruby/ruby/blob/trunk/mjit.c#L1198 VALUE basedir_val; char *basedir; size_t baselen; - size_t verlen; - static const char header_name[] = - "/" MJIT_HEADER_INSTALL_DIR "/" RUBY_MJIT_HEADER_NAME; + /* A name of the header file included in any C file generated by MJIT for iseqs. */ + static const char header_name[] = MJIT_MIN_HEADER_NAME; const size_t header_name_len = sizeof(header_name) - 1; char *p; #ifdef _WIN32 @@ -1219,13 +1216,10 @@ init_header_filename(void) https://github.com/ruby/ruby/blob/trunk/mjit.c#L1216 basedir_val = ruby_prefix_path; basedir = StringValuePtr(basedir_val); baselen = RSTRING_LEN(basedir_val); - verlen = strlen(ruby_version); - header_file = xmalloc(baselen + header_name_len + verlen + rb_strlen_lit(".h") + 1); + header_file = xmalloc(baselen + header_name_len + 1); p = append_str2(header_file, basedir, baselen); - p = append_str2(p, header_name, header_name_len); - p = append_str2(p, ruby_version, verlen); - p = append_str2(p, ".h", rb_strlen_lit(".h") + 1); + p = append_str2(p, header_name, header_name_len + 1); if ((fd = rb_cloexec_open(header_file, O_RDONLY, 0)) < 0) { verbose(2, "Cannot access header file %s\n", header_file); xfree(header_file); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/