From f3749f8128479152c299edcc2bbdc1e454b657af Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Sat, 4 Dec 2004 01:49:50 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=4756 --- checkin_notes | 7 +++++++ lib/diagnostics.C | 27 ++++++++++++++++++++++++--- lib/diagnostics.h | 46 +++++++++++++++++++++------------------------- 3 files changed, 52 insertions(+), 28 deletions(-) diff --git a/checkin_notes b/checkin_notes index 0c208c8d35..be1c54b0ca 100755 --- a/checkin_notes +++ b/checkin_notes @@ -20668,3 +20668,10 @@ Bruce 3 Dec 2004 (Thanks Reinhard!!) Makefile.am diagnostics.h filesys.h + +Rom 3 Dec 2004 + - Fix build break on Windows where VC didn't like a C prototyped function + possibly throwing a C++ exception. + + lib/ + diagnostics.C, .h diff --git a/lib/diagnostics.C b/lib/diagnostics.C index 3ad12316e5..a09d5ee58f 100644 --- a/lib/diagnostics.C +++ b/lib/diagnostics.C @@ -79,28 +79,45 @@ int boinc_init_diagnostics(int _flags) { if (flags & BOINC_DIAG_REDIRECTSTDERR ) { lpRetVal = (void*) freopen(BOINC_DIAG_STDERR, "a", stderr); if ( NULL == lpRetVal ) { +#ifdef __cplusplus BOINCFILEERROR("Failed to reopen stderr for diagnostics redirection" ); +#else + return ERR_FOPEN; +#endif } } if (flags & BOINC_DIAG_REDIRECTSTDERROVERWRITE ) { lpRetVal = (void*) freopen(BOINC_DIAG_STDERR, "w", stderr); if ( NULL == lpRetVal ) { +#ifdef __cplusplus BOINCFILEERROR("Failed to reopen stderr for diagnostics redirection (overwrite)" ); +#else + return ERR_FOPEN; +#endif } } if (flags & BOINC_DIAG_REDIRECTSTDOUT ) { lpRetVal = (void*) freopen(BOINC_DIAG_STDOUT, "a", stdout); if ( NULL == lpRetVal ) { +#ifdef __cplusplus BOINCFILEERROR( "Failed to reopen stdout for diagnostics redirection" ); +#else + return ERR_FOPEN; +#endif } } if (flags & BOINC_DIAG_REDIRECTSTDOUTOVERWRITE ) { lpRetVal = (void*) freopen(BOINC_DIAG_STDOUT, "w", stdout); - if ( NULL == lpRetVal ) + if ( NULL == lpRetVal ) { +#ifdef __cplusplus BOINCFILEERROR( "Failed to reopen stdout for diagnostics redirection (overwrite)" ); +#else + return ERR_FOPEN; +#endif + } } @@ -135,9 +152,13 @@ int boinc_init_diagnostics(int _flags) { // Install unhandled exception filters and signal traps. - if ( BOINC_SUCCESS != boinc_install_signal_handlers() ) + if ( BOINC_SUCCESS != boinc_install_signal_handlers() ) { +#ifdef __cplusplus BOINCSIGNALERROR( "Failed to install signal handlers" ); - +#else + return ERR_SIGNAL_OP; +#endif + } return BOINC_SUCCESS; } diff --git a/lib/diagnostics.h b/lib/diagnostics.h index a2828e6a3e..7ff6619c0e 100644 --- a/lib/diagnostics.h +++ b/lib/diagnostics.h @@ -24,31 +24,6 @@ #include -/*---------------------------------------------------------------------- - * pure ANSI C API follows here - */ -#ifndef BOINCASSERT -#define BOINCASSERT assert -#endif - -#ifndef BOINCTRACE -#define BOINCTRACE __noop -#endif - -#ifndef BOINCINFO -#define BOINCINFO __noop -#endif - -#ifdef __cplusplus -extern "C" { -#endif -extern int boinc_init_diagnostics(int flags); -extern int boinc_finish_diag(void); -extern int boinc_install_signal_handlers(void); -#ifdef __cplusplus -} /* extern "C" */ -#endif - // flags for boinc_init_diagnostics() // #define BOINC_DIAG_DUMPCALLSTACKENABLED 0x00000001L @@ -155,4 +130,25 @@ extern void boinc_set_signal_handler(int sig, void(*handler)(int)); extern void boinc_set_signal_handler_force(int sig, void(*handler)(int)); #endif // ! _WIN32 + +/*---------------------------------------------------------------------- + * pure ANSI C API follows here + */ +#ifndef BOINCASSERT +#define BOINCASSERT assert +#endif + +#ifndef BOINCTRACE +#define BOINCTRACE __noop +#endif + +#ifndef BOINCINFO +#define BOINCINFO __noop +#endif + +extern int boinc_init_diagnostics(int flags); +extern int boinc_finish_diag(void); +extern int boinc_install_signal_handlers(void); + + #endif /* double-inclusion protection */