diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-16 07:46:24 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-16 07:46:24 +0000 |
commit | 61d1cf72ca6f908833e44112a85a04198cb5133a (patch) | |
tree | ec9bc4c285484063cbca3c05d7f3a1cc0df1141d /win32 | |
parent | cb57fbba23facd6c3968b9b9284a6169d71e9dfd (diff) | |
download | ruby-61d1cf72ca6f908833e44112a85a04198cb5133a.tar.gz ruby-61d1cf72ca6f908833e44112a85a04198cb5133a.tar.xz ruby-61d1cf72ca6f908833e44112a85a04198cb5133a.zip |
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@22337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r-- | win32/Makefile.sub | 4 | ||||
-rw-r--r-- | win32/win32.c | 28 |
2 files changed, 27 insertions, 5 deletions
diff --git a/win32/Makefile.sub b/win32/Makefile.sub index 2f200a842..765951be8 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -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 = diff --git a/win32/win32.c b/win32/win32.c index ead75f37d..3bd857253 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -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;} |