Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit b1a578a

Browse files
Treehugger RobotGerrit Code Review
authored andcommitted
Merge "libc: suppress libcxx's const-correct string overloads" into main
2 parents 71ff2dc + 61b629d commit b1a578a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

libc/include/string.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,10 @@ char* _Nonnull basename(const char* _Nonnull __path) __RENAME(__gnu_basename) __
185185

186186
/* Const-correct overloads. Placed after FORTIFY so we call those functions, if possible. */
187187
#if defined(__cplusplus)
188-
/*
189-
* Use two enable_ifs so these overloads don't conflict with + are preferred over libcxx's. This can
190-
* be reduced to 1 after libcxx recognizes that we have const-correct overloads.
191-
*/
192-
#define __prefer_this_overload __enable_if(true, "preferred overload") __enable_if(true, "")
188+
/* libcxx tries to provide these. Suppress that, since libcxx's impl doesn't respect FORTIFY. */
189+
#define __CORRECT_ISO_CPP_STRING_H_PROTO
190+
/* Used to make these preferable over regular <string.h> signatures for overload resolution. */
191+
#define __prefer_this_overload __enable_if(true, "")
193192
extern "C++" {
194193
inline __always_inline
195194
void* _Nullable __bionic_memchr(const void* _Nonnull const s __pass_object_size, int c, size_t n) {

0 commit comments

Comments
 (0)