[compiler-rt] r330476 - Revert "[Sanitizer] Internal Printf string precision argument + padding."
Alex Shlyapnikov via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 20 13:24:03 PDT 2018
Author: alekseyshl
Date: Fri Apr 20 13:24:02 2018
New Revision: 330476
URL: http://llvm.org/viewvc/llvm-project?rev=330476&view=rev
Log:
Revert "[Sanitizer] Internal Printf string precision argument + padding."
This reverts commit r330458.
There are existing code using string precision as 'max len', need more
work.
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_printf.cc
compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_printf_test.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_printf.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_printf.cc?rev=330476&r1=330475&r2=330476&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_printf.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_printf.cc Fri Apr 20 13:24:02 2018
@@ -105,8 +105,6 @@ static int AppendString(char **buff, con
break;
result += AppendChar(buff, buff_end, *s);
}
- while (result < precision)
- result += AppendChar(buff, buff_end, ' ');
return result;
}
Modified: compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_printf_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_printf_test.cc?rev=330476&r1=330475&r2=330476&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_printf_test.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_printf_test.cc Fri Apr 20 13:24:02 2018
@@ -146,13 +146,8 @@ TEST(Printf, Precision) {
EXPECT_EQ(3U, len);
EXPECT_STREQ("123", buf);
len = internal_snprintf(buf, sizeof(buf), "%.*s", 6, "12345");
- EXPECT_EQ(6U, len);
- EXPECT_STREQ("12345 ", buf);
- // CHeck that precision does not overflow the smaller buffer, although
- // 10 chars is requested, it stops at the buffer size, 8.
- len = internal_snprintf(buf, 8, "%.*s", 10, "12345");
- EXPECT_EQ(10U, len); // The required size reported.
- EXPECT_STREQ("12345 ", buf);
+ EXPECT_EQ(5U, len);
+ EXPECT_STREQ("12345", buf);
}
} // namespace __sanitizer
More information about the llvm-commits
mailing list