mirror of
https://git.mirrors.martin98.com/https://github.com/google/googletest.git
synced 2025-04-23 06:29:53 +08:00
Workaround GCC 12 -Wrestrict false-positive
Suggested workaround from 751760ad54
Fixes #4570
PiperOrigin-RevId: 651044944
Change-Id: I21f099a15dd3182d335a7891d99b9b1293e5c53e
This commit is contained in:
parent
3ef16ef8b3
commit
b4aaf97d8f
@ -71,7 +71,7 @@ inline std::string CanonicalizeForStdLibVersioning(std::string s) {
|
|||||||
// Strip redundant spaces in typename to match MSVC
|
// Strip redundant spaces in typename to match MSVC
|
||||||
// For example, std::pair<int, bool> -> std::pair<int,bool>
|
// For example, std::pair<int, bool> -> std::pair<int,bool>
|
||||||
static const char to_search[] = ", ";
|
static const char to_search[] = ", ";
|
||||||
static const char replace_str[] = ",";
|
const char replace_char = ',';
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
// Get the next occurrence from the current position
|
// Get the next occurrence from the current position
|
||||||
@ -80,8 +80,8 @@ inline std::string CanonicalizeForStdLibVersioning(std::string s) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Replace this occurrence of substring
|
// Replace this occurrence of substring
|
||||||
s.replace(pos, strlen(to_search), replace_str);
|
s.replace(pos, strlen(to_search), 1, replace_char);
|
||||||
pos += strlen(replace_str);
|
++pos;
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user