Changeset 627f585


Ignore:
Timestamp:
Jan 10, 2017, 2:32:33 PM (5 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
dd0c97b
Parents:
f831177
Message:

moved new and delete to stdlib

Location:
src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInit.cc

    rf831177 r627f585  
    11001100                        addDeclaration( tmp );
    11011101
     1102                        // xxx - this can be TupleAssignExpr now. Need to properly handle this case.
    11021103                        ApplicationExpr * callExpr = safe_dynamic_cast< ApplicationExpr * > ( ctorExpr->get_callExpr() );
    11031104                        TypeSubstitution * env = ctorExpr->get_env();
  • src/libcfa/stdlib

    rf831177 r627f585  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // stdlib -- 
     7// stdlib --
    88//
    99// Author           : Peter A. Buhr
     
    4444void free( void * ptr );
    4545} // extern "C"
     46
     47forall( otype T, ttype Params | { void ?{}(T *, Params); } ) T * new( Params p );
     48forall( dtype T | { void ^?{}(T *); } ) void delete( T * ptr );
     49
    4650
    4751//---------------------------------------
  • src/libcfa/stdlib.c

    rf831177 r627f585  
    7878} // posix_memalign
    7979
     80forall( otype T, ttype Params | { void ?{}(T *, Params); } )
     81T * new( Params p ) {
     82        return ((T*)malloc()){ p };
     83}
     84
     85forall( dtype T | { void ^?{}(T *); } )
     86void delete( T * ptr ) {
     87  if ( ptr ) {
     88    ^ptr{};
     89    free( ptr );
     90  }
     91}
     92
    8093//---------------------------------------
    8194
  • src/tests/avltree/avl.h

    rf831177 r627f585  
    1919forall(otype T | Comparable(T))
    2020int ?>?(T t1, T t2);
     21
     22// xxx - unbound type variable problems when trying to use new instead of create
     23// forall( otype T, ttype Params | { void ?{}(T *, Params); } ) T * new( Params p );
    2124
    2225forall(dtype T | { void ^?{}(T *); })
  • src/tests/avltree/avl0.c

    rf831177 r627f585  
    1010  return t2 < t1;
    1111}
    12 
    13 forall(dtype T | { void ^?{}(T *); })
    14 void delete(T * x) {
    15   if (x) {
    16     ^?{}(x);
    17     free(x);
    18   }
    19 }
  • src/tests/tupleVariadic.c

    rf831177 r627f585  
    2929}
    3030
    31 forall(otype T) T * malloc();
    32 
    33 forall(otype T, ttype Params | sized(T) | { void ?{}(T *, Params); })
    34 T * new(Params p) {
    35         return ((T*)malloc()){ p };
    36 }
     31forall(otype T, ttype Params | { void ?{}(T *, Params); })
     32T * new(Params p);
    3733
    3834struct array {
Note: See TracChangeset for help on using the changeset viewer.