[NFC][ubsan_minimal] Clang-format a file (#139000)
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#include "sanitizer_common/sanitizer_atomic.h"
|
#include "sanitizer_common/sanitizer_atomic.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
@@ -9,9 +9,7 @@
|
|||||||
extern "C" void ubsan_message(const char *msg);
|
extern "C" void ubsan_message(const char *msg);
|
||||||
static void message(const char *msg) { ubsan_message(msg); }
|
static void message(const char *msg) { ubsan_message(msg); }
|
||||||
#else
|
#else
|
||||||
static void message(const char *msg) {
|
static void message(const char *msg) { (void)write(2, msg, strlen(msg)); }
|
||||||
(void)write(2, msg, strlen(msg));
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const int kMaxCallerPcs = 20;
|
static const int kMaxCallerPcs = 20;
|
||||||
@@ -62,16 +60,18 @@ SANITIZER_INTERFACE_WEAK_DEF(void, __ubsan_report_error, const char *kind,
|
|||||||
uintptr_t p;
|
uintptr_t p;
|
||||||
for (unsigned i = 0; i < sz; ++i) {
|
for (unsigned i = 0; i < sz; ++i) {
|
||||||
p = __sanitizer::atomic_load_relaxed(&caller_pcs[i]);
|
p = __sanitizer::atomic_load_relaxed(&caller_pcs[i]);
|
||||||
if (p == 0) break; // Concurrent update.
|
if (p == 0)
|
||||||
|
break; // Concurrent update.
|
||||||
if (p == caller)
|
if (p == caller)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (p == 0) continue; // FIXME: yield?
|
if (p == 0)
|
||||||
|
continue; // FIXME: yield?
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!__sanitizer::atomic_compare_exchange_strong(
|
if (!__sanitizer::atomic_compare_exchange_strong(
|
||||||
&caller_pcs_sz, &sz, sz + 1, __sanitizer::memory_order_seq_cst))
|
&caller_pcs_sz, &sz, sz + 1, __sanitizer::memory_order_seq_cst))
|
||||||
continue; // Concurrent update! Try again from the start.
|
continue; // Concurrent update! Try again from the start.
|
||||||
|
|
||||||
if (sz == kMaxCallerPcs) {
|
if (sz == kMaxCallerPcs) {
|
||||||
message("ubsan: too many errors\n");
|
message("ubsan: too many errors\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user