summaryrefslogtreecommitdiff
path: root/src/config.h
blob: a2ece32216cdeaa48994c184d673e3263592b3dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//===----------------------------- config.h -------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//
//  Defines macros used within the libc++abi project.
//
//===----------------------------------------------------------------------===//


#ifndef LIBCXXABI_CONFIG_H
#define LIBCXXABI_CONFIG_H

#include <unistd.h>

#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif

// Configure inline visibility attributes
#if defined(_WIN32)
 #if defined(_MSC_VER) && !defined(__clang__)
  // Using Microsoft Visual C++ compiler
  #define _LIBCXXABI_INLINE_VISIBILITY __forceinline
 #else
  #if __has_attribute(__internal_linkage__)
   #define _LIBCXXABI_INLINE_VISIBILITY __attribute__ ((__internal_linkage__, __always_inline__))
  #else
   #define _LIBCXXABI_INLINE_VISIBILITY __attribute__ ((__always_inline__))
  #endif
 #endif
#else
 #if __has_attribute(__internal_linkage__)
  #define _LIBCXXABI_INLINE_VISIBILITY __attribute__ ((__internal_linkage__, __always_inline__))
 #else
  #define _LIBCXXABI_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
 #endif
#endif

// Try and deduce a threading api if one has not been explicitly set.
#if !defined(_LIBCXXABI_HAS_NO_THREADS) && \
    !defined(_LIBCXXABI_HAS_THREAD_API_EXTERNAL) && \
    !defined(_LIBCXXABI_USE_THREAD_API_PTHREAD)
  #if defined(_POSIX_THREADS) && _POSIX_THREADS >= 0
    #define _LIBCXXABI_USE_THREAD_API_PTHREAD
  #else
    #error "No thread API"
  #endif
#endif

// Set this in the CXXFLAGS when you need it, because otherwise we'd have to
// #if !defined(__linux__) && !defined(__APPLE__) && ...
// and so-on for *every* platform.
#ifndef LIBCXXABI_BAREMETAL
#  define LIBCXXABI_BAREMETAL 0
#endif

#endif // LIBCXXABI_CONFIG_H