]>
Commit | Line | Data |
---|---|---|
f35db108 WM |
1 | //===-- sanitizer/common_interface_defs.h -----------------------*- C++ -*-===// |
2 | // | |
3 | // This file is distributed under the University of Illinois Open Source | |
4 | // License. See LICENSE.TXT for details. | |
5 | // | |
6 | //===----------------------------------------------------------------------===// | |
7 | // | |
8 | // This file is shared between AddressSanitizer and ThreadSanitizer. | |
9 | // It contains basic macro and types. | |
10 | // NOTE: This file may be included into user code. | |
11 | //===----------------------------------------------------------------------===// | |
12 | ||
13 | #ifndef SANITIZER_COMMON_INTERFACE_DEFS_H | |
14 | #define SANITIZER_COMMON_INTERFACE_DEFS_H | |
15 | ||
16 | // ----------- ATTENTION ------------- | |
17 | // This header should NOT include any other headers to avoid portability issues. | |
18 | ||
19 | #if defined(_WIN32) | |
20 | // FIXME find out what we need on Windows. __declspec(dllexport) ? | |
21 | # define SANITIZER_INTERFACE_ATTRIBUTE | |
22 | # define SANITIZER_WEAK_ATTRIBUTE | |
23 | #elif defined(SANITIZER_GO) | |
24 | # define SANITIZER_INTERFACE_ATTRIBUTE | |
25 | # define SANITIZER_WEAK_ATTRIBUTE | |
26 | #else | |
27 | # define SANITIZER_INTERFACE_ATTRIBUTE __attribute__((visibility("default"))) | |
28 | # define SANITIZER_WEAK_ATTRIBUTE __attribute__((weak)) | |
29 | #endif | |
30 | ||
31 | // __has_feature | |
32 | #if !defined(__has_feature) | |
33 | # define __has_feature(x) 0 | |
34 | #endif | |
35 | ||
36 | // For portability reasons we do not include stddef.h, stdint.h or any other | |
37 | // system header, but we do need some basic types that are not defined | |
38 | // in a portable way by the language itself. | |
39 | namespace __sanitizer { | |
40 | ||
41 | #if defined(_WIN64) | |
42 | // 64-bit Windows uses LLP64 data model. | |
43 | typedef unsigned long long uptr; // NOLINT | |
44 | typedef signed long long sptr; // NOLINT | |
45 | #else | |
46 | typedef unsigned long uptr; // NOLINT | |
47 | typedef signed long sptr; // NOLINT | |
48 | #endif // defined(_WIN64) | |
d1caed14 L |
49 | #if defined(__x86_64__) |
50 | // Since x32 uses ILP32 data model in 64-bit hardware mode, we must use | |
51 | // 64-bit pointer to unwind stack frame. | |
52 | typedef unsigned long long uhwptr; // NOLINT | |
53 | #else | |
54 | typedef uptr uhwptr; // NOLINT | |
55 | #endif | |
f35db108 WM |
56 | typedef unsigned char u8; |
57 | typedef unsigned short u16; // NOLINT | |
58 | typedef unsigned int u32; | |
59 | typedef unsigned long long u64; // NOLINT | |
60 | typedef signed char s8; | |
61 | typedef signed short s16; // NOLINT | |
62 | typedef signed int s32; | |
63 | typedef signed long long s64; // NOLINT | |
64 | ||
65 | } // namespace __sanitizer | |
66 | ||
67 | extern "C" { | |
68 | // Tell the tools to write their reports to "path.<pid>" instead of stderr. | |
69 | void __sanitizer_set_report_path(const char *path) | |
70 | SANITIZER_INTERFACE_ATTRIBUTE; | |
71 | } // extern "C" | |
72 | ||
73 | #endif // SANITIZER_COMMON_INTERFACE_DEFS_H |