зеркало из https://github.com/github/ruby.git
Suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
c558195999
Коммит
131f694330
|
@ -147,14 +147,14 @@ if defined? GDBM
|
||||||
def test_s_open_lock
|
def test_s_open_lock
|
||||||
return unless have_fork? # snip this test
|
return unless have_fork? # snip this test
|
||||||
pid = fork() {
|
pid = fork() {
|
||||||
assert_instance_of(GDBM, gdbm = GDBM.open("#{@tmpdir}/#{@prefix}", 0644))
|
assert_instance_of(GDBM, GDBM.open("#{@tmpdir}/#{@prefix}", 0644))
|
||||||
sleep 2
|
sleep 2
|
||||||
}
|
}
|
||||||
begin
|
begin
|
||||||
sleep 1
|
sleep 1
|
||||||
assert_raise(Errno::EWOULDBLOCK) {
|
assert_raise(Errno::EWOULDBLOCK) {
|
||||||
begin
|
begin
|
||||||
assert_instance_of(GDBM, gdbm2 = GDBM.open("#{@tmpdir}/#{@prefix}", 0644))
|
assert_instance_of(GDBM, GDBM.open("#{@tmpdir}/#{@prefix}", 0644))
|
||||||
rescue Errno::EAGAIN, Errno::EACCES
|
rescue Errno::EAGAIN, Errno::EACCES
|
||||||
raise Errno::EWOULDBLOCK
|
raise Errno::EWOULDBLOCK
|
||||||
end
|
end
|
||||||
|
@ -187,7 +187,7 @@ if defined? GDBM
|
||||||
return unless have_fork? # snip this test
|
return unless have_fork? # snip this test
|
||||||
|
|
||||||
pid = fork() {
|
pid = fork() {
|
||||||
assert_instance_of(GDBM, gdbm = GDBM.open("#{@tmpdir}/#{@prefix}", 0644,
|
assert_instance_of(GDBM, GDBM.open("#{@tmpdir}/#{@prefix}", 0644,
|
||||||
GDBM::NOLOCK))
|
GDBM::NOLOCK))
|
||||||
sleep 2
|
sleep 2
|
||||||
}
|
}
|
||||||
|
@ -202,10 +202,10 @@ if defined? GDBM
|
||||||
gdbm2.close if gdbm2
|
gdbm2.close if gdbm2
|
||||||
end
|
end
|
||||||
|
|
||||||
p Dir.glob("#{@tmpdir}/#{@prefix}*") if $DEBUG
|
STDERR.puts Dir.glob("#{@tmpdir}/#{@prefix}*") if $DEBUG
|
||||||
|
|
||||||
pid = fork() {
|
pid = fork() {
|
||||||
assert_instance_of(GDBM, gdbm = GDBM.open("#{@tmpdir}/#{@prefix}", 0644))
|
assert_instance_of(GDBM, GDBM.open("#{@tmpdir}/#{@prefix}", 0644))
|
||||||
sleep 2
|
sleep 2
|
||||||
}
|
}
|
||||||
begin
|
begin
|
||||||
|
|
|
@ -44,9 +44,9 @@ class TestEncodingConverter < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_asciicompat_encoding_iso2022jp
|
def test_asciicompat_encoding_iso2022jp
|
||||||
acenc = Encoding::Converter.asciicompat_encoding("ISO-2022-JP")
|
acenc = Encoding::Converter.asciicompat_encoding("ISO-2022-JP")
|
||||||
str = "\e$B~~\(B".force_encoding("iso-2022-jp")
|
str = "\e$B~~\e(B".force_encoding("iso-2022-jp")
|
||||||
str2 = str.encode(acenc)
|
str2 = str.encode(acenc)
|
||||||
str3 = str.encode("ISO-2022-JP")
|
str3 = str2.encode("ISO-2022-JP")
|
||||||
assert_equal(str, str3)
|
assert_equal(str, str3)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ class TestEncodingConverter < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_nil_source_buffer
|
def test_nil_source_buffer
|
||||||
ec = Encoding::Converter.new("UTF-8", "EUC-JP")
|
ec = Encoding::Converter.new("UTF-8", "EUC-JP")
|
||||||
ret = ec.primitive_convert(nil, dst="", nil, 10)
|
ret = ec.primitive_convert(nil, "", nil, 10)
|
||||||
assert_equal(:finished, ret)
|
assert_equal(:finished, ret)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -475,44 +475,44 @@ class TestEncodingConverter < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_errinfo_invalid_euc_jp
|
def test_errinfo_invalid_euc_jp
|
||||||
ec = Encoding::Converter.new("EUC-JP", "Shift_JIS")
|
ec = Encoding::Converter.new("EUC-JP", "Shift_JIS")
|
||||||
ec.primitive_convert(src="\xff", dst="", nil, 10)
|
ec.primitive_convert("\xff", "", nil, 10)
|
||||||
assert_errinfo(:invalid_byte_sequence, "EUC-JP", "Shift_JIS", "\xFF", "", ec)
|
assert_errinfo(:invalid_byte_sequence, "EUC-JP", "Shift_JIS", "\xFF", "", ec)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_errinfo_invalid_euc_jp2
|
def test_errinfo_invalid_euc_jp2
|
||||||
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
|
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
|
||||||
ec.primitive_convert(src="\xff", dst="", nil, 10)
|
ec.primitive_convert("\xff", "", nil, 10)
|
||||||
assert_errinfo(:invalid_byte_sequence, "EUC-JP", "UTF-8", "\xFF", "", ec)
|
assert_errinfo(:invalid_byte_sequence, "EUC-JP", "UTF-8", "\xFF", "", ec)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_errinfo_undefined_hiragana
|
def test_errinfo_undefined_hiragana
|
||||||
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
|
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
|
||||||
ec.primitive_convert(src="\xa4\xa2", dst="", nil, 10)
|
ec.primitive_convert("\xa4\xa2", "", nil, 10)
|
||||||
assert_errinfo(:undefined_conversion, "UTF-8", "ISO-8859-1", "\xE3\x81\x82", "", ec)
|
assert_errinfo(:undefined_conversion, "UTF-8", "ISO-8859-1", "\xE3\x81\x82", "", ec)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_errinfo_invalid_partial_character
|
def test_errinfo_invalid_partial_character
|
||||||
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
|
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
|
||||||
ec.primitive_convert(src="\xa4", dst="", nil, 10)
|
ec.primitive_convert("\xa4", "", nil, 10)
|
||||||
assert_errinfo(:incomplete_input, "EUC-JP", "UTF-8", "\xA4", "", ec)
|
assert_errinfo(:incomplete_input, "EUC-JP", "UTF-8", "\xA4", "", ec)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_errinfo_valid_partial_character
|
def test_errinfo_valid_partial_character
|
||||||
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
|
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
|
||||||
ec.primitive_convert(src="\xa4", dst="", nil, 10, :partial_input=>true)
|
ec.primitive_convert("\xa4", "", nil, 10, :partial_input=>true)
|
||||||
assert_errinfo(:source_buffer_empty, nil, nil, nil, nil, ec)
|
assert_errinfo(:source_buffer_empty, nil, nil, nil, nil, ec)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_errinfo_invalid_utf16be
|
def test_errinfo_invalid_utf16be
|
||||||
ec = Encoding::Converter.new("UTF-16BE", "UTF-8")
|
ec = Encoding::Converter.new("UTF-16BE", "UTF-8")
|
||||||
ec.primitive_convert(src="\xd8\x00\x00@", dst="", nil, 10)
|
ec.primitive_convert(src="\xd8\x00\x00@", "", nil, 10)
|
||||||
assert_errinfo(:invalid_byte_sequence, "UTF-16BE", "UTF-8", "\xD8\x00", "\x00", ec)
|
assert_errinfo(:invalid_byte_sequence, "UTF-16BE", "UTF-8", "\xD8\x00", "\x00", ec)
|
||||||
assert_equal("@", src)
|
assert_equal("@", src)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_errinfo_invalid_utf16le
|
def test_errinfo_invalid_utf16le
|
||||||
ec = Encoding::Converter.new("UTF-16LE", "UTF-8")
|
ec = Encoding::Converter.new("UTF-16LE", "UTF-8")
|
||||||
ec.primitive_convert(src="\x00\xd8@\x00", dst="", nil, 10)
|
ec.primitive_convert(src="\x00\xd8@\x00", "", nil, 10)
|
||||||
assert_errinfo(:invalid_byte_sequence, "UTF-16LE", "UTF-8", "\x00\xD8", "@\x00", ec)
|
assert_errinfo(:invalid_byte_sequence, "UTF-16LE", "UTF-8", "\x00\xD8", "@\x00", ec)
|
||||||
assert_equal("", src)
|
assert_equal("", src)
|
||||||
end
|
end
|
||||||
|
@ -599,7 +599,7 @@ class TestEncodingConverter < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_putback2
|
def test_putback2
|
||||||
ec = Encoding::Converter.new("utf-16le", "euc-jp")
|
ec = Encoding::Converter.new("utf-16le", "euc-jp")
|
||||||
ret = ec.primitive_convert(src="\x00\xd8\x21\x00", dst="", nil, nil)
|
ret = ec.primitive_convert("\x00\xd8\x21\x00", "", nil, nil)
|
||||||
assert_equal(:invalid_byte_sequence, ret)
|
assert_equal(:invalid_byte_sequence, ret)
|
||||||
assert_equal("\x00".force_encoding("utf-16le"), ec.putback(1))
|
assert_equal("\x00".force_encoding("utf-16le"), ec.putback(1))
|
||||||
assert_equal("\x21".force_encoding("utf-16le"), ec.putback(1))
|
assert_equal("\x21".force_encoding("utf-16le"), ec.putback(1))
|
||||||
|
@ -705,20 +705,20 @@ class TestEncodingConverter < Test::Unit::TestCase
|
||||||
def test_last_error1
|
def test_last_error1
|
||||||
ec = Encoding::Converter.new("sjis", "euc-jp")
|
ec = Encoding::Converter.new("sjis", "euc-jp")
|
||||||
assert_equal(nil, ec.last_error)
|
assert_equal(nil, ec.last_error)
|
||||||
assert_equal(:incomplete_input, ec.primitive_convert(src="fo\x81", dst="", nil, nil))
|
assert_equal(:incomplete_input, ec.primitive_convert("fo\x81", "", nil, nil))
|
||||||
assert_kind_of(Encoding::InvalidByteSequenceError, ec.last_error)
|
assert_kind_of(Encoding::InvalidByteSequenceError, ec.last_error)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_last_error2
|
def test_last_error2
|
||||||
ec = Encoding::Converter.new("sjis", "euc-jp")
|
ec = Encoding::Converter.new("sjis", "euc-jp")
|
||||||
assert_equal("fo", ec.convert(src="fo\x81"))
|
assert_equal("fo", ec.convert("fo\x81"))
|
||||||
assert_raise(Encoding::InvalidByteSequenceError) { ec.finish }
|
assert_raise(Encoding::InvalidByteSequenceError) { ec.finish }
|
||||||
assert_kind_of(Encoding::InvalidByteSequenceError, ec.last_error)
|
assert_kind_of(Encoding::InvalidByteSequenceError, ec.last_error)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_us_ascii
|
def test_us_ascii
|
||||||
ec = Encoding::Converter.new("UTF-8", "US-ASCII")
|
ec = Encoding::Converter.new("UTF-8", "US-ASCII")
|
||||||
ec.primitive_convert(src="\u{3042}", dst="")
|
ec.primitive_convert("\u{3042}", "")
|
||||||
err = ec.last_error
|
err = ec.last_error
|
||||||
assert_kind_of(Encoding::UndefinedConversionError, err)
|
assert_kind_of(Encoding::UndefinedConversionError, err)
|
||||||
assert_equal("\u{3042}", err.error_char)
|
assert_equal("\u{3042}", err.error_char)
|
||||||
|
@ -726,7 +726,7 @@ class TestEncodingConverter < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_88591
|
def test_88591
|
||||||
ec = Encoding::Converter.new("UTF-8", "ISO-8859-1")
|
ec = Encoding::Converter.new("UTF-8", "ISO-8859-1")
|
||||||
ec.primitive_convert(src="\u{3042}", dst="")
|
ec.primitive_convert("\u{3042}", "")
|
||||||
err = ec.last_error
|
err = ec.last_error
|
||||||
assert_kind_of(Encoding::UndefinedConversionError, err)
|
assert_kind_of(Encoding::UndefinedConversionError, err)
|
||||||
assert_equal("\u{3042}", err.error_char)
|
assert_equal("\u{3042}", err.error_char)
|
||||||
|
|
|
@ -87,7 +87,13 @@ end
|
||||||
f << 'raise LoadError'
|
f << 'raise LoadError'
|
||||||
}
|
}
|
||||||
$LOAD_PATH.unshift(dir)
|
$LOAD_PATH.unshift(dir)
|
||||||
require 'securerandom'
|
v = $VERBOSE
|
||||||
|
begin
|
||||||
|
$VERBOSE = false
|
||||||
|
require 'securerandom'
|
||||||
|
ensure
|
||||||
|
$VERBOSE = v
|
||||||
|
end
|
||||||
test_s_random_bytes
|
test_s_random_bytes
|
||||||
end
|
end
|
||||||
ensure
|
ensure
|
||||||
|
|
|
@ -75,7 +75,7 @@ class Prelude
|
||||||
end
|
end
|
||||||
|
|
||||||
def emit(outfile)
|
def emit(outfile)
|
||||||
init_name = outfile[/\w+(?=_prelude.c\b)/] || 'prelude'
|
@init_name = outfile[/\w+(?=_prelude.c\b)/] || 'prelude'
|
||||||
erb = ERB.new(<<'EOS', nil, '%')
|
erb = ERB.new(<<'EOS', nil, '%')
|
||||||
/* -*-c-*-
|
/* -*-c-*-
|
||||||
THIS FILE WAS AUTOGENERATED BY tool/compile_prelude.rb. DO NOT EDIT.
|
THIS FILE WAS AUTOGENERATED BY tool/compile_prelude.rb. DO NOT EDIT.
|
||||||
|
@ -152,7 +152,7 @@ prelude_require(VALUE self, VALUE nth)
|
||||||
|
|
||||||
% end
|
% end
|
||||||
void
|
void
|
||||||
Init_<%=init_name%>(void)
|
Init_<%=@init_name%>(void)
|
||||||
{
|
{
|
||||||
% if @have_sublib or @need_ruby_prefix
|
% if @have_sublib or @need_ruby_prefix
|
||||||
struct prelude_env memo;
|
struct prelude_env memo;
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
#if VMDEBUG > 0
|
#if VMDEBUG > 0
|
||||||
#define DECL_SC_REG(type, r, reg) register type reg_##r
|
#define DECL_SC_REG(type, r, reg) register type reg_##r
|
||||||
|
|
||||||
#elif __GNUC__ && __x86_64__
|
#elif defined(__GNUC__) && defined(_x86_64__)
|
||||||
#define DECL_SC_REG(type, r, reg) register type reg_##r __asm__("r" reg)
|
#define DECL_SC_REG(type, r, reg) register type reg_##r __asm__("r" reg)
|
||||||
|
|
||||||
#elif __GNUC__ && __i386__
|
#elif defined(__GNUC__) && defined(__i386__)
|
||||||
#define DECL_SC_REG(type, r, reg) register type reg_##r __asm__("e" reg)
|
#define DECL_SC_REG(type, r, reg) register type reg_##r __asm__("e" reg)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -41,12 +41,12 @@ vm_exec_core(rb_thread_t *th, VALUE initial)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __GNUC__ && __i386__
|
#if defined(__GNUC__) && defined(__i386__)
|
||||||
DECL_SC_REG(VALUE *, pc, "di");
|
DECL_SC_REG(VALUE *, pc, "di");
|
||||||
DECL_SC_REG(rb_control_frame_t *, cfp, "si");
|
DECL_SC_REG(rb_control_frame_t *, cfp, "si");
|
||||||
#define USE_MACHINE_REGS 1
|
#define USE_MACHINE_REGS 1
|
||||||
|
|
||||||
#elif __GNUC__ && __x86_64__
|
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||||
DECL_SC_REG(VALUE *, pc, "14");
|
DECL_SC_REG(VALUE *, pc, "14");
|
||||||
DECL_SC_REG(rb_control_frame_t *, cfp, "15");
|
DECL_SC_REG(rb_control_frame_t *, cfp, "15");
|
||||||
#define USE_MACHINE_REGS 1
|
#define USE_MACHINE_REGS 1
|
||||||
|
|
|
@ -60,7 +60,7 @@ typedef rb_iseq_t *ISEQ;
|
||||||
/* #define throwdebug printf */
|
/* #define throwdebug printf */
|
||||||
|
|
||||||
/************************************************/
|
/************************************************/
|
||||||
#if DISPATCH_XXX
|
#if defined(DISPATCH_XXX)
|
||||||
error !
|
error !
|
||||||
/************************************************/
|
/************************************************/
|
||||||
#elif OPT_CALL_THREADED_CODE
|
#elif OPT_CALL_THREADED_CODE
|
||||||
|
@ -95,7 +95,7 @@ error !
|
||||||
INSN_ENTRY_SIG(insn); \
|
INSN_ENTRY_SIG(insn); \
|
||||||
|
|
||||||
/* dispather */
|
/* dispather */
|
||||||
#if __GNUC__ && (__i386__ || __x86_64__) && __GNUC__ == 3
|
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) && __GNUC__ == 3
|
||||||
#define DISPATCH_ARCH_DEPEND_WAY(addr) \
|
#define DISPATCH_ARCH_DEPEND_WAY(addr) \
|
||||||
asm volatile("jmp *%0;\t# -- inseted by vm.h\t[length = 2]" : : "r" (addr))
|
asm volatile("jmp *%0;\t# -- inseted by vm.h\t[length = 2]" : : "r" (addr))
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче