Commit graph

523 commits

Author SHA1 Message Date
usa
f1de89ce06 merge revision(s) 61323: [Backport #15069]
suppress warning: 'const' attribute on function returning 'void'

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@65109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-17 07:56:26 +00:00
nagachika
3c5452dba1 revert r62797, r62784. [Bug #13863]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-18 03:57:37 +00:00
nagachika
2368dbdfa3 merge revision(s) 58745,58780,59040,60743: [Backport #13863]
rb_w32_ugetcwd: UTF-8 version getcwd

	* dir.c (rb_dir_getwd): convert from UTF-8.

	* win32/win32.c (w32_getcwd): codepage aware getcwd using
	  GetCurrentDirectoryW.
	potential memory leak

	* dir.c (rb_dir_getwd): get rid of potential memory leak.

	* util.c (ruby_getcwd): ditto.
	file.c: realpath in OS path encoding

	* dir.c (rb_dir_getwd_ospath): return cwd path in the OS path
	  encoding.

	* file.c (rb_realpath_internal): work in the OS path encoding
	load.c: cwd encoding

	* load.c (rb_get_expanded_load_path): save cwd cache in OS path
	  encoding, to get rid of unnecessary conversion and infinite
	  loading when it needs encoding conversion.
	  [ruby-dev:50221] [Bug #13863]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-16 17:34:44 +00:00
nagachika
eaba9da1d1 merge revision(s) 59983,59984: [Backport #10222] [Backport #14372] [Backport #14424]
file.c: rb_check_realpath

	* file.c (rb_check_realpath): returns real path which has no
	  symbolic links.  similar to rb_realpath except for returning
	  Qnil if any parts did not exist.

	load.c: real path to load

	* load.c (rb_construct_expanded_load_path): expand load paths to
	  real paths to get rid of duplicate loading from symbolic-linked
	  directories.  [Feature #10222]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-16 16:25:40 +00:00
nagachika
ac84c2aee2 merge revision(s) 58471,58493: [Backport #13505]
load.c: backtrace of circular require

	* load.c (load_lock): print backtrace of circular require via
	  `Warning.warn` [ruby-core:80850] [Bug #13505]

	Send the backtrace of the circular require warning as a single String to Warning.warn

	* load.c: send as a single string.
	* error.c: expose the string formatted by rb_warning as rb_warning_string().
	* test/ruby/test_exception.rb: update tests.
	  [ruby-core:80850] [Bug #13505]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-16 15:27:37 +00:00
nagachika
b20e9ebe5a merge revision(s) 58146,58150,58156: [Backport #13276]
error.c: refactor warning messages

	* error.c (with_warning_string): extract building warning message
	  string from variadic arguments.

	* error.c (syserr_warning): write warning message with the system
	  error message.

	error.c: warning functions

	* error.c: define warning functions in all combinations of
	  * no errno, system errno, argument
	  * without/with encoding
	  * enabled/disabled by default

	dir.c: err at glob failure

	* dir.c (glob_helper): raise a SystemCallError exception when
	  opendir() failed, except for ENOENT, ENOTDIR, and EACCES.  this
	  behavior predates 1.0; the comments in glob.c claimed that
	  glob() returned -1 on error but actualy the pointer to a global
	  variable, then dir_glob() did check only -1 as the comments, and
	  ignored actual errors.  [ruby-core:80226] [Bug #13276]

	dir.c: ruby_glob_funcs_t

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@61367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-20 15:20:15 +00:00
nagachika
cdf9931005 merge revision(s) 59765: [Backport #13877]
ruby.h: unnormalized Fixnum value

	* include/ruby/ruby.h (ST2FIX): fix unnormalized Fixnum value bug
	  on mingw/mswin.  [ruby-core:82687] [Bug #13877]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-10 12:33:09 +00:00
nagachika
11d5ad0b84 merge revision(s) 58205: [Backport #13380]
Remove unused Init_frozen_strings declaration

	Init_frozen_strings definition is removed in r51511.
	https://bugs.ruby-lang.org/issues/11423

	Patch by Kohei Suzuki <eagletmt@gmail.com>

	* internal.h: Remove declaration of unexist function
	  [Fix GH-1558]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-05 01:56:55 +00:00
nagachika
568472906b merge revision(s) 59357,59358: [Backport #13391] [Backport #13404]
proc.c: rb_block_min_max_arity

	* proc.c (rb_block_min_max_arity): new function to get arity range
	  from the current block.
	vm_eval.c: rb_lambda_call

	* enum.c (enum_collect): make the block arity same as the given
	  block.  [Bug #13391]

	* internal.h (vm_ifunc): store arity instead of unused id.

	* proc.c (rb_vm_block_min_max_arity): return ifunc arity.

	* vm_eval.c (rb_lambda_call): call method with lambda block.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-04 14:31:52 +00:00
nagachika
79787c183f merge revision(s) 58262,5826: [Backport #13369]
fix TracePoint#return_value with non-local exits

	* vm.c: get return_value from imemo_throw_data object (THROW_DATA_VAL()).
	  imemo_throw_data (TAG_BREAK) contains returned value.
	  However, imemo_throw_data (TAG_BREAK) can skip several frames so that
	  we need to use it only once (at most internal frame). To record it,
	  we introduced THROW_DATA_CONSUMED and check it.

	* internal.h: define THROW_DATA_CONSUMED flag.

	* test/ruby/test_settracefunc.rb: add tests for [Bug #13369]

	* vm_insnhelper.h: add THROW_DATA_CONSUMED_P() and
	  THROW_DATA_CONSUMED_SET().
	  unless File::FNM_DOTMATCH is set. (like '*/') [ruby-dev:23014]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-09 19:47:28 +00:00
naruse
539ab30569 merge revision(s) 57192,57464,58016,58018,58019: [Backport #12705]
[Bug #12705]
	add a ticket number.

	test_lambda.rb: refine test

	* test/ruby/test_lambda.rb (test_lambda_as_iterator): refine a
	  test for the intention of the original report.
	  [ruby-core:61340] [Bug #9605]
	test_lambda.rb: remove duplcate tests
	vm_args.c: arity check of lambda

	* vm_eval.c (rb_yield_lambda): new function which yields an array
	  to a proc and splat to a lambda.  mainly for Enumerable only.

	* vm_args.c (setup_parameters_complex): remove special lambda
	  splatting for [Bug #9605].  [ruby-core:77065] [Bug #12705]

	* vm_insnhelper.c (vm_callee_setup_block_arg): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@58045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-21 14:04:23 +00:00
naruse
baf330be0a merge revision(s) 57469,57471,57472,57503,57508: [Backport #13299]
io.c: recycle garbage on write

	* string.c (STR_IS_SHARED_M): new flag to mark shared mulitple times
	  (STR_SET_SHARED): set STR_IS_SHARED_M
	  (rb_str_tmp_frozen_acquire, rb_str_tmp_frozen_release): new functions
	  (str_new_frozen): set/unset STR_IS_SHARED_M as appropriate
	* internal.h: declare new functions
	* io.c (fwrite_arg, fwrite_do, fwrite_end): new
	  (io_fwrite): use new functions

	Introduce rb_str_tmp_frozen_acquire and rb_str_tmp_frozen_release
	to manage a hidden, frozen string.  Reuse one bit of the embed
	length for shared strings as STR_IS_SHARED_M to indicate a string
	has been shared multiple times.  In the common case, the string
	is only shared once so the object slot can be reclaimed immediately.

	minimum results in each 3 measurements. (time and size)

	Execution time (sec)
	name                            trunk   built
	io_copy_stream_write            0.682   0.254
	io_copy_stream_write_socket     1.225   0.751

	Speedup ratio: compare with the result of `trunk' (greater is better)
	name    built
	io_copy_stream_write            2.680
	io_copy_stream_write_socket     1.630

	Memory usage (last size) (B)
	name                            trunk           built
	io_copy_stream_write            95436800.000    6512640.000
	io_copy_stream_write_socket     117628928.000   7127040.000

	Memory consuming ratio (size) with the result of `trunk' (greater is better)
	name    built
	io_copy_stream_write            14.654
	io_copy_stream_write_socket     16.505
	string.c (rb_str_tmp_frozen_release): release embedded strings

	Handle the embedded case first, since we may have an embedded
	duplicate and non-embedded original string.

	* string.c (rb_str_tmp_frozen_release): handled embedded strings
	* test/ruby/test_io.rb (test_write_no_garbage): new test
	  [ruby-core:78898] [Bug #13085]
	io.c (rb_io_syswrite): avoid leaving garbage after write

	As with IO#write, IO#syswrite also generates garbage which can
	be harmful in hand-coded read-write loops.

	* io.c (swrite_arg, swrite_do, swrite_end): new
	  (rb_io_syswrite): use new functions to cleanup garbage
	  [ruby-core:78898] [Bug #13085]
	Add class name to assert messages
	io.c: remove rb_ensure usage for rb_str_tmp_frozen_* calls

	Using rb_ensure pessimizes the common case and makes the code
	more difficult to read and follow.  If we hit an exceptions
	during write, just let the GC handle cleanup as the exception
	is already bad for garbage.

	* io.c (io_fwrite): call rb_str_tmp_frozen{acquire,release} directly
	  (rb_io_syswrite): ditto
	  (fwrite_do, fwrite_end, swrite_do, swrite_end): remove

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@57941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-12 18:15:33 +00:00
naruse
f1a2033d75 merge revision(s) 57415,57463,57474:
eval.c: copy special exception

	* eval.c (setup_exception): make unfrozen copy of special
	  exception before setting up a cause.
	reduce iterations for slower machines
	test_io.rb: separate a test

	* test/ruby/test_io.rb (test_closed_stream_in_rescue): run in a
	  separated process.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@57939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-12 18:01:22 +00:00
naruse
fd89be255f merge revision(s) 57278,57279: [Backport #12855]
fix optimization for hash aset/aref with fstring

	Patch by Eric Wong [ruby-core:78797].
	I don't like the idea of making insns.def any bigger to support
	a corner case, and "test_hash_aref_fstring_identity" shows
	how contrived this is.

	[ruby-core:78783] [Bug #12855]
	adjust indent [ci skip]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@57848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-11 14:48:04 +00:00
naruse
ea52cac148 merge revision(s) 57227: [Backport #13078]
numeric.c: reduce fdiv

	* numeric.c (rb_int_fdiv_double): reduce first for more precise
	  result.  [ruby-core:78886] [Bug #13078]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@57840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-11 13:03:46 +00:00
nobu
353395f969 get rid of implicit signedness conversions
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-22 20:58:55 +00:00
nobu
6dd5ee752a String#match? and Symbol#match?
* string.c (rb_str_match_m_p): inverse of Regexp#match?.  based on
  the patch by Herwin Weststrate <herwin@snt.utwente.nl>.
  [Fix GH-1483] [Feature #12898]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-12 02:56:12 +00:00
mrkn
f72be814d9 internal.h: change the default rounding mode to half-up
* internal.h (ROUND_DEFAULT): changed to RUBY_NUM_ROUND_HALF_UP.
  [Bug #12958] [ruby-core:78204]

* test/ruby/test_integer.rb: fix assertions for the above change.

* test/ruby/test_rational.rb: ditto.

* test/test_mathn.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-10 02:36:16 +00:00
nobu
631dde2572 round-down
* numeric.c (round_half_down, int_round_half_down): support
  round-down mode.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-25 06:28:00 +00:00
mrkn
b920d9545c complex.c: optimize f_gt_p some cases
* complex.c (f_gt_p): optimize f_gt_p for specific types of arguments.

* internal.h (rb_int_gt, rb_float_gt, rb_rational_cmp): exported.

* numeric.c (rb_float_gt): rename from flo_gt and be exported.

* numeric.c (rb_int_gt): rename from int_gt and be exported.

* rational.c (rb_rational_cmp): rename from nurat_cmp and be exported.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-22 05:21:12 +00:00
mrkn
c151aa88a9 complex.c: optimize f_negate
* complex.c (f_negate): optimize for special numeric types.

* complex.c (nucomp_expt): use rb_int_uminus instead of f_negate for
  fixnum value.

* internal.h (rb_float_uminus, rb_rational_uminus): exported.

* numeric.c (rb_float_uminus): rename from flo_uminus.

* rational.c (rb_rational_uminus): rename from nurat_negate, and add
  assertion for the parameter.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-18 15:17:19 +00:00
nobu
81ec47ea18 internal.h: round macros
* internal.h (ROUND_FUNC, ROUND_CALL): macros wrapping round
  functions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-18 06:29:51 +00:00
mrkn
affa0f845c complex.c: optimize Numeric#polar and Numeric#arg
* complex.c (numeric_polar): optimize for Integer, Float, and Rational.

* complex.c (numeric_arg): directly create the value of pi.

* complex.c (f_negative_p): optimize for Integer, Float, and Rational.

* rational.c (INT_NEGATIVE_P): move the definition into internal.h.

* internal.h (INT_NEGATIVE_P): ditto.

* numeric.c (rb_float_abs): rename from flo_abs and export to be used
  from other source files..

* internal.h (rb_float_abs): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-16 04:25:35 +00:00
mrkn
bdd18a2c31 rational.c: optimize Integer#lcm
* rational.c (f_div, f_mul, f_abs): optimize Integer#lcm
  Author: Tadashi Saito <tad.a.digger@gmail.com>

* numeric.c (rb_int_abs): rename from int_abs to be exported.

* internal.h (rb_int_div, rb_int_abs): exported.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 15:43:26 +00:00
mrkn
f40607d15d rational.c: optimize Float#to_r
* rational.c (float_to_r): optimize Float#to_r.

* numeric.c (rb_int_lshift): exported.

* internal.h (rb_int_lshift): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 11:52:00 +00:00
mrkn
9bb3022475 rational.c: optimize Rational#{floor,ceil,round,truncate}
* rational.c (f_{expt10,round_common},nurat_{floor,ceil,round_half_{up,even}}):
  optimize Rational#{floor,ceil,round,truncate}.
  Author: Tadashi Saito <tad.a.digger@gmail.com>

* numeric.c (rb_int_divmod): rename from int_divmod to be exported.

* numeric.c (rb_int_and): rename from int_and to be exported.

* intern.h (rb_int_{divmod,and}): exported.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 06:45:11 +00:00
mrkn
e5aa590637 rational.c: purge f_cmp
* rational.c (f_cmp, nurat_expt): purge f_cmp.
  Author: Tadashi Saito <tad.a.digger@gmail.com>

* rational.c (INT_POSITIVE_P): added.

* numeric.c (FIXNUM_POSITIVE_P): move the definition into internal.h.

* internal.h (FIXNUM_POSITIVE_P): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 06:07:24 +00:00
mrkn
d611a7c77b rational.c: optimize Rational#==
* rational.c (nurat_eqeq_p): optimize Rational#==.
  Author: Tadashi Saito <tad.a.digger@gmail.com>

* numeric.c (rb_int_equal): rename from int_equal and remove static
  to be exported.

* internal.h (rb_int_equal): exported.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 02:24:32 +00:00
mrkn
fb40c3776a rational.c: optimize Rational#<=>
* rational.c (nurat_cmp): optimize Rational#<=>.
  Author: Tadashi Saito <tad.a.digger@gmail.com>

* numeric.c (rb_int_cmp): rename from int_cmp and remove static
  to be exported.

* internal.h (rb_int_cmp): exported.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 01:29:01 +00:00
mrkn
d8769bffe5 rational.c: optimize Rational#**
* rational.c (nurat_expt): optimize Rational#**.
  Author: Tadashi Saito <tad.a.digger@gmail.com>

* numeric.c (rb_float_pow): rename flo_pow() to rb_float_pow()
  and remove static to be exporetd.

* internal.h (rb_int_pow, rb_float_pow): exported.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-11 16:38:28 +00:00
mrkn
06d701a1f0 rational.c: avoid needless object allocation with nurat_to_double
* rational.c (nurat_to_double): introduce to convert rational to double
  without object allocation.

* rational.c (rb_rational_plus, nurat_{sub,mul,to_f}): rewrite by using
  nurat_to_double.

* bignum.c (rb_big_fdiv_double): introduce to calculate fdiv and return
  the result as a double value.

* bignum.c (big_fdiv{,_int,_float}): change the return types for
  implementing rb_big_fdiv_double.

* bignum.c (rb_big_fdiv): rewrite by using rb_big_fdiv_double.

* numeric.c (rb_int_fdiv_double): introduce to calculate fdiv and return
  the result as a double value.

* numeric.c (fix_fdiv_double): rewrite from fix_fdiv to return the
  result as a double value.

* numeric.c (rb_int_fdiv): rewrite by using rb_int_fdiv_double.

* internal.h (rb_{big,int}_fdiv_double): exported.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-11 15:55:30 +00:00
mrkn
f64a53462e numeric.c, rational.c: refactor by using FIXNUM_NEGATIVE_P and FIXNUM_ZERO_P
* numeric.c (num_zero_p, fix_divide, fix_mod, fix_divmod): refactor by using
  FIXNUM_NEGATIVE_P and FIXNUM_ZERO_P.

* rational.c (INT_NEGATIVE_P, INT_ZERO_P): ditto.

* internal.h: move FIXNUM_NEGATIVE_P and FIXNUM_ZERO_P from numeric.c

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-11 14:39:25 +00:00
mrkn
c05cfe3739 numeric.c, internal.h: export int_fdiv() as rb_int_fdiv()
* numeric.c (rb_int_fdiv): export int_fdiv() as rb_int_fdiv().

* internal.h (rb_int_fdiv): add declaration of rb_int_fdiv().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-10 15:23:33 +00:00
ko1
75775157ea Introduce table improvement by Vladimir Makarov <vmakarov@redhat.com>.
[Feature #12142]
	See header of st.c for improvment details.

	You can see all of code history here:
	<https://github.com/vnmakarov/ruby/tree/hash_tables_with_open_addressing>

	This improvement is discussed at
	<https://bugs.ruby-lang.org/issues/12142>
	with many people, especially with Yura Sokolov.

	* st.c: improve st_table.

	* include/ruby/st.h: ditto.

	* internal.h, numeric.c, hash.c (rb_dbl_long_hash): extract a function.

	* ext/-test-/st/foreach/foreach.c: catch up this change.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-07 00:45:00 +00:00
nobu
4b7fd61a05 process.c: PATH env in spawn
* process.c (rb_exec_fillarg): honor the given path environment
  variable.  [ruby-core:53103] [Bug #8004]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-06 00:58:49 +00:00
nobu
dfe91fcd08 numeric.c: round to nearest even
* numeric.c (flo_round, int_round): support round-to-nearest-even
  semantics of IEEE 754 to match sprintf behavior, and add `half:`
  optional keyword argument for the old behavior.
  [ruby-core:76273] [Bug #12548]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05 09:49:39 +00:00
nobu
a2144bd72a chomp option
* io.c (extract_getline_opts): extract chomp option.
  [Feature #12553]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05 07:28:09 +00:00
nobu
9e75488ac8 internal.h: RB_OBJ_BUILTIN_TYPE
* internal.h (RB_OBJ_BUILTIN_TYPE): special-const safe
  BUILTIN_TYPE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-28 06:58:19 +00:00
nobu
4065c38a6a class.c: rb_undef_methods_from
* class.c (rb_undef_methods_from): undefine methods defined in
  super from klass.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-24 01:49:52 +00:00
usa
c2dd2d268e * internal.h (ST2FIX): new macro to convert st_index_t to Fixnum.
a hash value of Object might be Bignum, but it causes many troubles
  expecially the Object is used as a key of a hash.  so I've gave up
  to do so.

* array.c (rb_ary_hash): use above macro.

* bignum.c (rb_big_hash): ditto.

* hash.c (rb_obj_hash, rb_hash_hash): ditto.

* numeric.c (rb_dbl_hash): ditto.

* proc.c (proc_hash): ditto.

* re.c (rb_reg_hash, match_hash): ditto.

* string.c (rb_str_hash_m): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-04 16:25:01 +00:00
ngoto
16391af2e2 * internal.h (MAYBE_UNUSED): The fallback definition is needed.
Fix compile error with some non-GCC compilers such as
  Oracle Solaris Studio 12.3 on Solaris 10.
  [Bug #12767] [ruby-dev:49807]

* internal.h (WARN_UNUSED_RESULT): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-16 12:29:42 +00:00
shyouhei
2fc5210f31 * internal.h (WARN_UNUSED_RESULT): moved to configure.in, to
actually check its availability rather to check GCC's version.

	* configure.in (WARN_UNUSED_RESULT): moved to here.

	* configure.in (RUBY_FUNC_ATTRIBUTE): change function declaration
	  to return int rather than void, because it makes no sense for a
	  warn_unused_result attributed function to return void.

	  Funny thing however is that it also makes no sense for noreturn
	  attributed function to return int.  So there is a fundamental
	  conflict between them.  While I tested this, I confirmed both
	  GCC 6 and Clang 3.8 prefers int over void to correctly detect
	  necessary attributes under this setup.  Maybe subject to change
	  in future.

	* internal.h (UNINITIALIZED_VAR): renamed to MAYBE_UNUSED, then
	  moved to configure.in for the same reason we move
	  WARN_UNUSED_RESULT.

	* configure.in (MAYBE_UNUSED): moved to here.

	* internal.h (__has_attribute): deleted, because it has no use now.

	* string.c (rb_str_enumerate_lines): refactor macro rename.

	* string.c (rb_str_enumerate_bytes): ditto.

	* string.c (rb_str_enumerate_chars): ditto.

	* string.c (rb_str_enumerate_codepoints): ditto.

	* thread.c (do_select): ditto.

	* vm_backtrace.c (rb_debug_inspector_open): ditto.

	* vsnprintf.c (BSD_vfprintf): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-16 06:15:55 +00:00
nobu
e6a260ecdb variable.c: rb_deprecate_constant
* variable.c (rb_deprecate_constant): new function to deprecate a
  constant by the name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-09 03:02:22 +00:00
nobu
7615362d64 internal.h: fix typos
* internal.h (MEMO_V1_SET, MEMO_V2_SET): fix typos.  use the macro
  parameter, not the local variable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-02 07:07:01 +00:00
nobu
6a6a4126d4 internal.h: fix r55831
* internal.h (RBASIC_CLEAR_CLASS): fix compile error and size to
  fill.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-08 05:11:51 +00:00
shyouhei
869e7809a3 * internal.h (RBASIC_CLEAR_CLASS): Reroute ANSI C's strict
aliasing rule.
  	  [ruby-core:74427][Bug #12191][ruby-core:76747][Bug #12657]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-08 04:19:58 +00:00
shyouhei
26f59b09fe hide struct internal [Feature #9916]
* include/ruby/ruby.h (struct RStruct): no longer.

	* internal.h (struct RStruct): moved here.

	* struct.c (rb_struct_ptr): a compensation function for the lack
	  of RSTRUCT_PTR.  But now that we have RSTRUCT_GET/SET, that must
	  not be used anyway.  I mark this deprecated.  Dont use it.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-01 07:23:56 +00:00
ko1
e06698d257 * vm.c, internal.h: remove RubyVM::Env class and all of env objects
are imemo objects (imemo_env).

* NEWS: describe this change. I believe nobody touch these objects
  because there are no method defined.

* vm_core.h: remove the following definitions.
  * rb_cEnv decl.
  * GetEnvPtr() because Env is no longer T_DATA object.

* vm_core.h (rb_env_t): fix layout for imemo values.

* vm_core.h (vm_assert_env): added.

* vm_core.h (vm_env_new): added.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-28 19:13:26 +00:00
ko1
9f60791a04 * vm_core.h: revisit the structure of frame, block and env.
[Bug #12628]

  This patch introduce many changes.

  * Introduce concept of "Block Handler (BH)" to represent
    passed blocks.

  * move rb_control_frame_t::flag to ep[0] (as a special local
    variable). This flags represents not only frame type, but also
    env flags such as escaped.

  * rename `rb_block_t` to `struct rb_block`.

  * Make Proc, Binding and RubyVM::Env objects wb-protected.

  Check [Bug #12628] for more details.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-28 11:02:30 +00:00
nobu
9662ee0584 internal.h: inline Check_Type
* internal.h (Check_Type): inline check for the object type.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-23 13:43:44 +00:00