Changeset 4c1403c
- Timestamp:
- Sep 14, 2016, 1:15:24 PM (8 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:
- 50c5cf3
- Parents:
- 76af36f
- Location:
- src/examples/gc_no_raii
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/examples/gc_no_raii/src/gcpointers.c
r76af36f r4c1403c 80 80 81 81 //Logical operators 82 bool gcpointer_equal( gcpointer_t* this,gcpointer_t* rhs)82 bool gcpointer_equal(const gcpointer_t* this, const gcpointer_t* rhs) 83 83 { 84 84 return this->ptr == rhs->ptr; 85 85 } 86 86 87 bool gcpointer_not_equal( gcpointer_t* this,gcpointer_t* rhs)87 bool gcpointer_not_equal(const gcpointer_t* this, const gcpointer_t* rhs) 88 88 { 89 89 return this->ptr != rhs->ptr; 90 90 } 91 91 92 bool gcpointer_null( gcpointer_t* this)92 bool gcpointer_null(const gcpointer_t* this) 93 93 { 94 94 return this->ptr == (intptr_t)NULL; 95 95 } 96 97 #ifndef NDEBUG 98 bool is_valid(const gcpointer_t* this) { 99 if(gcpointer_null(this)) return true; 100 101 gc_object_header* obj = gc_get_object_ptr((void*)this->ptr); 102 check(obj); 103 check(is_valid(obj)); 104 check(!obj->root_chain || this->ptr == obj->root_chain->ptr); 105 106 if( !gc_is_managed(this)) 107 { 108 check( !(this->next) || this->ptr == this->next->ptr ); 109 } 110 111 return true; 112 } 113 #endif 96 114 97 115 forall(otype T) void ?{}(gcpointer(T)* this) { -
src/examples/gc_no_raii/src/gcpointers.h
r76af36f r4c1403c 22 22 bool gcpointer_equal(gcpointer_t* this, gcpointer_t* rhs); 23 23 bool gcpointer_not_equal(gcpointer_t* this, gcpointer_t* rhs); 24 bool gcpointer_null(gcpointer_t* this); 24 bool gcpointer_null(const gcpointer_t* this); 25 26 27 #ifndef NDEBUG 28 bool is_valid(const gcpointer_t* this); 29 #endif 25 30 26 31 forall(dtype T) -
src/examples/gc_no_raii/test/badlll.c
r76af36f r4c1403c 35 35 } 36 36 37 check(is_valid( &ll0.internal )); 38 37 39 return ll0; 38 40 }
Note: See TracChangeset
for help on using the changeset viewer.