forked from OSchip/llvm-project
[TSan] fix a bunch of warnings reported by pedantic gcc
llvm-svn: 163788
This commit is contained in:
parent
c1ca1fe255
commit
046248c509
|
@ -1366,11 +1366,11 @@ TSAN_INTERCEPTOR(int, sigaction, int sig, sigaction_t *act, sigaction_t *old) {
|
|||
}
|
||||
|
||||
TSAN_INTERCEPTOR(sighandler_t, signal, int sig, sighandler_t h) {
|
||||
sigaction_t act = {};
|
||||
sigaction_t act;
|
||||
act.sa_handler = h;
|
||||
REAL(memset)(&act.sa_mask, -1, sizeof(act.sa_mask));
|
||||
act.sa_flags = 0;
|
||||
sigaction_t old = {};
|
||||
sigaction_t old;
|
||||
int res = sigaction(sig, &act, &old);
|
||||
if (res)
|
||||
return SIG_ERR;
|
||||
|
|
|
@ -28,7 +28,7 @@ typedef enum {
|
|||
__tsan_memory_order_acquire = 1 << 2,
|
||||
__tsan_memory_order_release = 1 << 3,
|
||||
__tsan_memory_order_acq_rel = 1 << 4,
|
||||
__tsan_memory_order_seq_cst = 1 << 5,
|
||||
__tsan_memory_order_seq_cst = 1 << 5
|
||||
} __tsan_memory_order;
|
||||
|
||||
__tsan_atomic8 __tsan_atomic8_load(const volatile __tsan_atomic8 *a,
|
||||
|
|
|
@ -57,7 +57,7 @@ enum MBlockType {
|
|||
MBlockSignal,
|
||||
|
||||
// This must be the last.
|
||||
MBlockTypeCount,
|
||||
MBlockTypeCount
|
||||
};
|
||||
|
||||
// For internal data structures.
|
||||
|
|
|
@ -48,7 +48,7 @@ void InitializeMutex() {
|
|||
bool leaf[N] = {};
|
||||
for (int i = 1; i < N; i++) {
|
||||
for (int j = 0; j < N; j++) {
|
||||
int z = CanLockTab[i][j];
|
||||
MutexType z = CanLockTab[i][j];
|
||||
if (z == MutexTypeInvalid)
|
||||
continue;
|
||||
if (z == MutexTypeLeaf) {
|
||||
|
@ -56,8 +56,8 @@ void InitializeMutex() {
|
|||
leaf[i] = true;
|
||||
continue;
|
||||
}
|
||||
CHECK(!CanLockAdj[i][z]);
|
||||
CanLockAdj[i][z] = true;
|
||||
CHECK(!CanLockAdj[i][(int)z]);
|
||||
CanLockAdj[i][(int)z] = true;
|
||||
cnt[i]++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ enum MutexType {
|
|||
MutexTypeAtExit,
|
||||
|
||||
// This must be the last.
|
||||
MutexTypeCount,
|
||||
MutexTypeCount
|
||||
};
|
||||
|
||||
class Mutex {
|
||||
|
|
|
@ -178,8 +178,12 @@ extern "C" void _dl_get_tls_static_info(size_t*, size_t*)
|
|||
static int InitTlsSize() {
|
||||
typedef void (*get_tls_func)(size_t*, size_t*) INTERNAL_FUNCTION;
|
||||
get_tls_func get_tls = &_dl_get_tls_static_info;
|
||||
if (get_tls == 0)
|
||||
get_tls = (get_tls_func)dlsym(RTLD_NEXT, "_dl_get_tls_static_info");
|
||||
if (get_tls == 0) {
|
||||
void *get_tls_static_info_ptr = dlsym(RTLD_NEXT, "_dl_get_tls_static_info");
|
||||
CHECK_EQ(sizeof(get_tls), sizeof(get_tls_static_info_ptr));
|
||||
internal_memcpy(&get_tls, &get_tls_static_info_ptr,
|
||||
sizeof(get_tls_static_info_ptr));
|
||||
}
|
||||
CHECK_NE(get_tls, 0);
|
||||
size_t tls_size = 0;
|
||||
size_t tls_align = 0;
|
||||
|
|
|
@ -24,7 +24,7 @@ enum ReportType {
|
|||
ReportTypeThreadLeak,
|
||||
ReportTypeMutexDestroyLocked,
|
||||
ReportTypeSignalUnsafe,
|
||||
ReportTypeErrnoInSignal,
|
||||
ReportTypeErrnoInSignal
|
||||
};
|
||||
|
||||
struct ReportStack {
|
||||
|
@ -51,7 +51,7 @@ struct ReportMop {
|
|||
enum ReportLocationType {
|
||||
ReportLocationGlobal,
|
||||
ReportLocationHeap,
|
||||
ReportLocationStack,
|
||||
ReportLocationStack
|
||||
};
|
||||
|
||||
struct ReportLocation {
|
||||
|
|
|
@ -316,7 +316,7 @@ enum ThreadStatus {
|
|||
ThreadStatusCreated, // Created but not yet running.
|
||||
ThreadStatusRunning, // The thread is currently running.
|
||||
ThreadStatusFinished, // Joinable thread is finished but not yet joined.
|
||||
ThreadStatusDead, // Joined, but some info (trace) is still alive.
|
||||
ThreadStatusDead // Joined, but some info (trace) is still alive.
|
||||
};
|
||||
|
||||
// An info about a thread that is hold for some time after its termination.
|
||||
|
|
|
@ -301,7 +301,7 @@ static bool HandleRacyStacks(ThreadState *thr, const StackTrace (&traces)[2],
|
|||
uptr addr_min, uptr addr_max) {
|
||||
Context *ctx = CTX();
|
||||
bool equal_stack = false;
|
||||
RacyStacks hash = {};
|
||||
RacyStacks hash;
|
||||
if (flags()->suppress_equal_stacks) {
|
||||
hash.hash[0] = md5_hash(traces[0].Begin(), traces[0].Size() * sizeof(uptr));
|
||||
hash.hash[1] = md5_hash(traces[1].Begin(), traces[1].Size() * sizeof(uptr));
|
||||
|
|
|
@ -250,7 +250,7 @@ enum StatType {
|
|||
StatMtxAtExit,
|
||||
|
||||
// This must be the last.
|
||||
StatCnt,
|
||||
StatCnt
|
||||
};
|
||||
|
||||
} // namespace __tsan
|
||||
|
|
|
@ -26,7 +26,7 @@ enum SuppressionType {
|
|||
SuppressionRace,
|
||||
SuppressionMutex,
|
||||
SuppressionThread,
|
||||
SuppressionSignal,
|
||||
SuppressionSignal
|
||||
};
|
||||
|
||||
struct Suppression {
|
||||
|
|
|
@ -35,7 +35,7 @@ enum EventType {
|
|||
EventTypeLock,
|
||||
EventTypeUnlock,
|
||||
EventTypeRLock,
|
||||
EventTypeRUnlock,
|
||||
EventTypeRUnlock
|
||||
};
|
||||
|
||||
// Represents a thread event (from most significant bit):
|
||||
|
|
Loading…
Reference in New Issue