[libc-commits] [PATCH] D129808: [libc] add unsafe mode to strlen
Siva Chandra via Phabricator via libc-commits
libc-commits at lists.llvm.org
Fri Jul 15 11:37:43 PDT 2022
sivachandra added inline comments.
================
Comment at: libc/src/string/CMakeLists.txt:11
.memory_utils.memset_implementation
+ FLAGS
+ LLVM_LIBC_STRLEN_UNSAFE
----------------
michaelrj wrote:
> lntue wrote:
> > sivachandra wrote:
> > > I do not think this will do anything at all without a flag applier implemented somewhere. Also, can we consider a design without the FLAGS feature for comparison?
> > To make `FLAGS` property become a compile flag, you'll need to update `_get_common_compile_options` at https://github.com/llvm/llvm-project/blob/main/libc/cmake/modules/LLVMLibCObjectRules.cmake#L3 similar to `FMA_OPT`. In your case the compile option to be append should be `-DLLVM_LIBC_STRLEN_UNSAFE` for gcc/clang and `/DLLVM_LIBC_STRLEN_UNSAFE` for MSVC.
> I'm not sure what you mean by "a design without the FLAGS feature", do you mean just having the flag in the code and letting users add it to their build manually?
The setting to use the unsafe path or not has to be done via some config time CMake option. So, there has to be some manual setting somewhere. For most users, we will have a default making the manual setting unnecessary.
By, "a design without the FLAGS feature", I mean that we should provide a CMake option which does not go through the FLAGS machinery.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129808/new/
https://reviews.llvm.org/D129808
More information about the libc-commits
mailing list