Daily bump.
[official-gcc.git] / libsanitizer / sanitizer_common / sanitizer_common_libcdep.cc
blob215a61deab632ed0fd60ca7df085f6594a7c23e9
1 //===-- sanitizer_common_libcdep.cc ---------------------------------------===//
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 shared between AddressSanitizer and ThreadSanitizer
9 // run-time libraries.
10 //===----------------------------------------------------------------------===//
12 #include "sanitizer_common.h"
14 namespace __sanitizer {
16 bool PrintsToTty() {
17 MaybeOpenReportFile();
18 return internal_isatty(report_fd) != 0;
21 bool PrintsToTtyCached() {
22 // FIXME: Add proper Windows support to AnsiColorDecorator and re-enable color
23 // printing on Windows.
24 if (SANITIZER_WINDOWS)
25 return 0;
27 static int cached = 0;
28 static bool prints_to_tty;
29 if (!cached) { // Not thread-safe.
30 prints_to_tty = PrintsToTty();
31 cached = 1;
33 return prints_to_tty;
35 } // namespace __sanitizer