Ignore:
Timestamp:
Jul 6, 2020, 1:23:56 PM (16 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast, new-ast-unique-expr
Children:
6437ce4
Parents:
9ec8c5f
Message:

Default handlers for uncaught exceptions are now run at the top of the stack. There was an error but it seemed to disappear when I recompiled the code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/exceptions/defaults.cfa

    r9ec8c5f r381132b  
    3030                throwResume (log_message){(char *)"Should be printed.\n"};
    3131        } catchResume (log_message * this) {
    32                 printf(this->virtual_table->msg(this));
     32                printf("%s", this->virtual_table->msg(this));
    3333        }
    3434        // But we don't have to:
     
    6969}
    7070
     71TRIVIAL_EXCEPTION(second);
     72
     73void cross_test(void) {
     74        void defaultTerminationHandler(first &) {
     75                printf("cross terminate default\n");
     76                throw (second){};
     77        }
     78        void defaultResumptionHandler(first &) {
     79                printf("cross resume default\n");
     80                throwResume (second){};
     81        }
     82        try {
     83                printf("cross terminate throw\n");
     84                throw (first){};
     85        } catch (second *) {
     86                printf("cross terminate catch\n");
     87        }
     88        try {
     89                printf("cross resume throw\n");
     90                throwResume (first){};
     91        } catchResume (second *) {
     92                printf("cross resume catch\n");
     93        }
     94}
     95
    7196int main(int argc, char * argv[]) {
    7297        log_test();
    7398        jump_test();
    7499        unhandled_test();
     100        cross_test();
    75101}
Note: See TracChangeset for help on using the changeset viewer.