From 72b40fbf4dbe2f95a4592905fff4b0c1fe69b152 Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Thu, 20 Jul 2017 18:43:56 +0000 Subject: [PATCH] Revert "[compiler-rt] Reorder functions to have smaller stack frames" Does not compile. This reverts commit r308650. llvm-svn: 308651 --- .../lib/sanitizer_common/sanitizer_printf.cc | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_printf.cc b/compiler-rt/lib/sanitizer_common/sanitizer_printf.cc index 101c3fb79b86..b14675a06aca 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_printf.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_printf.cc @@ -231,23 +231,17 @@ static void CallPrintfAndReportCallback(const char *str) { static void SharedPrintfCode(bool append_pid, const char *format, va_list args) { + va_list args2; + va_copy(args2, args); + const int kLen = 16 * 1024; // |local_buffer| is small enough not to overflow the stack and/or violate // the stack limit enforced by TSan (-Wframe-larger-than=512). On the other // hand, the bigger the buffer is, the more the chance the error report will // fit into it. char local_buffer[400]; - SharedPrintfCodeNoBuffer(append_pid, local_buffer, ARRAY_SIZE(local_buffer), - format, va_list args); -} - -static void SharedPrintfCodeNoBuffer(bool append_pid, char *local_buffer, - int buffer_size, const char *format, - va_list args) { - va_list args2; - va_copy(args2, args); - const int kLen = 16 * 1024; int needed_length; char *buffer = local_buffer; + int buffer_size = ARRAY_SIZE(local_buffer); // First try to print a message using a local buffer, and then fall back to // mmaped buffer. for (int use_mmap = 0; use_mmap < 2; use_mmap++) {