Skip to content

Commit cd0cb21

Browse files
markdrothkarenwuz
authored andcommitted
Fix unused parameter warnings.
PiperOrigin-RevId: 850183045
1 parent e0440f5 commit cd0cb21

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

upb/port/sanitizers.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ UPB_INLINE uint8_t _upb_Xsan_NextTag(upb_Xsan *xsan) {
3737
}
3838
return xsan->state;
3939
#else
40+
UPB_UNUSED(xsan);
4041
return 0;
4142
#endif
4243
}
@@ -53,13 +54,27 @@ UPB_INLINE uint8_t UPB_PRIVATE(_upb_Xsan_GetTag)(const void *addr) {
5354
#if UPB_HWASAN
5455
return __hwasan_get_tag_from_pointer(addr);
5556
#else
57+
UPB_UNUSED(addr);
5658
return 0;
5759
#endif
5860
}
5961

6062
UPB_INLINE void UPB_PRIVATE(upb_Xsan_Init)(upb_Xsan *xsan) {
6163
#if UPB_HWASAN || UPB_TSAN
6264
xsan->state = 0;
65+
#else
66+
UPB_UNUSED(xsan);
67+
#endif
68+
}
69+
70+
UPB_INLINE void UPB_PRIVATE(upb_Xsan_MarkInitialized)(void* addr, size_t size) {
71+
#if UPB_HAS_FEATURE(memory_sanitizer)
72+
if (size) {
73+
__msan_unpoison(addr, size);
74+
}
75+
#else
76+
UPB_UNUSED(addr);
77+
UPB_UNUSED(size);
6378
#endif
6479
}
6580

@@ -72,6 +87,9 @@ UPB_INLINE void UPB_PRIVATE(upb_Xsan_PoisonRegion)(const void *addr,
7287
__asan_poison_memory_region(addr, size);
7388
#elif UPB_HWASAN
7489
__hwasan_tag_memory(addr, UPB_HWASAN_POISON_TAG, UPB_ALIGN_MALLOC(size));
90+
#else
91+
UPB_UNUSED(addr);
92+
UPB_UNUSED(size);
7593
#endif
7694
}
7795

@@ -149,13 +167,17 @@ UPB_INLINE void UPB_PRIVATE(upb_Xsan_AccessReadOnly)(upb_Xsan *xsan) {
149167
#if UPB_TSAN
150168
// For performance we avoid using a volatile variable.
151169
__asm__ volatile("" ::"r"(xsan->state));
170+
#else
171+
UPB_UNUSED(xsan);
152172
#endif
153173
}
154174

155175
UPB_INLINE void UPB_PRIVATE(upb_Xsan_AccessReadWrite)(upb_Xsan *xsan) {
156176
#if UPB_TSAN
157177
// For performance we avoid using a volatile variable.
158178
__asm__ volatile("" : "+r"(xsan->state));
179+
#else
180+
UPB_UNUSED(xsan);
159181
#endif
160182
}
161183

0 commit comments

Comments
 (0)