2012-08-29 10:27:54 +08:00
|
|
|
//===-- sanitizer/common_interface_defs.h -----------------------*- C++ -*-===//
|
2012-06-05 21:50:57 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file is shared between AddressSanitizer and ThreadSanitizer.
|
|
|
|
// It contains basic macro and types.
|
|
|
|
// NOTE: This file may be included into user code.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-08-29 10:27:54 +08:00
|
|
|
#ifndef SANITIZER_COMMON_INTERFACE_DEFS_H
|
|
|
|
#define SANITIZER_COMMON_INTERFACE_DEFS_H
|
2012-06-05 21:50:57 +08:00
|
|
|
|
|
|
|
// ----------- ATTENTION -------------
|
|
|
|
// This header should NOT include any other headers to avoid portability issues.
|
|
|
|
|
|
|
|
#if defined(_WIN32)
|
|
|
|
// FIXME find out what we need on Windows. __declspec(dllexport) ?
|
|
|
|
# define SANITIZER_INTERFACE_ATTRIBUTE
|
|
|
|
# define SANITIZER_WEAK_ATTRIBUTE
|
2012-07-06 00:18:28 +08:00
|
|
|
#elif defined(SANITIZER_GO)
|
|
|
|
# define SANITIZER_INTERFACE_ATTRIBUTE
|
|
|
|
# define SANITIZER_WEAK_ATTRIBUTE
|
|
|
|
#else
|
2012-06-05 21:50:57 +08:00
|
|
|
# define SANITIZER_INTERFACE_ATTRIBUTE __attribute__((visibility("default")))
|
|
|
|
# define SANITIZER_WEAK_ATTRIBUTE __attribute__((weak))
|
2012-07-06 00:18:28 +08:00
|
|
|
#endif
|
2012-06-05 21:50:57 +08:00
|
|
|
|
|
|
|
// __has_feature
|
|
|
|
#if !defined(__has_feature)
|
|
|
|
# define __has_feature(x) 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// For portability reasons we do not include stddef.h, stdint.h or any other
|
|
|
|
// system header, but we do need some basic types that are not defined
|
|
|
|
// in a portable way by the language itself.
|
|
|
|
namespace __sanitizer {
|
|
|
|
|
|
|
|
typedef unsigned long uptr; // NOLINT
|
|
|
|
typedef signed long sptr; // NOLINT
|
|
|
|
typedef unsigned char u8;
|
|
|
|
typedef unsigned short u16; // NOLINT
|
|
|
|
typedef unsigned int u32;
|
|
|
|
typedef unsigned long long u64; // NOLINT
|
|
|
|
typedef signed char s8;
|
|
|
|
typedef signed short s16; // NOLINT
|
|
|
|
typedef signed int s32;
|
|
|
|
typedef signed long long s64; // NOLINT
|
|
|
|
|
|
|
|
} // namespace __sanitizer
|
|
|
|
|
2012-09-14 12:35:14 +08:00
|
|
|
extern "C" {
|
|
|
|
// Tell the tools to write their reports to "path.<pid>" instead of stderr.
|
|
|
|
void __sanitizer_set_report_path(const char *path)
|
|
|
|
SANITIZER_INTERFACE_ATTRIBUTE;
|
|
|
|
} // extern "C"
|
|
|
|
|
2012-08-29 10:27:54 +08:00
|
|
|
#endif // SANITIZER_COMMON_INTERFACE_DEFS_H
|