Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/exception.h

    r046a890 r3090127  
    1010// Created On       : Mon Jun 26 15:11:00 2017
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Tue May 19 14:17:00 2020
    13 // Update Count     : 10
     12// Last Modified On : Fri Mar 27 10:16:00 2020
     13// Update Count     : 9
    1414//
    1515
     
    3838
    3939
    40 void __cfaehm_cancel_stack(exception_t * except) __attribute__((noreturn));
    41 
    4240// Used in throw statement translation.
    43 void __cfaehm_throw_terminate(exception_t * except, void (*)(exception_t *));
     41void __cfaehm_throw_terminate(exception_t * except) __attribute__((noreturn));
    4442void __cfaehm_rethrow_terminate() __attribute__((noreturn));
    45 void __cfaehm_throw_resume(exception_t * except, void (*)(exception_t *));
     43void __cfaehm_throw_resume(exception_t * except);
    4644
    4745// Function catches termination exceptions.
     
    7270#ifdef __cforall
    7371}
    74 
    75 // Not all the built-ins can be expressed in C. These can't be
    76 // implemented in the .c file either so they all have to be inline.
    77 
    78 trait is_exception(dtype T) {
    79         /* The first field must be a pointer to a virtual table.
    80          * That virtual table must be a decendent of the base exception virtual tab$
    81          */
    82         void mark_exception(T *);
    83         // This is never used and should be a no-op.
    84 };
    85 
    86 trait is_termination_exception(dtype T | is_exception(T)) {
    87         void defaultTerminationHandler(T &);
    88 };
    89 
    90 trait is_resumption_exception(dtype T | is_exception(T)) {
    91         void defaultResumptionHandler(T &);
    92 };
    93 
    94 forall(dtype T | is_termination_exception(T))
    95 static inline void $throw(T & except) {
    96         __cfaehm_throw_terminate(
    97                 (exception_t *)&except,
    98                 (void(*)(exception_t *))defaultTerminationHandler
    99         );
    100 }
    101 
    102 forall(dtype T | is_resumption_exception(T))
    103 static inline void $throwResume(T & except) {
    104         __cfaehm_throw_resume(
    105                 (exception_t *)&except,
    106                 (void(*)(exception_t *))defaultResumptionHandler
    107         );
    108 }
    109 
    110 forall(dtype T | is_exception(T))
    111 static inline void cancel_stack(T & except) __attribute__((noreturn)) {
    112         __cfaehm_cancel_stack( (exception_t *)&except );
    113 }
    114 
    115 forall(dtype T | is_exception(T))
    116 static inline void defaultTerminationHandler(T & except) {
    117         return cancel_stack( except );
    118 }
    119 
    120 forall(dtype T | is_exception(T))
    121 static inline void defaultResumptionHandler(T & except) {
    122         throw except;
    123 }
    124 
    12572#endif
Note: See TracChangeset for help on using the changeset viewer.