xref: /llvm-project/compiler-rt/lib/ubsan/ubsan_platform.h (revision 6478ef61b1a4dd86f520b199e0fd6762e8306353)
10781e98cSAlexey Samsonov //===-- ubsan_platform.h ----------------------------------------*- C++ -*-===//
20781e98cSAlexey Samsonov //
32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60781e98cSAlexey Samsonov //
70781e98cSAlexey Samsonov //===----------------------------------------------------------------------===//
80781e98cSAlexey Samsonov //
90781e98cSAlexey Samsonov // Defines the platforms which UBSan is supported at.
100781e98cSAlexey Samsonov //
110781e98cSAlexey Samsonov //===----------------------------------------------------------------------===//
120781e98cSAlexey Samsonov #ifndef UBSAN_PLATFORM_H
130781e98cSAlexey Samsonov #define UBSAN_PLATFORM_H
140781e98cSAlexey Samsonov 
150781e98cSAlexey Samsonov // Other platforms should be easy to add, and probably work as-is.
167cde4676SKamil Rytarowski #if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__) ||        \
1761fc02dcSDavid CARLIER     defined(__NetBSD__) || defined(__DragonFly__) ||                           \
18b8919fb0SVitaly Buka     (defined(__sun__) && defined(__svr4__)) || defined(_WIN32) ||              \
19*6478ef61SVitaly Buka     defined(__Fuchsia__)
20d3b9917dSPeter Collingbourne #define CAN_SANITIZE_UB 1
210781e98cSAlexey Samsonov #else
220781e98cSAlexey Samsonov # define CAN_SANITIZE_UB 0
230781e98cSAlexey Samsonov #endif
240781e98cSAlexey Samsonov 
250781e98cSAlexey Samsonov #endif
26