* debug.c (set_debug_option): added rtc_error option.

* win32/Makefile.sub (CRTDEFFLAGS): separated from DEFS.

* win32/win32.c (rtc_error_handler): ignores RTC errors unless
  rtc_error debug option is given.

* win32/win32.c (rb_w32_sysinit): suppress useless CRT assertions.
  [ruby-core:22116]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-02-16 07:46:24 +00:00
Родитель 2b206be6ac
Коммит 1e5de389da
4 изменённых файлов: 40 добавлений и 8 удалений

Просмотреть файл

@ -1,7 +1,14 @@
Mon Feb 16 01:17:51 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
Mon Feb 16 16:46:14 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* win32/win32.c (_CrtDbgReportW): prevent from false positive
assertions in msvcrtd. [ruby-core:22116]
* debug.c (set_debug_option): added rtc_error option.
* win32/Makefile.sub (CRTDEFFLAGS): separated from DEFS.
* win32/win32.c (rtc_error_handler): ignores RTC errors unless
rtc_error debug option is given.
* win32/win32.c (rb_w32_sysinit): suppress useless CRT assertions.
[ruby-core:22116]
Sun Feb 15 21:43:44 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>

Просмотреть файл

@ -148,6 +148,9 @@ set_debug_option(const char *str, int len, void *arg)
} while (0)
SET_WHEN("gc_stress", *ruby_initial_gc_stress_ptr);
SET_WHEN("core", ruby_enable_coredump);
#if defined _WIN32 && defined _MSC_VER && _MSC_VER >= 1400
SET_WHEN("rtc_error", ruby_w32_rtc_error);
#endif
fprintf(stderr, "unexpected debug option: %.*s\n", len, str);
}

Просмотреть файл

@ -188,13 +188,13 @@ LDSHARED = $(LD) -LD
XCFLAGS = -DRUBY_EXPORT -I. -I$(arch_hdrdir) -I$(hdrdir) -I$(srcdir) -I$(srcdir)/missing $(XCFLAGS)
!if $(MSC_VER) >= 1400
# Prevents VC++ 2005 (cl ver 14) warnings
DEFS = -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
CRTDEFFLAGS = -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
MANIFESTTOOL = mt -nologo
LDSHARED_0 = @$(MINIRUBY) -run -e wait_writable -- -n 10 $@
LDSHARED_1 = $(MANIFESTTOOL) -manifest $(@).manifest -outputresource:$(@);2
LDSHARED_2 = @$(RM) $(@:/=\).manifest
!endif
CPPFLAGS = $(DEFS) $(ARCHDEFS) $(CPPFLAGS)
CPPFLAGS = $(CRTDEFFLAGS) $(DEFS) $(ARCHDEFS) $(CPPFLAGS)
DLDFLAGS = $(LDFLAGS) -dll
SOLIBS =

Просмотреть файл

@ -29,6 +29,9 @@
#include <share.h>
#include <shlobj.h>
#include <mbstring.h>
#if _MSC_VER >= 1400
#include <crtdbg.h>
#endif
#ifdef __MINGW32__
#include <mswsock.h>
#endif
@ -439,10 +442,29 @@ init_func(void)
static void init_stdhandle(void);
#if _MSC_VER >= 1400
static void invalid_parameter(const wchar_t *expr, const wchar_t *func, const wchar_t *file, unsigned int line, uintptr_t dummy)
static void
invalid_parameter(const wchar_t *expr, const wchar_t *func, const wchar_t *file, unsigned int line, uintptr_t dummy)
{
// nothing to do
}
int ruby_w32_rtc_error;
static int __cdecl
rtc_error_handler(int e, const char *src, int line, const char *exe, const char *fmt, ...)
{
va_list ap;
VALUE str;
if (!ruby_w32_rtc_error) return 0;
str = rb_sprintf("%s:%d: ", src, line);
va_start(ap, fmt);
rb_str_vcatf(str, fmt, ap);
va_end(ap);
rb_str_cat(str, "\n", 1);
rb_write_error2(RSTRING_PTR(str), RSTRING_LEN(str));
return 0;
}
#endif
static CRITICAL_SECTION select_mutex;
@ -496,7 +518,9 @@ rb_w32_sysinit(int *argc, char ***argv)
#if _MSC_VER >= 1400
static void set_pioinfo_extra(void);
_CrtSetReportMode(_CRT_ASSERT, 0);
_set_invalid_parameter_handler(invalid_parameter);
_RTC_SetErrorFunc(rtc_error_handler);
set_pioinfo_extra();
#endif
@ -4873,5 +4897,3 @@ rb_w32_fsopen(const char *path, const char *mode, int shflags)
return f;
}
#endif
RUBY_EXTERN int __cdecl _CrtDbgReportW() {return 0;}