[PATCH] D63612: [scudo][standalone] Introduce the C & C++ wrappers

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 24 13:40:22 PDT 2019


cryptoad marked 7 inline comments as done.
cryptoad added inline comments.


================
Comment at: lib/scudo/standalone/tests/wrappers_c_test.cc:78
+  if (SCUDO_ANDROID)
+    EXPECT_EQ(errno, ENOMEM);
+}
----------------
morehouse wrote:
> Why do we only check errno on Android?  If calloc returns nullptr, I'd expect errno to be set.
You are right. I somehow thought there was nothing specified in the standard for an errno for int overflow, but I found the following: "The UNIX 98 standard requires malloc(), calloc(), and realloc() to set errno to ENOMEM upon failure.", which I assume covers that case as well. I updated the wrappers accordingly. Thanks!


================
Comment at: lib/scudo/standalone/tests/wrappers_c_test.cc:104
+
+  // Android's memalign accepts non power-of-2 alignments, and 0.
+  if (SCUDO_ANDROID) {
----------------
morehouse wrote:
> Just curious -- why?
Backward compatibility with badly written code probably. There is a unit test in Bionic for it, so I have to support the use case, but I do not want it to bleed to other platforms.


================
Comment at: lib/scudo/standalone/tests/wrappers_cpp_test.cc:69
+  testCxxNew<double>();
+  testCxxNew<long double>();
+}
----------------
morehouse wrote:
> Maybe test a class type as well?
Will add some.


Repository:
  rCRT Compiler Runtime

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63612/new/

https://reviews.llvm.org/D63612





More information about the llvm-commits mailing list