[libc-commits] [PATCH] D156923: [libc] Add nullptr check option to printf %s

Michael Jones via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Aug 2 12:54:38 PDT 2023


michaelrj added inline comments.


================
Comment at: libc/test/src/stdio/sprintf_test.cpp:101
+#ifndef LIBC_COPT_PRINTF_NO_NULLPTR_CHECKS
+  written = __llvm_libc::sprintf(buff, "%s", nullptr);
+  EXPECT_EQ(written, 4);
----------------
lntue wrote:
> Also add the expectation for this output when `LIBC_COPT_PRINTF_NO_NULLPTR_CHECKS` is set.
If the flag isn't set, the expectation is for it to segfault so it would have to be a death test. I'm not sure that's a useful test though.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156923



More information about the libc-commits mailing list