PR tree-optimization/84480 - bogus -Wstringop-truncation despite assignment with...
[official-gcc.git] / libsanitizer / include / sanitizer / esan_interface.h
blobcd18f34fc00be8ff57f1c4c290acd6b3ab98ee0f
1 //===-- sanitizer/esan_interface.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 a part of EfficiencySanitizer, a family of performance tuners.
9 //
10 // Public interface header.
11 //===----------------------------------------------------------------------===//
12 #ifndef SANITIZER_ESAN_INTERFACE_H
13 #define SANITIZER_ESAN_INTERFACE_H
15 #include <sanitizer/common_interface_defs.h>
17 // We declare our interface routines as weak to allow the user to avoid
18 // ifdefs and instead use this pattern to allow building the same sources
19 // with and without our runtime library:
20 // if (__esan_report)
21 // __esan_report();
22 #ifdef _MSC_VER
23 /* selectany is as close to weak as we'll get. */
24 #define COMPILER_RT_WEAK __declspec(selectany)
25 #elif __GNUC__
26 #define COMPILER_RT_WEAK __attribute__((weak))
27 #else
28 #define COMPILER_RT_WEAK
29 #endif
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
35 // This function can be called mid-run (or at the end of a run for
36 // a server process that doesn't shut down normally) to request that
37 // data for that point in the run be reported from the tool.
38 void COMPILER_RT_WEAK __esan_report();
40 // This function returns the number of samples that the esan tool has collected
41 // to this point. This is useful for testing.
42 unsigned int COMPILER_RT_WEAK __esan_get_sample_count();
44 #ifdef __cplusplus
45 } // extern "C"
46 #endif
48 #endif // SANITIZER_ESAN_INTERFACE_H