- Timestamp:
- Aug 14, 2017, 2:44:40 PM (7 years ago)
- 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:
- 6a36975
- Parents:
- bd46af4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tests/except-2.c
rbd46af4 r406a6e6 5 5 6 6 // Local Exception Types and manual vtable types. 7 #define GLUE2(left, right) left##right 8 #define GLUE3(left, middle, right) left##middle##right 7 9 #define BASE_EXCEPT __cfaehm__base_exception_t 8 #define TABLE(name) name##_vtable9 #define INSTANCE(name) _##name##_vtable_instance10 #define TABLE(name) GLUE2(name,_vtable) 11 #define INSTANCE(name) GLUE3(_,name,_vtable_instance) 10 12 #define TRIVIAL_EXCEPTION(name) \ 11 13 struct name; \ 12 14 struct TABLE(name) { \ 13 struct __cfaehm__base_exception_t_vtableconst * parent; \15 struct TABLE(BASE_EXCEPT) const * parent; \ 14 16 size_t size; \ 15 17 void (*copy)(name *this, name * other); \ … … 28 30 } \ 29 31 TABLE(name) INSTANCE(name) @= { \ 30 .parent : &INSTANCE( __cfaehm__base_exception_t), \32 .parent : &INSTANCE(BASE_EXCEPT), \ 31 33 .size : sizeof(name), .copy : name##_copy, \ 32 34 .free : ^?{}, .msg : name##_msg \ … … 40 42 struct num_error; 41 43 struct num_error_vtable { 42 struct exception_t_vtableconst * parent;44 struct TABLE(BASE_EXCEPT) const * parent; 43 45 size_t size; 44 46 void (*copy)(num_error *this, num_error * other); … … 62 64 } 63 65 void ?{}(num_error * this, int num) { 64 this->virtual_table = & _num_error_vtable_instance;66 this->virtual_table = &INSTANCE(num_error); 65 67 this->msg = 0; 66 68 this->num = num;
Note: See TracChangeset
for help on using the changeset viewer.