Author: faridz Date: Fri Mar 7 08:16:56 2008 New Revision: 634728 URL: http://svn.apache.org/viewvc?rev=634728&view=rev Log: 2008-03-07 Farid Zaripov * etc/config/src/nodbg.h: New header file with definition of the nodbg() to prevent GUI popups on Windows. * etc/config/src/DYNAMIC_CAST.cpp: Removed invoking of the _CrtSetReportMode(), using nodbg() instead. * etc/config/src/GLOBAL_BAD_ALLOC.cpp: Ditto. * etc/config/src/STD_BAD_ALLOC.cpp: Ditto. * etc/config/src/THREAD_SAFE_EXCEPTIONS.cpp: Ditto. * etc/config/src/NO_DBL_TRAPS.cpp: Invoke nodbg() before test to prevent the Dr.Watson popups (was detected on Borland Turbo C++). Added: stdcxx/trunk/etc/config/src/nodbg.h (with props) Modified: stdcxx/trunk/etc/config/src/DYNAMIC_CAST.cpp stdcxx/trunk/etc/config/src/GLOBAL_BAD_ALLOC.cpp stdcxx/trunk/etc/config/src/NO_DBL_TRAPS.cpp stdcxx/trunk/etc/config/src/STD_BAD_ALLOC.cpp stdcxx/trunk/etc/config/src/THREAD_SAFE_EXCEPTIONS.cpp Modified: stdcxx/trunk/etc/config/src/DYNAMIC_CAST.cpp URL: http://svn.apache.org/viewvc/stdcxx/trunk/etc/config/src/DYNAMIC_CAST.cpp?rev=634728&r1=634727&r2=634728&view=diff ============================================================================== --- stdcxx/trunk/etc/config/src/DYNAMIC_CAST.cpp (original) +++ stdcxx/trunk/etc/config/src/DYNAMIC_CAST.cpp Fri Mar 7 08:16:56 2008 @@ -23,10 +23,7 @@ **************************************************************************/ #include "config.h" - -#if (defined (_WIN32) || defined (_WIN64)) && !defined (__CYGWIN__) -# include -#endif // _WIN{32,64} +#include "nodbg.h" #ifndef _RWSTD_NO_HONOR_STD @@ -47,14 +44,7 @@ int main () { -#if (defined (_WIN32) || defined (_WIN64)) && !defined (__CYGWIN__) - - // prevent the Microsoft C library from popping up GUI windows - _CrtSetReportMode (_CRT_WARN, _CRTDBG_MODE_DEBUG); - _CrtSetReportMode (_CRT_ERROR, _CRTDBG_MODE_DEBUG); - _CrtSetReportMode (_CRT_ASSERT, _CRTDBG_MODE_DEBUG); - -#endif // _WIN{32,64} + nodbg (); B b; Modified: stdcxx/trunk/etc/config/src/GLOBAL_BAD_ALLOC.cpp URL: http://svn.apache.org/viewvc/stdcxx/trunk/etc/config/src/GLOBAL_BAD_ALLOC.cpp?rev=634728&r1=634727&r2=634728&view=diff ============================================================================== --- stdcxx/trunk/etc/config/src/GLOBAL_BAD_ALLOC.cpp (original) +++ stdcxx/trunk/etc/config/src/GLOBAL_BAD_ALLOC.cpp Fri Mar 7 08:16:56 2008 @@ -23,6 +23,7 @@ **************************************************************************/ #include "config.h" +#include "nodbg.h" #if !defined (_RWSTD_NO_NEW_THROWS) && !defined (_RWSTD_NO_NEW_OFLOW_SAFE) # include // for size_t @@ -45,29 +46,11 @@ struct bad_alloc { }; -#if defined (_MSC_VER) - -#include // for _CrtSetReportMode() - -void disable_msc_gui () -{ - _CrtSetReportMode (_CRT_WARN, _CRTDBG_MODE_FILE); - _CrtSetReportMode (_CRT_ERROR, _CRTDBG_MODE_FILE); - _CrtSetReportMode (_CRT_ASSERT, _CRTDBG_MODE_FILE); -} - -#else // if !defined (_MSC_VER) - -void disable_msc_gui () { /* no-op */ } - -#endif // _MSC_VER - - int main () { // prevent MSVC's libc from popping up a dialog box // with an out-of-memory message - disable_msc_gui (); + nodbg (); try { Modified: stdcxx/trunk/etc/config/src/NO_DBL_TRAPS.cpp URL: http://svn.apache.org/viewvc/stdcxx/trunk/etc/config/src/NO_DBL_TRAPS.cpp?rev=634728&r1=634727&r2=634728&view=diff ============================================================================== --- stdcxx/trunk/etc/config/src/NO_DBL_TRAPS.cpp (original) +++ stdcxx/trunk/etc/config/src/NO_DBL_TRAPS.cpp Fri Mar 7 08:16:56 2008 @@ -37,11 +37,15 @@ * disables traps as required by C). */ +#include "nodbg.h" + double dbl_get_zero (); double dbl_get_one (); int main (int argc, char*[]) { + nodbg (); + double dbl_inf; double dbl_nan; Modified: stdcxx/trunk/etc/config/src/STD_BAD_ALLOC.cpp URL: http://svn.apache.org/viewvc/stdcxx/trunk/etc/config/src/STD_BAD_ALLOC.cpp?rev=634728&r1=634727&r2=634728&view=diff ============================================================================== --- stdcxx/trunk/etc/config/src/STD_BAD_ALLOC.cpp (original) +++ stdcxx/trunk/etc/config/src/STD_BAD_ALLOC.cpp Fri Mar 7 08:16:56 2008 @@ -23,6 +23,7 @@ **************************************************************************/ #include "config.h" +#include "nodbg.h" #if !defined (_RWSTD_NO_NEW_THROWS) && !defined (_RWSTD_NO_NEW_OFLOW_SAFE) # include // for size_t @@ -52,29 +53,11 @@ enum bad_alloc { }; -#if defined (_MSC_VER) - -#include // for _CrtSetReportMode() - -void disable_msc_gui () -{ - _CrtSetReportMode (_CRT_WARN, _CRTDBG_MODE_FILE); - _CrtSetReportMode (_CRT_ERROR, _CRTDBG_MODE_FILE); - _CrtSetReportMode (_CRT_ASSERT, _CRTDBG_MODE_FILE); -} - -#else // if !defined (_MSC_VER) - -void disable_msc_gui () { /* no-op */ } - -#endif // _MSC_VER - - int main () { // prevent MSVC's libc from popping up a dialog box // with an out-of-memory message - disable_msc_gui (); + nodbg (); try { Modified: stdcxx/trunk/etc/config/src/THREAD_SAFE_EXCEPTIONS.cpp URL: http://svn.apache.org/viewvc/stdcxx/trunk/etc/config/src/THREAD_SAFE_EXCEPTIONS.cpp?rev=634728&r1=634727&r2=634728&view=diff ============================================================================== --- stdcxx/trunk/etc/config/src/THREAD_SAFE_EXCEPTIONS.cpp (original) +++ stdcxx/trunk/etc/config/src/THREAD_SAFE_EXCEPTIONS.cpp Fri Mar 7 08:16:56 2008 @@ -23,6 +23,7 @@ **************************************************************************/ #include "thread.h" +#include "nodbg.h" extern "C" void* thread_proc (void *arg) @@ -51,12 +52,7 @@ int main () { -#if defined (_WIN32) - // disable displaying the critical-error-handler - // and general-protection-fault message boxes - // windows.h included in thread.h - SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX); -#endif // _WIN32 + nodbg (); pthread_t tid [2]; Added: stdcxx/trunk/etc/config/src/nodbg.h URL: http://svn.apache.org/viewvc/stdcxx/trunk/etc/config/src/nodbg.h?rev=634728&view=auto ============================================================================== --- stdcxx/trunk/etc/config/src/nodbg.h (added) +++ stdcxx/trunk/etc/config/src/nodbg.h Fri Mar 7 08:16:56 2008 @@ -0,0 +1,54 @@ +// definition of the nodbg() function + +/*************************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the License); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + * + * Copyright 1999-2008 Rogue Wave Software, Inc. + * + **************************************************************************/ + +#ifdef _WIN32 + +# include + +# ifdef _MSC_VER +# include // for _CrtSetReportMode() +# endif + +void nodbg () +{ +# ifdef _MSC_VER + // prevent the Microsoft C library from popping up GUI windows + // on various failures and direct error messages to the console + // instead + _CrtSetReportMode (_CRT_WARN, _CRTDBG_MODE_DEBUG); + _CrtSetReportMode (_CRT_ERROR, _CRTDBG_MODE_DEBUG); + _CrtSetReportMode (_CRT_ASSERT, _CRTDBG_MODE_DEBUG); +# endif + + // disable displaying the critical-error-handler + // and general-protection-fault message boxes + // windows.h included in thread.h + SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX); +} + +#else + +void nodbg () { } + +#endif // _WIN32 Propchange: stdcxx/trunk/etc/config/src/nodbg.h ------------------------------------------------------------------------------ svn:eol-style = native Propchange: stdcxx/trunk/etc/config/src/nodbg.h ------------------------------------------------------------------------------ svn:keywords = Id