Граф коммитов

488 Коммитов

Автор SHA1 Сообщение Дата
nobu b6dcc3963a ruby.c: set feature bits only
* ruby.c (DEFAULT_FEATURES): set feature bits only, excluding
  debug features.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-09 07:42:21 +00:00
nobu ade0d8e26e ruby.c: EACH_DEBUG_FEATURES
* ruby.c (EACH_DEBUG_FEATURES): define the list of debug feature
  names.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-09 07:36:27 +00:00
nobu 4859eba88f rename ADD_FEATURE
* ruby.c (ADD_FEATURE_NAME): rename ADD_FEATURE, as it does not
  add a feature, but just append a name to the message string.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-09 05:47:12 +00:00
nobu 12bdb15e71 ruby.c: err ambiguous feature name [ci skip]
* ruby.c (feature_option): raise a runtime error if ambiguous
  feature name is given, in the future.  [Bug #12050]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-08 01:30:22 +00:00
nobu 2c9274eff2 ruby.c: EACH_FEATURES
* ruby.c (EACH_FEATURES): define the list of feature names.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-07 10:21:27 +00:00
nobu 3890bb60a9 ruby.c: show feature names
* ruby.c (feature_option): show possible feature names when
  unknown argument is given.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-07 02:40:52 +00:00
nobu 7aab062ef3 version.c: no exit in ruby_show_copyright
* include/ruby/backward.h (ruby_show_copyright_to_die): for source
  code backward compatibility.
* ruby.c (process_options): return Qtrue to exit the process
  successfully.
* version.c (ruby_show_copyright): no longer exit.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-07 02:34:33 +00:00
nobu 290deeb705 ruby.c: overriding warning options
* ruby.c (proc_options): successive -W option overrides previous
  warning options.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-29 12:23:04 +00:00
nobu 1eafb3dd4b ruby.c: parse -W option
* ruby.c (proc_options): parse and skip '-W' option and its
  argument even if ignored.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-29 10:39:53 +00:00
nobu 66fe2c0dd9 ruby.c: command line option over RUBYOPT env
* ruby.c (proc_options): -W command line option should be able to
  override -w in RUBYOPT environment variable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-29 10:12:48 +00:00
nobu fc0c2d1cc2 version.c: remove ruby_engine_name
* ruby.c (load_file_internal, ruby_process_options): share
  ruby_engine instead of literal strings.

* version.c (Init_version): remove internal `ruby_engine_name`,
  but set the VM program name in addition to the global constant.

* vm_backtrace.c (location_to_str, oldbt_init): use th eVM program
  name always.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-29 02:25:12 +00:00
nobu 012368007f iseq.h: rename member
* iseq.h (rb_compile_option_struct): rename the member
  frozen_string_literal_debug as debug_frozen_string_literal.
  [Feature #11725]

* ruby.c (proc_options): do not set $DEBUG and $VERBOSE only if no
  arguments is given.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-25 08:02:29 +00:00
nobu 82bd486e99 ruby.c: --debug=frozen-string-literal option
* ruby.c (need_argument): move frozen-string-literal-debug option
  from --enable to --debug.  [Feature #11725]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-21 09:57:31 +00:00
nobu c033efddea ruby.c: fix pointer overrun
* ruby.c (proc_options): fix pointer overrun. do not advance argv
  until it is valid.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-21 09:41:56 +00:00
nobu d32a48ed6c ruby.c: fix ARGV doc [ci skip]
* ruby.c (ruby_prog_init): [DOC] ARGV does not contain the name of
  the executable.  [ruby-core:71561] [Bug #11711]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-19 10:45:04 +00:00
nobu c1da4ef8d1 ruby.c: feature_option
* ruby.c (feature_option): unify enable_option and disable_option
  not to repeat feature names twice.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-19 08:56:12 +00:00
nobu 9c065a4bfb ruby.c: set compile options at once
* ruby.c (process_options): set instruction compilation options at
  once, and set disabled options to false explicitly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-19 05:58:31 +00:00
ko1 54716fe7eb * ruby.c: introduce --enable-frozen-string-literal-debug option.
If this option is enabled, the modify error will be:
    can't modify frozen String (RuntimeError) =>
    can't modify frozen String, created at test.rb:3 (RuntimeError)

* iseq.h: add compile option frozen_string_literal_debug.

* compile.c: catch up this fix.

* error.c (rb_error_frozen): ditto.

* iseq.c (set_compile_option_from_hash): ditto.

* test/ruby/test_rubyoptions.rb: add a test for this fix.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-23 19:02:55 +00:00
nobu 1d1ee07f3c ruby.c: disable nonblock only if nonblocking mode
* ruby.c (open_load_file): disable O_NONBLOCK only when opened in
  non-blocking mode, to get rid of LoadError on Windows.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18 04:22:44 +00:00
kosaki a923a6f04c * ruby.c (open_load_file): add a comment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18 01:44:31 +00:00
kosaki 4ad2057f27 * ChangeLog: Good-bye OS/2.
* common.mk: ditto.
* configure.in: ditto.
* dln_find.c: ditto.
* ext/Setup.emx: ditto.
* ext/extmk.rb: ditto.
* ext/socket/extconf.rb: ditto.
* ext/zlib/extconf.rb: ditto.
* file.c: ditto.
* include/ruby/defines.h: ditto.
* io.c: ditto.
* lib/mkmf.rb: ditto.
* missing/os2.c: ditto.
* process.c: ditto.
* ruby.c: ditto.
* NEWS: announce OS/2 is no longer supported.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18 01:18:34 +00:00
kosaki 698f6648c5 * ruby.c (open_load_file): use rb_thread_wait_fd() instead of reopen.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18 00:21:03 +00:00
nobu acc94eb939 ruby.c: unnecessary variable
* ruby.c (open_load_file): remove unnecessary nested local
  variable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-17 23:59:00 +00:00
nobu d6379666ca file.c: set errno
* file.c (ruby_is_fd_loadable): set proper errno.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-17 23:41:14 +00:00
nobu d5cb997f18 ruby.c: suppress warnings
* ruby.c (loadopen_func): suppress a warning, unused function.

* ruby.c (open_load_file): suppress warnings, results of close(2).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-17 23:38:18 +00:00
kosaki bc8687acd6 * ruby.c (open_load_file): reset O_NONBLOCK after open.
Even if S_ISREG() is true, the file may be file on FUSE filesystem
  or something. We can't assume O_NONBLOCK is safe.
  Moreover, we should wait if the path is point to FIFO. That's
  FIFO semantics. GVL should be transparent from ruby script.
  Thus, just reopen without O_NONBLOCK for filling the requirements.
  [Bug #11060][Bug #11559]
* ruby.c (loadopen_func): new for the above.
* file.c (ruby_is_fd_loadable): new. for checks loadable file type
  of not.
* file.c (rb_file_load_ok): use ruby_is_fd_loadble()
* internal.h: add ruby_is_fd_loadble()
* common.mk: now, ruby.o depend on thread.h.
* test/ruby/test_require.rb
(TestRequire#test_loading_fifo_threading_success): new test.
  This test successful case that loading from FIFO.
* test/ruby/test_require.rb
(TestRequire#test_loading_fifo_threading_raise): rename from
  test_loading_fifo_threading. You souldn't rescue an exception
  if you test raise or not.
  Moreover, this case should be caught IOError because load(FIFO)
  should be blocked until given any input.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-17 21:09:10 +00:00
nobu c1a6fdc86c ruby.c: unify nested code
* ruby.c (load_file): unify each preparations and clean-ups by
  merging load_file_internal and load_file_internal2, and remove
  nested rb_protect and rb_ensure.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-17 04:19:12 +00:00
nobu 4bc884c4f3 ruby.c: conflicting O_NONBLOCK
* ruby.c (load_file_internal): do not use O_NONBLOCK when
  conflicting with O_ACCMODE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-17 04:03:23 +00:00
nobu 34b877e491 ruby.c: fd leak
* ruby.c (load_file_internal): fix potential fd leak.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-16 23:24:37 +00:00
nobu abf832f435 file.c: non-blocking open
* file.c (rb_file_load_ok): open in non-blocking mode withoout
  releasing GVL.  don't care about others than regular files and
  directories.  [ruby-dev:49272] [Bug #11559]
* ruby.c (load_file_internal): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-16 06:54:38 +00:00
nobu 832c74f428 ruby.c: frozen-string-literal option
* ruby.c (process_options): add an option to enable/disable
  frozen-string-literal.  [Feature #8976]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-27 06:47:00 +00:00
nobu 6b52b88d46 ruby.c: abbreviated option name
* ruby.c (name_match_p): allow option argument names to be
  abbreviated for each words.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-27 05:47:24 +00:00
nobu f9a9193ae0 ruby.c: feature bits
* ruby.c (enum feature_flag_bits, struct cmdline_options): turn
  negative logic disable bits into positive logic feature bits.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-23 14:43:45 +00:00
usa 40f304e025 * ruby.c (usage, enable_option, disable_option, process_options): new
option `--disable_did_you_mean`.

* gem_prelude.rb: now requires did_you_mean gem by default if available.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-09 07:57:31 +00:00
nobu 9af0cf1cfb internal.h: move rb_readlink declaration
* internal.h (rb_readlink): move the declaration.

* ruby.c (dladdr_path): rb_readlink now requires the result
  encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-05 14:00:15 +00:00
ko1 e4198a73d4 * make rb_iseq_t T_IMEMO object (type is imemo_iseq).
All contents of previous rb_iseq_t is in rb_iseq_t::body.
  Remove rb_iseq_t::self because rb_iseq_t is an object.
  RubyVM::InstructionSequence is wrapper object points T_IMEMO/iseq.
  So RubyVM::ISeq.of(something) method returns different wrapper
  objects but they point the same T_IMEMO/iseq object.
  This patch is big, but most of difference is replacement of
  iseq->xxx to iseq->body->xxx.
  (previous) rb_iseq_t::compile_data is also located to
  rb_iseq_t::compile_data.
  It was moved from rb_iseq_body::compile_data.
  Now rb_iseq_t has empty two pointers.
  I will split rb_iseq_body data into static data and dynamic data.
* compile.c: rename some functions/macros.
  Now, we don't need to separate iseq and iseqval (only VALUE).
* eval.c (ruby_exec_internal): `n' is rb_iseq_t (T_IMEMO/iseq).
* ext/objspace/objspace.c (count_imemo_objects): count T_IMEMO/iseq.
* gc.c: check T_IMEMO/iseq.
* internal.h: add imemo_type::imemo_iseq.
* iseq.c: define RubyVM::InstructionSequnce as T_OBJECT.
  Methods are implemented by functions named iseqw_....
* load.c (rb_load_internal0): rb_iseq_new_top() returns
  rb_iseq_t (T_IMEMO/iesq).
* method.h (rb_add_method_iseq): accept rb_iseq_t (T_IMEMO/iseq).
* vm_core.h (GetISeqPtr): removed because it is not T_DATA now.
* vm_core.h (struct rb_iseq_body): remove padding for
  [Bug #10037][ruby-core:63721].



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-21 22:52:59 +00:00
nobu aae22e3408 ruby.c: copy initial load path marks
* ruby.c (process_options): also copy initial load path marks at
  setting load paths encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02 05:12:04 +00:00
nobu e28addcf5b ruby.c: show_usage_line
* ruby.c (show_usage_line): extract function to print one usage
  line.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-24 02:20:10 +00:00
nobu 69f47dd0e8 ruby.c: only for load-relative
* ruby.c (dladdr_path): used only when load-relative is enabled.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-24 13:06:58 +00:00
nobu c3ad34c7fa ruby.c: replace with real path
* ruby.c (dladdr_path): replace the executable path with symlinked
  real path.  dladdr(3) on Linux returns the argv[0] as dli_fname
  instead of the real path, for a symbol defined in the executable
  file itself.  [Bug #10776]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-24 12:24:27 +00:00
nobu 3b0ca10539 ruby.c: do not modify shared string
* ruby.c (ruby_init_loadpath_safe): get rid of modify shared
  string directly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-09 01:05:18 +00:00
nobu dd155e029e ruby.c: no safe_level 4
* ruby.c (process_options): safe_level 4 was removed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-05 21:37:12 +00:00
nobu f235dbeea5 dmyenc.c: try to load encdb
* load.c (ruby_require_internal): separate from rb_require_safe,
  not to raise exceptions.
* ruby.c (process_options): remove unnatural encoding search.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-03 05:51:28 +00:00
nobu 1ce81d6f8b ruby.c: transcode program names
* ruby.c (process_options, ruby_script): transcode script name and
  program name to locale encoding as well as argv.
  [ruby-dev:48752] [Bug #10555]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-29 15:02:58 +00:00
nobu b4c3c3171f ruby.c: translit_char_bin
* ruby.c (translit_char_bin): should not use code page dependent
  CharNext on UTF-8 string.  [ruby-dev:48752] [Bug #10555]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-29 15:02:25 +00:00
nobu 33ea2646b9 win32.c: use UTF-8 for argv
* ruby.c (ruby_set_argv): convert argv from UTF-8.
* win32/win32.c (rb_w32_sysinit, cmdglob, w32_cmdvector): convert
  wide char command line to UTF-8 argv, and glob in UTF-8 so that
  metacharacters would match multibyte characters.
  [ruby-dev:48752] [Bug #10555]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-29 07:53:17 +00:00
normal 83f0e9d6f1 trivial packing of rb_execarg, load_file_arg, args_info
* internal.h (struct rb_execarg): 160 => 144 bytes on x86-64
* ruby.c (struct load_file_arg): 48 => 40 bytes on x86-64
* vm_args.c (struct args_info): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-23 01:49:57 +00:00
akr fdc41af774 * internal.h (ruby_init_setproctitle): Declare here.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-19 15:57:31 +00:00
akr 2b9191e557 * internal.h: Gather declarations in non-header files.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-18 15:13:05 +00:00
akr 7cd76ab0c5 * internal.h: Include ruby.h and ruby/encoding.h to be
includable without prior inclusion.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15 11:49:06 +00:00