Author: vitek Date: Wed Mar 26 15:10:43 2008 New Revision: 641598 URL: http://svn.apache.org/viewvc?rev=641598&view=rev Log: 2008-03-26 Travis Vitek * tests/src/driver.cpp (rw_enable): Return previous state for the diagnostic so it can be safely disabled and restored. * tests/include/driver.h (rw_enable): Ditto. Update comments. Modified: stdcxx/trunk/tests/include/driver.h stdcxx/trunk/tests/src/driver.cpp Modified: stdcxx/trunk/tests/include/driver.h URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/include/driver.h?rev=641598&r1=641597&r2=641598&view=diff ============================================================================== --- stdcxx/trunk/tests/include/driver.h (original) +++ stdcxx/trunk/tests/include/driver.h Wed Mar 26 15:10:43 2008 @@ -159,13 +159,21 @@ rw_info (int, const char*, int, const char*, ...); /** -* Enable/disable the specified diagnostics -* -* Example: -* rw_enable (rw_error, false); // disable all rw_error diagnostics -* rw_enable (rw_error); // enable all rw_error diagnostics -*/ -_TEST_EXPORT void -rw_enable (int (*) (int, const char*, int, const char*, ...), bool = true); + * Enable/disable the specified diagnostic. + * + * @param fun Diagnostic function to enable or disable. Must be one of + * rw_fatal, rw_error, rw_assert, rw_warn, rw_note or rw_info. + * @param enable Flag to indicate that the diagnostic function should + * be enabled or disabled. + * @return Returns the previous state of the diagnostic. If the first + * parameter is not an acceptable input, will return false. + * + * Example: + * rw_enable (rw_error, false); // disable all rw_error diagnostics + * rw_enable (rw_error); // enable all rw_error diagnostics + */ +_TEST_EXPORT bool +rw_enable (int (*fun) (int, const char*, int, const char*, ...), + bool enable = true); #endif // RW_DRIVER_H_INCLUDED Modified: stdcxx/trunk/tests/src/driver.cpp URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/src/driver.cpp?rev=641598&r1=641597&r2=641598&view=diff ============================================================================== --- stdcxx/trunk/tests/src/driver.cpp (original) +++ stdcxx/trunk/tests/src/driver.cpp Wed Mar 26 15:10:43 2008 @@ -1540,7 +1540,7 @@ /************************************************************************/ -_TEST_EXPORT void +_TEST_EXPORT bool rw_enable (int (*fun) (int, const char*, int, const char*, ...), bool enable) { diag_t diag; @@ -1559,12 +1559,16 @@ diag = diag_info; else { RW_ASSERT (!"Invalid function in rw_enable"); - return; + return false; } + const bool enabled = 0 != (_rw_diag_ignore & (1 << diag)); + // if (enable) // _rw_diag_ignore &= ~(1 << diag); // else // _rw_diag_ignore |= 1 << diag; _rw_diag_ignore ^= ((enable - 1) ^ _rw_diag_ignore) & (1 << diag); + + return enabled; }