Ignore:
Timestamp:
Apr 21, 2016, 10:27:55 AM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
8c8b614
Parents:
3365b37
Message:

all implemented files compile

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/examples/gc_no_raii/bug-repro/push_back.c

    r3365b37 rdf4aea7  
    22#include <stdint.h>
    33
    4 //------------------------------------------------------------------------------
    5 //Declaration
    6 trait allocator_c(otype T, otype allocator_t) {
    7         void realloc(allocator_t*, size_t);
    8         T* data(allocator_t*);
    9 };
    10 
    11 forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    12 struct vector
    13 {
    14         allocator_t storage;
    15         size_t size;
    16 };
    17 
    18 //------------------------------------------------------------------------------
    19 //Allocator
    20 forall(otype T)
    21 struct heap_allocator
    22 {
    23         T* storage;
    24         size_t capacity;
    25 };
    26 
    27 forall(otype T)
    28 void realloc(heap_allocator(T)* this, size_t size);
    29 
    30 forall(otype T)
    31 inline T* data(heap_allocator(T)* this)
    32 {
    33         return this->storage;
    34 }
    35 
    36 //------------------------------------------------------------------------------
    37 //Modifiers
    38 forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    39 void push_back(vector(T, allocator_t)* this, T value);
     4#include "push_back.h"
    405
    416typedef vector(intptr_t*, heap_allocator(intptr_t*)) worklist_t;
    427
    43 inline void test()
     8void test()
    449{
    4510        worklist_t w;
    46         intptr_t zero = 0;
    47         push_back(&w, &zero);
     11        if(!empty(&w))
     12        {
     13                intptr_t zero = 0;
     14                push_back(&w, &zero);
     15        }
    4816}
Note: See TracChangeset for help on using the changeset viewer.