[libc-commits] [libc] [lib] Fix typo and amend restrict qualifier (PR #152410)
Caslyn Tonelli via libc-commits
libc-commits at lists.llvm.org
Wed Aug 6 16:49:14 PDT 2025
https://github.com/Caslyn created https://github.com/llvm/llvm-project/pull/152410
This removes an extraneous ',' in the generated dlfcn header.
This also adds `__restrict` to `dladdr`'s declaration per POSIX. Another fix is made: the C standard `restrict` keyword is removed from dlinfo.cpp/dlinfo.h (but note that dlfcn.yaml still annotates `__restrict` for dlinfo's decl).
>From f3ca4fa844cc8791dc30c3edc298d3388aceba53 Mon Sep 17 00:00:00 2001
From: Caslyn Tonelli <caslyn at google.com>
Date: Wed, 6 Aug 2025 16:39:55 -0700
Subject: [PATCH] [lib] Fix typo and amend restrict qualifier
This removes an extraneous ',' in the generated dlfcn header.
This also adds `__restrict` to `dladdr`'s declaration per POSIX. The
`restrict` C standard keyword is removed from dlinfo.cpp/dlinfo.h
(but note that the dlinfo's declaration in dlfcn.h still annoates
__restrict in the decl).
---
libc/include/dlfcn.yaml | 6 +++---
libc/src/dlfcn/dlinfo.cpp | 3 +--
libc/src/dlfcn/dlinfo.h | 2 +-
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/libc/include/dlfcn.yaml b/libc/include/dlfcn.yaml
index db2893aaff5d9..bf17a11111050 100644
--- a/libc/include/dlfcn.yaml
+++ b/libc/include/dlfcn.yaml
@@ -46,7 +46,7 @@ enums:
standards:
- gnu
value: 2
- - name: RTLD_DI_CONFIGADDR,
+ - name: RTLD_DI_CONFIGADDR
standards:
- gnu
value: 3
@@ -127,5 +127,5 @@ functions:
- POSIX
return_type: int
arguments:
- - type: const void *
- - type: Dl_info *
+ - type: const void *__restrict
+ - type: Dl_info *__restrict
diff --git a/libc/src/dlfcn/dlinfo.cpp b/libc/src/dlfcn/dlinfo.cpp
index d78cade5ea593..ec2b0fe1464bc 100644
--- a/libc/src/dlfcn/dlinfo.cpp
+++ b/libc/src/dlfcn/dlinfo.cpp
@@ -15,8 +15,7 @@
namespace LIBC_NAMESPACE_DECL {
// TODO: https://github.com/llvm/llvm-project/issues/149911
-LLVM_LIBC_FUNCTION(int, dlinfo,
- (void *restrict handle, int request, void *restrict info)) {
+LLVM_LIBC_FUNCTION(int, dlinfo, (void *handle, int request, void *info)) {
return -1;
}
diff --git a/libc/src/dlfcn/dlinfo.h b/libc/src/dlfcn/dlinfo.h
index c2c34f02bd6f1..98f627636a34c 100644
--- a/libc/src/dlfcn/dlinfo.h
+++ b/libc/src/dlfcn/dlinfo.h
@@ -13,7 +13,7 @@
namespace LIBC_NAMESPACE_DECL {
-int dlinfo(void *restrict, int, void *restrict);
+int dlinfo(void *, int, void *);
} // namespace LIBC_NAMESPACE_DECL
More information about the libc-commits
mailing list