interception_type_test.cpp revision 360784
1103026Ssobomax//===-- interception_type_test.cpp ------------------------------*- C++ -*-===//
2103026Ssobomax//
3103026Ssobomax// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4103026Ssobomax// See https://llvm.org/LICENSE.txt for license information.
5103026Ssobomax// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6103026Ssobomax//
7103026Ssobomax//===----------------------------------------------------------------------===//
8103026Ssobomax//
9103026Ssobomax// This file is a part of AddressSanitizer, an address sanity checker.
10103026Ssobomax//
11103026Ssobomax// Compile-time tests of the internal type definitions.
12103026Ssobomax//===----------------------------------------------------------------------===//
13103026Ssobomax
14103026Ssobomax#include "interception.h"
15103026Ssobomax
16103026Ssobomax#if SANITIZER_LINUX || SANITIZER_MAC
17103026Ssobomax
18103026Ssobomax#include <sys/types.h>
19103026Ssobomax#include <stddef.h>
20103026Ssobomax#include <stdint.h>
21103026Ssobomax
22103026SsobomaxCOMPILER_CHECK(sizeof(::SIZE_T) == sizeof(size_t));
23103026SsobomaxCOMPILER_CHECK(sizeof(::SSIZE_T) == sizeof(ssize_t));
24103026SsobomaxCOMPILER_CHECK(sizeof(::PTRDIFF_T) == sizeof(ptrdiff_t));
25103026SsobomaxCOMPILER_CHECK(sizeof(::INTMAX_T) == sizeof(intmax_t));
26103026Ssobomax
27103026Ssobomax#if !SANITIZER_MAC
28103026SsobomaxCOMPILER_CHECK(sizeof(::OFF64_T) == sizeof(off64_t));
29103026Ssobomax#endif
30103026Ssobomax
31103026Ssobomax// The following are the cases when pread (and friends) is used instead of
32103026Ssobomax// pread64. In those cases we need OFF_T to match off_t. We don't care about the
33103026Ssobomax// rest (they depend on _FILE_OFFSET_BITS setting when building an application).
34103026Ssobomax# if SANITIZER_ANDROID || !defined _FILE_OFFSET_BITS || \
35103026Ssobomax  _FILE_OFFSET_BITS != 64
36103026SsobomaxCOMPILER_CHECK(sizeof(::OFF_T) == sizeof(off_t));
37103026Ssobomax# endif
38103026Ssobomax
39103026Ssobomax#endif
40103026Ssobomax