1 //===-- interception_type_test.cc -------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file is a part of AddressSanitizer, an address sanity checker. 11 // 12 // Compile-time tests of the internal type definitions. 13 //===----------------------------------------------------------------------===// 14 15 #include "interception.h" 16 17 #if SANITIZER_LINUX || SANITIZER_MAC 18 19 #include <sys/types.h> 20 #include <stddef.h> 21 #include <stdint.h> 22 23 COMPILER_CHECK(sizeof(::SIZE_T) == sizeof(size_t)); 24 COMPILER_CHECK(sizeof(::SSIZE_T) == sizeof(ssize_t)); 25 COMPILER_CHECK(sizeof(::PTRDIFF_T) == sizeof(ptrdiff_t)); 26 COMPILER_CHECK(sizeof(::INTMAX_T) == sizeof(intmax_t)); 27 28 #if !SANITIZER_MAC 29 COMPILER_CHECK(sizeof(::OFF64_T) == sizeof(off64_t)); 30 #endif 31 32 // The following are the cases when pread (and friends) is used instead of 33 // pread64. In those cases we need OFF_T to match off_t. We don't care about the 34 // rest (they depend on _FILE_OFFSET_BITS setting when building an application). 35 # if SANITIZER_ANDROID || !defined _FILE_OFFSET_BITS || \ 36 _FILE_OFFSET_BITS != 64 37 COMPILER_CHECK(sizeof(::OFF_T) == sizeof(off_t)); 38 # endif 39 40 #endif 41