about summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2023-11-06 08:26:19 -0500
committerRich Felker <dalias@aerifal.cx>2023-11-06 08:26:19 -0500
commit725e17ed6dff4d0cd22487bb64470881e86a92e7 (patch)
tree1993f74c07bc9d5a18b3e7cdb794cc31b989a849 /include
parent6be76895f6863100a311d474a42abdbb6466189d (diff)
downloadmusl-725e17ed6dff4d0cd22487bb64470881e86a92e7.tar.gz
musl-725e17ed6dff4d0cd22487bb64470881e86a92e7.tar.xz
musl-725e17ed6dff4d0cd22487bb64470881e86a92e7.zip
remove non-prototype declaration of basename from string.h
commit 37bb3cce4598c19288628e675eaf1cda6e96958f suppressed the
declaration for C++, where it is wrongly interpreted as declaring the
function as taking no arguments. with C23 removing non-prototype
declarations, that problem is now also relevant to C.

the non-prototype declaration for basename originates with commit
06aec8d7152dfb8360cb7ed9b3d7215ca0b0b500, where it was designed to
avoid conflicts with programs which declare basename with the GNU
signature taking const char *. that change was probably misguided, as
it represents not only misaligned expectations with the caller, but
also undefined behavior (calling a function that's been declared with
the wrong type).

we could opt to fix the declaration, but since glibc, with the
gratuitously incompatible GNU-basename function, seems to be the only
implementation that declares it in string.h, it seems better to just
remove the declaration. this provides some warning if applications are
being built expecting the GNU behavior but not getting it. if we
declared it here, it would only produce a warning if the caller also
declares it themselves (rare) or if the caller attempts to pass a
const-qualified pointer.
Diffstat (limited to 'include')
-rw-r--r--include/string.h3
1 files changed, 0 insertions, 3 deletions
diff --git a/include/string.h b/include/string.h
index db73d2a9..83e2b946 100644
--- a/include/string.h
+++ b/include/string.h
@@ -95,9 +95,6 @@ char *strchrnul(const char *, int);
 char *strcasestr(const char *, const char *);
 void *memrchr(const void *, int, size_t);
 void *mempcpy(void *, const void *, size_t);
-#ifndef __cplusplus
-char *basename();
-#endif
 #endif
 
 #ifdef __cplusplus