Skip to content

Commit b8195e3

Browse files
authored
[libc] Fix typo and amend restrict qualifier (llvm#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).
1 parent 27ed1f9 commit b8195e3

File tree

7 files changed

+13
-9
lines changed

7 files changed

+13
-9
lines changed

libc/include/dlfcn.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ enums:
4646
standards:
4747
- gnu
4848
value: 2
49-
- name: RTLD_DI_CONFIGADDR,
49+
- name: RTLD_DI_CONFIGADDR
5050
standards:
5151
- gnu
5252
value: 3
@@ -127,5 +127,5 @@ functions:
127127
- POSIX
128128
return_type: int
129129
arguments:
130-
- type: const void *
131-
- type: Dl_info *
130+
- type: const void *__restrict
131+
- type: Dl_info *__restrict

libc/src/dlfcn/dladdr.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
namespace LIBC_NAMESPACE_DECL {
1515

1616
// TODO: https:// github.com/llvm/llvm-project/issues/97929
17-
LLVM_LIBC_FUNCTION(int, dladdr, (const void *addr, Dl_info *info)) {
17+
LLVM_LIBC_FUNCTION(int, dladdr,
18+
(const void *__restrict addr, Dl_info *__restrict info)) {
1819
return -1;
1920
}
2021

libc/src/dlfcn/dladdr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace LIBC_NAMESPACE_DECL {
1515

16-
int dladdr(const void *, Dl_info *);
16+
int dladdr(const void *__restrict, Dl_info *__restrict);
1717

1818
} // namespace LIBC_NAMESPACE_DECL
1919

libc/src/dlfcn/dlinfo.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ namespace LIBC_NAMESPACE_DECL {
1616

1717
// TODO: https://github.com/llvm/llvm-project/issues/149911
1818
LLVM_LIBC_FUNCTION(int, dlinfo,
19-
(void *restrict handle, int request, void *restrict info)) {
19+
(void *__restrict handle, int request,
20+
void *__restrict info)) {
2021
return -1;
2122
}
2223

libc/src/dlfcn/dlinfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace LIBC_NAMESPACE_DECL {
1515

16-
int dlinfo(void *restrict, int, void *restrict);
16+
int dlinfo(void *__restrict, int, void *__restrict);
1717

1818
} // namespace LIBC_NAMESPACE_DECL
1919

libc/src/dlfcn/dlsym.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
namespace LIBC_NAMESPACE_DECL {
1515

1616
// TODO(@izaakschroeder): https://github.com/llvm/llvm-project/issues/97920
17-
LLVM_LIBC_FUNCTION(void *, dlsym, (void *, const char *)) { return nullptr; }
17+
LLVM_LIBC_FUNCTION(void *, dlsym, (void *__restrict, const char *__restrict)) {
18+
return nullptr;
19+
}
1820

1921
} // namespace LIBC_NAMESPACE_DECL

libc/src/dlfcn/dlsym.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace LIBC_NAMESPACE_DECL {
1515

16-
void *dlsym(void *, const char *);
16+
void *dlsym(void *__restrict, const char *__restrict);
1717

1818
} // namespace LIBC_NAMESPACE_DECL
1919

0 commit comments

Comments
 (0)