Changes in libcfa/prelude/builtins.c [0d8266c:8a30423]
- File:
-
- 1 edited
-
libcfa/prelude/builtins.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/prelude/builtins.c
r0d8266c r8a30423 10 10 // Created On : Fri Jul 21 16:21:03 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jun 25 18:06:52201913 // Update Count : 9 712 // Last Modified On : Tue Mar 26 23:10:36 2019 13 // Update Count : 95 14 14 // 15 16 // type that wraps a pointer and a destructor-like function - used in generating implicit destructor calls for struct members in user-defined functions17 // Note: needs to occur early, because it is used to generate destructor calls during code generation18 forall(dtype T)19 struct __Destructor {20 T * object;21 void (*dtor)(T *);22 };23 24 // defined destructor in the case that non-generated code wants to use __Destructor25 forall(dtype T)26 static inline void ^?{}(__Destructor(T) & x) {27 if (x.object && x.dtor) {28 x.dtor(x.object);29 }30 }31 32 // easy interface into __Destructor's destructor for easy codegen purposes33 extern "C" {34 forall(dtype T)35 static inline void __destroy_Destructor(__Destructor(T) * dtor) {36 ^(*dtor){};37 }38 }39 15 40 16 // exception implementation … … 49 25 void abort( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ )); 50 26 51 // i mplicit increment, decrement if += defined, and implicit not if != defined27 // increment/decrement unification 52 28 53 29 static inline { … … 63 39 forall( dtype DT | sized(DT) | { void ?{}( DT &, DT ); void ^?{}( DT & ); DT & ?-=?( DT &, one_t ); } ) 64 40 DT & ?--( DT & x ) { DT tmp = x; x -= 1; return tmp; } 65 66 forall( dtype DT | { int ?!=?( const DT &, zero_t ); } )67 int !?( const DT & x ) { return !( x != 0 ); }68 41 } // distribution 69 42
Note:
See TracChangeset
for help on using the changeset viewer.