Fix spacing.
[gcc.git] / libsanitizer / sanitizer_common / sanitizer_common_libcdep.cc
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 //===----------------------------------------------------------------------===//
11
12 #include "sanitizer_common.h"
13
14 namespace __sanitizer {
15
16 bool PrintsToTty() {
17 MaybeOpenReportFile();
18 return internal_isatty(report_fd) != 0;
19 }
20
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;
26
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;
32 }
33 return prints_to_tty;
34 }
35 } // namespace __sanitizer