Home | History | Annotate | Download | only in src
      1 //===----------------------------- config.h -------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //
      9 //  Defines macros used within the libc++abi project.
     10 //
     11 //===----------------------------------------------------------------------===//
     12 
     13 
     14 #ifndef LIBCXXABI_CONFIG_H
     15 #define LIBCXXABI_CONFIG_H
     16 
     17 #include <unistd.h>
     18 
     19 #if defined(_POSIX_THREADS) && _POSIX_THREADS > 0
     20 #  define LIBCXXABI_SINGLE_THREADED 0
     21 #else
     22 #  define LIBCXXABI_SINGLE_THREADED 1
     23 #endif
     24 
     25 // Set this in the CXXFLAGS when you need it, because otherwise we'd have to
     26 // #if !defined(__linux__) && !defined(__APPLE__) && ...
     27 // and so-on for *every* platform.
     28 #ifndef LIBCXXABI_BARE_METAL
     29 #  define LIBCXXABI_BARE_METAL 0
     30 #endif
     31 
     32 // -- BEGIN Taken from gabixx_config.h for gcc compat
     33 // Clang provides __sync_swap(), but GCC does not.
     34 // IMPORTANT: For GCC, __sync_lock_test_and_set has acquire semantics only
     35 // so an explicit __sync_synchronize is needed to ensure a full barrier.
     36 // TODO(digit): Use __atomic_swap_acq_rel when available.
     37 #if !defined(__clang__)
     38 #  define __sync_swap(address, value)  \
     39   __extension__ ({ \
     40     __typeof__(*(address)) __ret = __sync_lock_test_and_set((address),(value)); \
     41     __sync_synchronize(); \
     42     __ret; \
     43   })
     44 #endif
     45 // -- END Taken from gabixx_config.h for gcc compat
     46 
     47 
     48 #endif // LIBCXXABI_CONFIG_H
     49