Ignore:
Timestamp:
Jun 16, 2017, 4:36:00 PM (7 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
365d553c
Parents:
0892b1b
Message:

Updates to exception handling and translation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/working/exception/impl/test-main.c

    r0892b1b rc529a24  
    66#include <stdbool.h>
    77
    8 // Translation Helpers:
    9 #define CLEANUP(function) \
    10         struct __cleanup_hook __hidden_hook __attribute__((cleanup(function)))
    11 
    12 #define SET_UP_RESUME_NODE(handler_function) \
    13         struct __try_resume_node node \
    14                 __attribute__((cleanup(__try_resume_node_delete))); \
    15         __try_resume_node_new(&node, handler_function)
    16 
     8// Helps with manual translation. It may or may not get folded into the
     9// header, that depends on how it interacts with concurancy.
    1710void __try_resume_node_new(struct __try_resume_node * node,
    1811        _Bool (*handler)(exception except)) {
     
    2013    shared_stack.top_resume = node;
    2114    node->try_to_handle = handler;
    22 }
    23 
    24 void __try_resume_node_delete(struct __try_resume_node * node) {
    25     shared_stack.top_resume = node->next;
    2615}
    2716
     
    122111                }
    123112                struct __try_resume_node node
    124                         __attribute__((cleanup(__try_resume_node_delete)));
     113                        __attribute__((cleanup(__try_resume_cleanup)));
    125114                __try_resume_node_new(&node, beta_handle1);
    126115                {
     
    144133                }
    145134                struct __try_resume_node node
    146                         __attribute__((cleanup(__try_resume_node_delete)));
     135                        __attribute__((cleanup(__try_resume_cleanup)));
    147136                __try_resume_node_new(&node, alpha_handle1);
    148137                {
     
    260249                }
    261250                struct __try_resume_node node
    262                         __attribute__((cleanup(__try_resume_node_delete)));
     251                        __attribute__((cleanup(__try_resume_cleanup)));
    263252                __try_resume_node_new(&node, fn_handle1);
    264253                {
     
    279268                }
    280269                struct __try_resume_node node
    281                         __attribute__((cleanup(__try_resume_node_delete)));
     270                        __attribute__((cleanup(__try_resume_cleanup)));
    282271                __try_resume_node_new(&node, fn_handle1);
    283272                {
     
    349338                }
    350339                struct __try_resume_node node
    351                         __attribute__((cleanup(__try_resume_node_delete)));
     340                        __attribute__((cleanup(__try_resume_cleanup)));
    352341                __try_resume_node_new(&node, reresume_handle1);
    353342                {
     
    361350                        }
    362351                        struct __try_resume_node node
    363                                 __attribute__((cleanup(__try_resume_node_delete)));
     352                                __attribute__((cleanup(__try_resume_cleanup)));
    364353                        __try_resume_node_new(&node, reresume_handle2);
    365354                        {
     
    409398                }
    410399                struct __try_resume_node node
    411                         __attribute__((cleanup(__try_resume_node_delete)));
     400                        __attribute__((cleanup(__try_resume_cleanup)));
    412401                __try_resume_node_new(&node, foe_handle1);
    413402                {
     
    456445                }
    457446                struct __try_resume_node node
    458                         __attribute__((cleanup(__try_resume_node_delete)));
     447                        __attribute__((cleanup(__try_resume_cleanup)));
    459448                __try_resume_node_new(&node, fee_handle1);
    460449                {
Note: See TracChangeset for help on using the changeset viewer.