[libc-commits] [libc] [libc] Fix typo and amend restrict qualifier (PR #152410)
Roland McGrath via libc-commits
libc-commits at lists.llvm.org
Thu Aug 7 11:19:50 PDT 2025
================
@@ -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)) {
----------------
frobtech wrote:
For standard qualifiers like this, the declaration is authoritative and if the definition doesn't match and the compiler doesn't make that an error then it means it doesn't change the semantics to have it only on the declaration. (The situation is different for certain attributes.)
However, note that there won't be any cross-checking of the public (`extern "C"`) signature and the namespaced internal signature unless you're doing a production build where the definitions are aliases and the compiler will complain about mismatches. So it's important to take care that the `src/fooheader/barfunc.h` internal declaration precisely matches the public C signature in the generated public function.
And, notwithstanding the first paragraph, for comprehensibility and maintenance reasons, it should always be our practice to use the full precise signature in the definition just as it is in the definition (modulo function attributes).
Ergo, this is missing dladdr.{cpp,h} changes to match the generated declaration, and dlinfo.{cpp,h}| were better as they were.
https://github.com/llvm/llvm-project/pull/152410
More information about the libc-commits
mailing list