Enable compiler errors for implicit switch case fallthroughs.
Also unify warning options across Clang and GCC and fix minor issues that was surfaced by this. PiperOrigin-RevId: 508619655 Change-Id: I59b777bf2dfea4422485670e2427c7d3f5cf6405
This commit is contained in:
committed by
Copybara-Service
parent
8a53a33fd1
commit
5e989d18c3
+10
-1
@@ -73,7 +73,16 @@ static inline int sprintf_arr(char (&dest)[N], const char* format, ...) {
|
||||
// dest is guaranteed to be null-terminated
|
||||
template <std::size_t N>
|
||||
static inline char* strcat_arr(char (&dest)[N], const char* src) {
|
||||
return std::strncat(dest, src, sizeof_arr(dest) - strlen_arr(dest) - 1);
|
||||
const std::size_t dest_len = strlen_arr(dest);
|
||||
const std::size_t dest_size = sizeof_arr(dest);
|
||||
for (std::size_t i = dest_len; i < dest_size; ++i) {
|
||||
dest[i] = src[i - dest_len];
|
||||
if (!dest[i]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
dest[dest_size - 1] = '\0';
|
||||
return dest;
|
||||
}
|
||||
|
||||
// like std::strcpy but won't write beyond the bound of dest
|
||||
|
||||
Reference in New Issue
Block a user