The Windows "config.h" has macros for the throw keyword but there not used everywhere consistently. This patch partially addresses that.
I'd like feedback on testing required before committing to CVS. Index: include/cc++/exception.h =================================================================== RCS file: /cvsroot/gnutelephony/testing/commoncpp2/include/cc++/exception.h,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 exception.h --- include/cc++/exception.h 23 Apr 2005 22:08:06 -0000 1.1.1.1 +++ include/cc++/exception.h 29 Aug 2005 05:09:40 -0000 @@ -77,10 +77,10 @@ private: String _what; public: - Exception(const String& what_arg) throw(); - virtual ~Exception() throw(); + Exception(const String& what_arg) THROWS_EMPTY; + virtual ~Exception() THROWS_EMPTY; virtual const char *getString() const; - virtual const char *what() const throw(); + virtual const char *what() const THROWS_EMPTY; }; /** @@ -96,11 +96,11 @@ private: mutable char* _systemErrorString; public: - IOException(const String &what_arg, long systemError = 0) throw(); - virtual ~IOException() throw(); + IOException(const String &what_arg, long systemError = 0) THROWS_EMPTY; + virtual ~IOException() THROWS_EMPTY; - virtual long getSystemError() const throw(); - virtual const char* getSystemErrorString() const throw(); + virtual long getSystemError() const THROWS_EMPTY; + virtual const char* getSystemErrorString() const THROWS_EMPTY; }; /** Index: include/cc++/file.h =================================================================== RCS file: /cvsroot/gnutelephony/testing/commoncpp2/include/cc++/file.h,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 file.h --- include/cc++/file.h 23 Apr 2005 22:08:07 -0000 1.1.1.1 +++ include/cc++/file.h 29 Aug 2005 05:09:40 -0000 @@ -926,9 +926,9 @@ public: {loader(filename, resolve);}; #else DSO(const char *filename) - {throw this;}; + {THROW(this);}; DSO(const char *filename, bool resolve) - {throw this;}; + {THROW(this);}; #endif /** Index: include/cc++/persist.h =================================================================== RCS file: /cvsroot/gnutelephony/testing/commoncpp2/include/cc++/persist.h,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 persist.h --- include/cc++/persist.h 23 Apr 2005 22:08:08 -0000 1.1.1.1 +++ include/cc++/persist.h 29 Aug 2005 05:09:40 -0000 @@ -98,7 +98,7 @@ public: inline const String& getString() const {return Exception::getString();}; - virtual ~PersistException() {} throw(); + virtual ~PersistException() {} THROWS_EMPTY; protected: String _what; }; Index: src/buffer.cpp =================================================================== RCS file: /cvsroot/gnutelephony/testing/commoncpp2/src/buffer.cpp,v retrieving revision 1.2 diff -u -p -r1.2 buffer.cpp --- src/buffer.cpp 30 Apr 2005 02:28:27 -0000 1.2 +++ src/buffer.cpp 29 Aug 2005 05:09:40 -0000 @@ -176,10 +176,10 @@ Buffer(capacity) #ifdef CCXX_EXCEPTIONS if(!buf && Thread::getException() == Thread::throwObject) - throw(this); + THROW(this); #ifdef COMMON_STD_EXCEPTION else if(!buf && Thread::getException() == Thread::throwException) - throw(SyncException("fixed buffer failure")); + THROW(SyncException("fixed buffer failure")); #endif #endif Index: src/date.cpp =================================================================== RCS file: /cvsroot/gnutelephony/testing/commoncpp2/src/date.cpp,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 date.cpp --- src/date.cpp 23 Apr 2005 22:08:18 -0000 1.1.1.1 +++ src/date.cpp 29 Aug 2005 05:09:40 -0000 @@ -165,12 +165,12 @@ void Date::setDate(const char *str, size #ifdef CCXX_EXCEPTIONS else if(Thread::getException() == Thread::throwObject) { - throw this; + THROW(this); } #ifdef COMMON_STD_EXCEPTION else if(Thread::getException() == Thread::throwException) { - throw Exception("Date::setDate(): Invalid date."); + THROW(Exception("Date::setDate(): Invalid date.")); } #endif #endif @@ -339,11 +339,11 @@ void Date::toJulian(long year, long mont if(month < 1 || month > 12 || day < 1 || day > 31 || year == 0) { #ifdef CCXX_EXCEPTIONS if(Thread::getException() == Thread::throwObject) { - throw this; + THROW(this); } #ifdef COMMON_STD_EXCEPTION else if(Thread::getException() == Thread::throwException) { - throw Exception("Date::toJulian(): Invalid date."); + THROW(Exception("Date::toJulian(): Invalid date.")); } #endif #endif @@ -519,12 +519,12 @@ void Time::setTime(char *str, size_t siz #ifdef CCXX_EXCEPTIONS else if(Thread::getException() == Thread::throwObject) { - throw this; + THROW(this); } #ifdef COMMON_STD_EXCEPTION else if(Thread::getException() == Thread::throwException) { - throw Exception("Time::setTime(): Invalid time."); + THROW(Exception("Time::setTime(): Invalid time.")); } #endif #endif @@ -617,11 +617,11 @@ void Time::toSeconds(int hour, int minut if (hour > 23 ||minute > 59 ||second > 59) { #ifdef CCXX_EXCEPTIONS if(Thread::getException() == Thread::throwObject) { - throw this; + THROW(this); } #ifdef COMMON_STD_EXCEPTION else if(Thread::getException() == Thread::throwException) { - throw Exception("Time::toSeconds(): Invalid time."); + THROW(Exception("Time::toSeconds(): Invalid time.")); } #endif #endif @@ -746,13 +746,13 @@ Datetime::Datetime(const char *a_str, si else if(Thread::getException() == Thread::throwObject) { delete str; - throw this; + THROW(this); } #ifdef COMMON_STD_EXCEPTION else if(Thread::getException() == Thread::throwException) { delete str; - throw Exception("Datetime::Datetime(): Invalid time."); + THROW(Exception("Datetime::Datetime(): Invalid time.")); } #endif #endif Index: src/dir.cpp =================================================================== RCS file: /cvsroot/gnutelephony/testing/commoncpp2/src/dir.cpp,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 dir.cpp --- src/dir.cpp 23 Apr 2005 22:08:18 -0000 1.1.1.1 +++ src/dir.cpp 29 Aug 2005 05:09:40 -0000 @@ -149,10 +149,10 @@ void Dir::open(const char *fname) { #ifdef CCXX_EXCEPTIONS if(Thread::getException() == Thread::throwObject) - throw(this); + THROW(this); #ifdef COMMON_STD_EXCEPTION else if(Thread::getException() == Thread::throwException) - throw(DirException(String(fname) + ": failed")); + THROW(DirException(String(fname) + ": failed")); #endif #endif } @@ -162,10 +162,10 @@ void Dir::open(const char *fname) snprintf(path, len + 1, "%s", fname); #ifdef CCXX_EXCEPTIONS if (!path && Thread::getException() == Thread::throwObject) - throw(this); + THROW(this); #ifdef COMMON_STD_EXCEPTION else if(!path && Thread::getException() == Thread::throwException) - throw(DirException(String(fname) + ": failed")); + THROW(DirException(String(fname) + ": failed")); #endif #endif addString(path, len, "\\*"); @@ -179,10 +179,10 @@ void Dir::open(const char *fname) dir = opendir(fname); #ifdef CCXX_EXCEPTIONS if(!dir && Thread::getException() == Thread::throwObject) - throw(this); + THROW(this); #ifdef COMMON_STD_EXCEPTION else if(!dir && Thread::getException() == Thread::throwException) - throw(DirException(String(fname) + ": failed")); + THROW(DirException(String(fname) + ": failed")); #endif #endif #endif // WIN32 Index: src/dso.cpp =================================================================== RCS file: /cvsroot/gnutelephony/testing/commoncpp2/src/dso.cpp,v retrieving revision 1.2 diff -u -p -r1.2 dso.cpp --- src/dso.cpp 1 Aug 2005 12:57:48 -0000 1.2 +++ src/dso.cpp 29 Aug 2005 05:09:40 -0000 @@ -204,10 +204,10 @@ void DSO::loader(const char *filename, b #ifdef CCXX_EXCEPTIONS if(Thread::getException() == Thread::throwObject) - throw(this); + THROW(this); #ifdef COMMON_STD_EXCEPTION else if(Thread::getException() == Thread::throwException) - throw(DSOException(String(id) + err)); + THROW(DSOException(String(id) + err)); #endif #endif return; Index: src/exception.cpp =================================================================== RCS file: /cvsroot/gnutelephony/testing/commoncpp2/src/exception.cpp,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 exception.cpp --- src/exception.cpp 23 Apr 2005 22:08:19 -0000 1.1.1.1 +++ src/exception.cpp 29 Aug 2005 05:09:40 -0000 @@ -46,14 +46,14 @@ namespace ost { #endif -Exception::Exception(const String& what_arg) throw(): +Exception::Exception(const String& what_arg) THROWS_EMPTY: _what(what_arg) { } -Exception::~Exception() throw() +Exception::~Exception() THROWS_EMPTY {} -const char *Exception::what() const throw() +const char *Exception::what() const THROWS_EMPTY { return _what.c_str(); } @@ -63,23 +63,23 @@ const char *Exception::getString() const return _what.c_str(); } -IOException::IOException(const String &what_arg, long systemError) throw() : +IOException::IOException(const String &what_arg, long systemError) THROWS_EMPTY : Exception(what_arg), _systemError(systemError), _systemErrorString(NULL) { } -IOException::~IOException() throw() +IOException::~IOException() THROWS_EMPTY { delete [] _systemErrorString; } -long IOException::getSystemError() const throw() +long IOException::getSystemError() const THROWS_EMPTY { return _systemError; } -const char* IOException::getSystemErrorString() const throw() +const char* IOException::getSystemErrorString() const THROWS_EMPTY { const uint32 errStrSize = 2048; if ( !_systemErrorString ) Index: src/file.cpp =================================================================== RCS file: /cvsroot/gnutelephony/testing/commoncpp2/src/file.cpp,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 file.cpp --- src/file.cpp 23 Apr 2005 22:08:19 -0000 1.1.1.1 +++ src/file.cpp 29 Aug 2005 05:09:40 -0000 @@ -235,13 +235,13 @@ RandomFile::Error RandomFile::error(Erro flags.thrown = true; #ifdef CCXX_EXCEPTIONS if(Thread::getException() == Thread::throwObject) - throw(this); + THROW(this); #ifdef COMMON_STD_EXCEPTION else if(Thread::getException() == Thread::throwException) { if(!str) str = ""; - throw FileException(str); + THROW(FileException(str)); } #endif #endif Index: src/mutex.cpp =================================================================== RCS file: /cvsroot/gnutelephony/testing/commoncpp2/src/mutex.cpp,v retrieving revision 1.2 diff -u -p -r1.2 mutex.cpp --- src/mutex.cpp 18 Jun 2005 16:43:27 -0000 1.2 +++ src/mutex.cpp 29 Aug 2005 05:09:41 -0000 @@ -64,10 +64,10 @@ ThreadLock::ThreadLock() { #ifdef CCXX_EXCEPTIONS if(Thread::getException() == Thread::throwObject) - throw(this); + THROW(this); #ifdef COMMON_STD_EXCEPTION else if(Thread::getException() == Thread::throwException) - throw(SyncException("Mutex constructor failure")); + THROW(SyncException("Mutex constructor failure")); #endif #endif } Index: src/serial.cpp =================================================================== RCS file: /cvsroot/gnutelephony/testing/commoncpp2/src/serial.cpp,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 serial.cpp --- src/serial.cpp 23 Apr 2005 22:08:24 -0000 1.1.1.1 +++ src/serial.cpp 29 Aug 2005 05:09:41 -0000 @@ -316,13 +316,13 @@ Serial::Error Serial::error(Error err, c flags.thrown = true; #ifdef CCXX_EXCEPTIONS if(Thread::getException() == Thread::throwObject) - throw((Serial *)this); + THROW((Serial *)this); #ifdef COMMON_STD_EXCEPTION else if(Thread::getException() == Thread::throwException) { if(!errs) errs = ""; - throw SerException(String(errs)); + THROW(SerException(String(errs))); } #endif #endif Index: src/socket.cpp =================================================================== RCS file: /cvsroot/gnutelephony/testing/commoncpp2/src/socket.cpp,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 socket.cpp --- src/socket.cpp 23 Apr 2005 22:08:26 -0000 1.1.1.1 +++ src/socket.cpp 29 Aug 2005 05:09:42 -0000 @@ -601,13 +601,13 @@ Socket::Error Socket::error(Error err, c switch(Thread::getException()) { case Thread::throwObject: - throw((Socket *)this); + THROW((Socket *)this); #ifdef COMMON_STD_EXCEPTION case Thread::throwException: { if(!errs) errs = ""; - throw SockException(String(errs), err, systemError); + THROW(SockException(String(errs), err, systemError)); } #endif case Thread::throwNothing: Index: src/thread.cpp =================================================================== RCS file: /cvsroot/gnutelephony/testing/commoncpp2/src/thread.cpp,v retrieving revision 1.4 diff -u -p -r1.4 thread.cpp --- src/thread.cpp 19 Jul 2005 10:26:39 -0000 1.4 +++ src/thread.cpp 29 Aug 2005 05:09:42 -0000 @@ -215,7 +215,7 @@ void Thread::suspend(void) { #ifdef CCXX_EXCEPTIONS if (Thread::getException() != throwNothing) - throw this; + THROW(this); #endif return; } @@ -263,7 +263,7 @@ void Thread::resume(void) { #ifdef CCXX_EXCEPTIONS if (Thread::getException() != throwNothing) - throw this; + THROW(this); #endif return; } @@ -627,11 +627,11 @@ _cancel(cancelDefault), _start(NULL), pr switch(Thread::getException()) { case throwObject: - throw(this); + THROW(this); return; #ifdef COMMON_STD_EXCEPTION case throwException: - throw(ThrException("no stack space")); + THROW(ThrException("no stack space")); return; #endif default: @@ -660,11 +660,11 @@ _cancel(cancelDefault), _start(NULL), pr switch(Thread::getException()) { case throwObject: - throw(this); + THROW(this); return; #ifdef COMMON_STD_EXCEPTION case throwException: - throw(ThrException("invalid scheduler")); + THROW(ThrException("invalid scheduler")); return; #endif default: @@ -727,10 +727,10 @@ Thread::Thread(const Thread &th) // rc = pthread_create(&_tid, &_attr, exec_t(&ccxx_exec_handler), this); // pthread_sigmask(SIG_SETMASK, &mask, NULL); // if(rc && Thread::getException() == throwObject) -// throw(this); +// THROW(this); //#ifdef COMMON_STD_EXCEPTION // else if(rc && Thread::getException() == throwException) -// throw(ThrException("cannot start copy")); +// THROW(ThrException("cannot start copy")); //#endif } #endif // ndef WIN32 _______________________________________________ Bug-commoncpp mailing list Bug-commoncpp@gnu.org http://lists.gnu.org/mailman/listinfo/bug-commoncpp