[libc-commits] [libc] [libc] Fix type signature for strlcpy and strlcat (PR #104643)
via libc-commits
libc-commits at lists.llvm.org
Fri Aug 16 14:43:37 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: Joseph Huber (jhuber6)
<details>
<summary>Changes</summary>
Summary:
These should not be const on the destination pointer.
---
Full diff: https://github.com/llvm/llvm-project/pull/104643.diff
2 Files Affected:
- (modified) libc/newhdrgen/yaml/string.yaml (+2-2)
- (modified) libc/spec/bsd_ext.td (+2-2)
``````````diff
diff --git a/libc/newhdrgen/yaml/string.yaml b/libc/newhdrgen/yaml/string.yaml
index 387ea9ec4e1422..1d6e64bfb9cf60 100644
--- a/libc/newhdrgen/yaml/string.yaml
+++ b/libc/newhdrgen/yaml/string.yaml
@@ -181,7 +181,7 @@ functions:
- BSDExtensions
return_type: size_t
arguments:
- - type: const char *__restrict
+ - type: char *__restrict
- type: const char *__restrict
- type: size_t
- name: strlcpy
@@ -189,7 +189,7 @@ functions:
- BSDExtensions
return_type: size_t
arguments:
- - type: const char *__restrict
+ - type: char *__restrict
- type: const char *__restrict
- type: size_t
- name: strlen
diff --git a/libc/spec/bsd_ext.td b/libc/spec/bsd_ext.td
index 4d33313521735e..2b91324e36db9a 100644
--- a/libc/spec/bsd_ext.td
+++ b/libc/spec/bsd_ext.td
@@ -20,12 +20,12 @@ def BsdExtensions : StandardSpec<"BSDExtensions"> {
FunctionSpec<
"strlcat",
RetValSpec<SizeTType>,
- [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>, ArgSpec<SizeTType>]
+ [ArgSpec<CharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>, ArgSpec<SizeTType>]
>,
FunctionSpec<
"strlcpy",
RetValSpec<SizeTType>,
- [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>, ArgSpec<SizeTType>]
+ [ArgSpec<CharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>, ArgSpec<SizeTType>]
>,
FunctionSpec<
"strsep",
``````````
</details>
https://github.com/llvm/llvm-project/pull/104643
More information about the libc-commits
mailing list