aboutsummaryrefslogtreecommitdiff
path: root/lib/c
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2025-07-16 18:33:15 +0200
committerAlex Rønne Petersen <alex@alexrp.com>2025-08-30 06:36:41 +0200
commite9ac2ce1167f0f2f86d824549b8ab04d1028129c (patch)
tree4a0323bfbcd819650b1701bdcca29cb676d5be7c /lib/c
parentdfa55e193d04ad96c0049a48f58412ebb12c08ab (diff)
downloadzig-e9ac2ce1167f0f2f86d824549b8ab04d1028129c.tar.gz
zig-e9ac2ce1167f0f2f86d824549b8ab04d1028129c.zip
compiler-rt: move strlen from libzigc to here
LLVM 21 has started recognizing strlen-like idioms and optimizing them to strlen calls, so we need this function provided in compiler-rt for libc-less compilations.
Diffstat (limited to 'lib/c')
-rw-r--r--lib/c/string.zig5
1 files changed, 0 insertions, 5 deletions
diff --git a/lib/c/string.zig b/lib/c/string.zig
index e846c4d960..a644093af5 100644
--- a/lib/c/string.zig
+++ b/lib/c/string.zig
@@ -4,7 +4,6 @@ const common = @import("common.zig");
comptime {
@export(&strcmp, .{ .name = "strcmp", .linkage = common.linkage, .visibility = common.visibility });
- @export(&strlen, .{ .name = "strlen", .linkage = common.linkage, .visibility = common.visibility });
@export(&strncmp, .{ .name = "strncmp", .linkage = common.linkage, .visibility = common.visibility });
@export(&strcasecmp, .{ .name = "strcasecmp", .linkage = common.linkage, .visibility = common.visibility });
@export(&strncasecmp, .{ .name = "strncasecmp", .linkage = common.linkage, .visibility = common.visibility });
@@ -103,7 +102,3 @@ test strncmp {
try std.testing.expect(strncmp(@ptrCast("b"), @ptrCast("a"), 1) > 0);
try std.testing.expect(strncmp(@ptrCast("\xff"), @ptrCast("\x02"), 1) > 0);
}
-
-fn strlen(s: [*:0]const c_char) callconv(.c) usize {
- return std.mem.len(s);
-}