Ignore:
Timestamp:
Jun 26, 2005, 12:42:04 AM (20 years ago)
Author:
bird
Message:

libc adjustments. extending some testcases.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libctests/glibc/string/test-string.h

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r2075 r2076  
    2525  long test;
    2626} impl_t;
     27
     28#ifdef __EMX__ /* aout based */
     29#include <stdint.h>
     30extern uintptr_t __impls__;
     31asm (".stabs  \"___impls__\", 21, 0, 0, 0xffffffff");
     32
     33#define IMPL(name, test) \
     34  impl_t tst_ ## name = { #name, (void (*) (void))name, test }; \
     35   asm (".stabs \"___impls__\", 25, 0, 0, _tst_" #name);
     36#else
    2737extern impl_t __start_impls[], __stop_impls[];
    28 
    2938#define IMPL(name, test) \
    3039  impl_t tst_ ## name                                                   \
    3140  __attribute__ ((section ("impls"), aligned (sizeof (void *))))        \
    3241    = { #name, (void (*) (void))name, test };
     42#endif
    3343
    3444#ifdef TEST_MAIN
     
    7080    return psz - psz2;
    7181}
    72 #endif 
     82#endif
    7383
    7484
     
    124134  (* (proto_t) (impl)->fn) (__VA_ARGS__)
    125135
     136#ifdef __EMX__
     137#define FOR_EACH_IMPL(impl, notall) \
     138    for (uintptr_t *_ptrfirst = __impls__ == -1 ? &__impls__ - 1 : &__impls__; \
     139         _ptrfirst; \
     140         _ptrfirst = NULL) \
     141      for (uintptr_t *_ptr = *_ptrfirst == -2 ? _ptrfirst + 1 :  _ptrfirst + 2; \
     142           _ptr && *_ptr != NULL; \
     143           _ptr = *_ptrfirst == -2 /* emxomf */ || (_ptr - _ptrfirst < *_ptrfirst /* a.out */ ) ? _ptr + 1 : NULL) \
     144        for (impl_t *impl = *(impl_t **)_ptr; impl; impl = NULL) \
     145          if (!notall || impl->test)
     146#else
    126147#define FOR_EACH_IMPL(impl, notall) \
    127148  for (impl_t *impl = __start_impls; impl < __stop_impls; ++impl)       \
    128149    if (!notall || impl->test)
     150#endif
    129151
    130152#define HP_TIMING_BEST(best_time, start, end)   \
     
    146168    page_size = MIN_PAGE_SIZE;
    147169#endif
     170#ifdef HAVE_MMAP
    148171  buf1 = mmap (0, 2 * page_size, PROT_READ | PROT_WRITE,
    149172               MAP_PRIVATE | MAP_ANON, -1, 0);
    150173  if (buf1 == MAP_FAILED)
    151174    error (EXIT_FAILURE, errno, "mmap failed");
     175#else
     176  buf1 = memalign (getpagesize (), 2 * page_size);
     177  if (!buf1)
     178    error (EXIT_FAILURE, errno, "memalign failed");
     179#endif
    152180  if (mprotect (buf1 + page_size, page_size, PROT_NONE))
    153181    error (EXIT_FAILURE, errno, "mprotect failed");
     182#ifdef HAVE_MMAP
    154183  buf2 = mmap (0, 2 * page_size, PROT_READ | PROT_WRITE,
    155184               MAP_PRIVATE | MAP_ANON, -1, 0);
    156185  if (buf2 == MAP_FAILED)
    157186    error (EXIT_FAILURE, errno, "mmap failed");
     187#else
     188  buf2 = memalign (getpagesize (), 2 * page_size);
     189  if (!buf2)
     190    error (EXIT_FAILURE, errno, "memalign failed");
     191#endif
    158192  if (mprotect (buf2 + page_size, page_size, PROT_NONE))
    159193    error (EXIT_FAILURE, errno, "mprotect failed");
Note: See TracChangeset for help on using the changeset viewer.