Skip to content

Commit 51ca757

Browse files
committed
[sanitizer_common] Disable filesystem-related code for Fuchsia
Summary: Fuchsia doesn't support filesystem access per se at low level. So it won't use any of the filesystem-oriented code in sanitizer_common. Submitted on behalf of Roland McGrath. Reviewers: vitalybuka, alekseyshl, kcc Reviewed By: vitalybuka Subscribers: kubamracek, phosek, filcab, llvm-commits Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D36029 llvm-svn: 309749
1 parent 50692a2 commit 51ca757

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cc

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,25 @@
2626

2727
namespace __sanitizer {
2828

29+
#if !SANITIZER_FUCHSIA
30+
2931
bool ReportFile::SupportsColors() {
3032
SpinMutexLock l(mu);
3133
ReopenIfNecessary();
3234
return SupportsColoredOutput(fd);
3335
}
3436

37+
static INLINE bool ReportSupportsColors() {
38+
return report_file.SupportsColors();
39+
}
40+
41+
#else // SANITIZER_FUCHSIA
42+
43+
// Fuchsia's logs always go through post-processing that handles colorization.
44+
static INLINE bool ReportSupportsColors() { return true; }
45+
46+
#endif // !SANITIZER_FUCHSIA
47+
3548
bool ColorizeReports() {
3649
// FIXME: Add proper Windows support to AnsiColorDecorator and re-enable color
3750
// printing on Windows.
@@ -40,7 +53,7 @@ bool ColorizeReports() {
4053

4154
const char *flag = common_flags()->color;
4255
return internal_strcmp(flag, "always") == 0 ||
43-
(internal_strcmp(flag, "auto") == 0 && report_file.SupportsColors());
56+
(internal_strcmp(flag, "auto") == 0 && ReportSupportsColors());
4457
}
4558

4659
static void (*sandboxing_callback)();

compiler-rt/lib/sanitizer_common/sanitizer_file.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
//
1515
//===---------------------------------------------------------------------===//
1616

17+
#include "sanitizer_platform.h"
18+
19+
#if !SANITIZER_FUCHSIA
20+
1721
#include "sanitizer_common.h"
1822
#include "sanitizer_file.h"
1923

@@ -169,3 +173,5 @@ void __sanitizer_set_report_fd(void *fd) {
169173
report_file.fd_pid = internal_getpid();
170174
}
171175
} // extern "C"
176+
177+
#endif // !SANITIZER_FUCHSIA

compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ void SuppressionContext::ParseFromFile(const char *filename) {
5151
if (filename[0] == '\0')
5252
return;
5353

54+
#if !SANITIZER_FUCHSIA
5455
// If we cannot find the file, check if its location is relative to
5556
// the location of the executable.
5657
InternalScopedString new_file_path(kMaxPathLength);
@@ -59,6 +60,7 @@ void SuppressionContext::ParseFromFile(const char *filename) {
5960
new_file_path.size())) {
6061
filename = new_file_path.data();
6162
}
63+
#endif // !SANITIZER_FUCHSIA
6264

6365
// Read the file.
6466
VPrintf(1, "%s: reading suppressions file at %s\n",

0 commit comments

Comments
 (0)