Changeset 1458


Ignore:
Timestamp:
2013-11-08T17:03:15+01:00 (11 months ago)
Author:
moo
Message:

relocate: assert that srcptr use on non-nullable only

Location:
trunk/processor
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/processor/head.m4

    r1452 r1458  
    8484#define ptradd(type, ptr, ptrdiff) ((type) (((char *) (ptr)) + (ptrdiff))) 
    8585#define ptrsub(ptr1, ptr2) (((char *) (ptr1)) - ((char *) (ptr2))) 
     86#ifdef NDEBUG 
     87    #define notnullable(ptr) (ptr) 
     88#else 
     89static inline void *notnullable(void *ptr) 
     90{ 
     91    assert(ptr); 
     92    return ptr; 
     93} 
     94#endif 
    8695dnl }}} 
    8796dnl {{{ _xc_processor_t 
  • trunk/processor/main.m4

    r1457 r1458  
    2626dnl }}} 
    2727dnl {{{ SRCPTR_EX(1:type, 2:elm) 
    28 define(`SRCPTR_EX', `IFRELOCATE(`($2 ? ptradd($1 *, $2, ptrdiff) : NULL)', `$2')') 
     28define(`SRCPTR_EX', `IFRELOCATE(`ptradd($1 *, notnullable($2), ptrdiff)', `$2')') 
    2929dnl }}} 
    3030dnl {{{ ALLOC(1:dst, 2:type, 3:count=1, 4:clean=false, 5:realtype=$2) 
Note: See TracChangeset for help on using the changeset viewer.