[PATCH] [mips] [test] Enable COMPILER_RT_INCLUDE_TESTS for MIPS

Alexey Samsonov vonosmas at gmail.com
Mon Dec 8 11:33:25 PST 2014


================
Comment at: lib/sanitizer_common/tests/sanitizer_printf_test.cc:34
@@ +33,3 @@
+  strcpy(expectedString, "a-1b-2c4294967292e5fahbq0x");
+  memset(expectedString + 26, '0', SANITIZER_POINTER_FORMAT_LENGTH - 3);
+  strcpy(expectedString + 23 + SANITIZER_POINTER_FORMAT_LENGTH,
----------------
kumarsukhani wrote:
> samsonov wrote:
> > OMG, please no "+26". Just use `std::string` here.
> Sorry didn't got you.
> Should I use ?
> ```
> memset(expectedString + strlen(expectedString), '0', SANITIZER_POINTER_FORMAT_LENGTH - 3);
> ```
No. Please use `std::string` from STL (http://www.cplusplus.com/reference/string/string/). It overloads operator+ and allows you to concatenate strings easier. You also don't have to care about calculating the size of the buffer (in your case you assumed it would never ever be larger than 70) yourself.

http://reviews.llvm.org/D6461






More information about the llvm-commits mailing list