diff options
author | Chris Lattner <sabre@nondot.org> | 2003-08-27 22:59:15 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-08-27 22:59:15 +0000 |
commit | d289ed5615ac0649fcf3b381b0a28acc12cc2975 (patch) | |
tree | fa3d51a3e21e7efcee6bb79926fe5b37a4447cb4 /runtime | |
parent | 7a37fa7e288902cf01e65ff8f843744bc82b489a (diff) | |
download | external_llvm-d289ed5615ac0649fcf3b381b0a28acc12cc2975.zip external_llvm-d289ed5615ac0649fcf3b381b0a28acc12cc2975.tar.gz external_llvm-d289ed5615ac0649fcf3b381b0a28acc12cc2975.tar.bz2 |
Be more type-safe, add throw specs to all functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8168 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/GCCLibraries/crtend/C++-Exception.h | 40 | ||||
-rw-r--r-- | runtime/GCCLibraries/libexception/C++-Exception.h | 40 |
2 files changed, 54 insertions, 26 deletions
diff --git a/runtime/GCCLibraries/crtend/C++-Exception.h b/runtime/GCCLibraries/crtend/C++-Exception.h index 6ff384e..81a7639 100644 --- a/runtime/GCCLibraries/crtend/C++-Exception.h +++ b/runtime/GCCLibraries/crtend/C++-Exception.h @@ -29,14 +29,14 @@ struct llvm_cxx_exception { * unexpected which are a result of an exception throw are supposed to use the * value of the handler at the time of the throw, not the currently set value. */ - void *UnexpectedHandler; + void (*UnexpectedHandler)(); /* TerminateHandler - This contains a pointer to the "terminate" handler which * may be registered by the user program with set_terminate. Calls to * unexpected which are a result of an exception throw are supposed to use the * value of the handler at the time of the throw, not the currently set value. */ - void *TerminateHandler; + void (*TerminateHandler)(); /* BaseException - The language independent portion of the exception state. * This is at the end of the record so that we can add additional members to @@ -45,23 +45,37 @@ struct llvm_cxx_exception { llvm_exception BaseException; }; -inline llvm_cxx_exception *get_cxx_exception(llvm_exception *E) { +inline llvm_cxx_exception *get_cxx_exception(llvm_exception *E) throw() { assert(E->ExceptionType == CXXException && "Not a C++ exception?"); return (llvm_cxx_exception*)(E+1)-1; } -extern "C" { - void *__llvm_cxxeh_allocate_exception(unsigned NumBytes); - void __llvm_cxxeh_free_exception(void *ObjectPtr); - void __llvm_cxxeh_throw(void *ObjectPtr, const std::type_info *TypeInfoPtr, - void (*DtorPtr)(void*)); +// Interface to the C++ standard library to get to the terminate and unexpected +// handler stuff. +namespace __cxxabiv1 { + // Invokes given handler, dying appropriately if the user handler was + // so inconsiderate as to return. + extern void __terminate(std::terminate_handler) __attribute__((noreturn)); + extern void __unexpected(std::unexpected_handler) __attribute__((noreturn)); + + // The current installed user handlers. + extern std::terminate_handler __terminate_handler; + extern std::unexpected_handler __unexpected_handler; +} - void * __llvm_cxxeh_current_uncaught_exception_isa(const std::type_info *Ty); - void *__llvm_cxxeh_begin_catch(void); - void *__llvm_cxxeh_begin_catch_if_isa(const std::type_info *CatchType); - void __llvm_cxxeh_end_catch(void); +extern "C" { + void *__llvm_cxxeh_allocate_exception(unsigned NumBytes) throw(); + void __llvm_cxxeh_free_exception(void *ObjectPtr) throw(); + void __llvm_cxxeh_throw(void *ObjectPtr, void *TypeInfoPtr, + void (*DtorPtr)(void*)) throw(); - void __llvm_cxxeh_rethrow(void); + void * __llvm_cxxeh_current_uncaught_exception_isa(void *Ty) + throw(); + void *__llvm_cxxeh_begin_catch() throw(); + void *__llvm_cxxeh_begin_catch_if_isa(void *CatchType) throw(); + void __llvm_cxxeh_end_catch() /* might throw */; + void __llvm_cxxeh_rethrow() throw(); + void __llvm_cxxeh_check_eh_spec(void *Info, ...); } #endif diff --git a/runtime/GCCLibraries/libexception/C++-Exception.h b/runtime/GCCLibraries/libexception/C++-Exception.h index 6ff384e..81a7639 100644 --- a/runtime/GCCLibraries/libexception/C++-Exception.h +++ b/runtime/GCCLibraries/libexception/C++-Exception.h @@ -29,14 +29,14 @@ struct llvm_cxx_exception { * unexpected which are a result of an exception throw are supposed to use the * value of the handler at the time of the throw, not the currently set value. */ - void *UnexpectedHandler; + void (*UnexpectedHandler)(); /* TerminateHandler - This contains a pointer to the "terminate" handler which * may be registered by the user program with set_terminate. Calls to * unexpected which are a result of an exception throw are supposed to use the * value of the handler at the time of the throw, not the currently set value. */ - void *TerminateHandler; + void (*TerminateHandler)(); /* BaseException - The language independent portion of the exception state. * This is at the end of the record so that we can add additional members to @@ -45,23 +45,37 @@ struct llvm_cxx_exception { llvm_exception BaseException; }; -inline llvm_cxx_exception *get_cxx_exception(llvm_exception *E) { +inline llvm_cxx_exception *get_cxx_exception(llvm_exception *E) throw() { assert(E->ExceptionType == CXXException && "Not a C++ exception?"); return (llvm_cxx_exception*)(E+1)-1; } -extern "C" { - void *__llvm_cxxeh_allocate_exception(unsigned NumBytes); - void __llvm_cxxeh_free_exception(void *ObjectPtr); - void __llvm_cxxeh_throw(void *ObjectPtr, const std::type_info *TypeInfoPtr, - void (*DtorPtr)(void*)); +// Interface to the C++ standard library to get to the terminate and unexpected +// handler stuff. +namespace __cxxabiv1 { + // Invokes given handler, dying appropriately if the user handler was + // so inconsiderate as to return. + extern void __terminate(std::terminate_handler) __attribute__((noreturn)); + extern void __unexpected(std::unexpected_handler) __attribute__((noreturn)); + + // The current installed user handlers. + extern std::terminate_handler __terminate_handler; + extern std::unexpected_handler __unexpected_handler; +} - void * __llvm_cxxeh_current_uncaught_exception_isa(const std::type_info *Ty); - void *__llvm_cxxeh_begin_catch(void); - void *__llvm_cxxeh_begin_catch_if_isa(const std::type_info *CatchType); - void __llvm_cxxeh_end_catch(void); +extern "C" { + void *__llvm_cxxeh_allocate_exception(unsigned NumBytes) throw(); + void __llvm_cxxeh_free_exception(void *ObjectPtr) throw(); + void __llvm_cxxeh_throw(void *ObjectPtr, void *TypeInfoPtr, + void (*DtorPtr)(void*)) throw(); - void __llvm_cxxeh_rethrow(void); + void * __llvm_cxxeh_current_uncaught_exception_isa(void *Ty) + throw(); + void *__llvm_cxxeh_begin_catch() throw(); + void *__llvm_cxxeh_begin_catch_if_isa(void *CatchType) throw(); + void __llvm_cxxeh_end_catch() /* might throw */; + void __llvm_cxxeh_rethrow() throw(); + void __llvm_cxxeh_check_eh_spec(void *Info, ...); } #endif |