Skip to content

Commit 686dcbe

Browse files
committed
[scudo] Add noreturn/pragma to suppress compiler warnings
Differential Revision: https://reviews.llvm.org/D121853
1 parent db13f5a commit 686dcbe

File tree

1 file changed

+16
-13
lines changed
  • compiler-rt/lib/scudo/standalone

1 file changed

+16
-13
lines changed

compiler-rt/lib/scudo/standalone/memtag.h

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ inline uint8_t extractTag(uptr Ptr) { return (Ptr >> 56) & 0xf; }
4141

4242
inline constexpr bool archSupportsMemoryTagging() { return false; }
4343

44-
inline uptr archMemoryTagGranuleSize() {
44+
inline NORETURN uptr archMemoryTagGranuleSize() {
4545
UNREACHABLE("memory tagging not supported");
4646
}
4747

48-
inline uptr untagPointer(uptr Ptr) {
48+
inline NORETURN uptr untagPointer(uptr Ptr) {
4949
(void)Ptr;
5050
UNREACHABLE("memory tagging not supported");
5151
}
5252

53-
inline uint8_t extractTag(uptr Ptr) {
53+
inline NORETURN uint8_t extractTag(uptr Ptr) {
5454
(void)Ptr;
5555
UNREACHABLE("memory tagging not supported");
5656
}
@@ -109,11 +109,11 @@ inline void enableSystemMemoryTaggingTestOnly() {
109109

110110
inline bool systemSupportsMemoryTagging() { return false; }
111111

112-
inline bool systemDetectsMemoryTagFaultsTestOnly() {
112+
inline NORETURN bool systemDetectsMemoryTagFaultsTestOnly() {
113113
UNREACHABLE("memory tagging not supported");
114114
}
115115

116-
inline void enableSystemMemoryTaggingTestOnly() {
116+
inline NORETURN void enableSystemMemoryTaggingTestOnly() {
117117
UNREACHABLE("memory tagging not supported");
118118
}
119119

@@ -255,57 +255,60 @@ inline uptr loadTag(uptr Ptr) {
255255

256256
#else
257257

258-
inline bool systemSupportsMemoryTagging() {
258+
inline NORETURN bool systemSupportsMemoryTagging() {
259259
UNREACHABLE("memory tagging not supported");
260260
}
261261

262-
inline bool systemDetectsMemoryTagFaultsTestOnly() {
262+
inline NORETURN bool systemDetectsMemoryTagFaultsTestOnly() {
263263
UNREACHABLE("memory tagging not supported");
264264
}
265265

266-
inline void enableSystemMemoryTaggingTestOnly() {
266+
inline NORETURN void enableSystemMemoryTaggingTestOnly() {
267267
UNREACHABLE("memory tagging not supported");
268268
}
269269

270270
struct ScopedDisableMemoryTagChecks {
271271
ScopedDisableMemoryTagChecks() {}
272272
};
273273

274-
inline uptr selectRandomTag(uptr Ptr, uptr ExcludeMask) {
274+
inline NORETURN uptr selectRandomTag(uptr Ptr, uptr ExcludeMask) {
275275
(void)Ptr;
276276
(void)ExcludeMask;
277277
UNREACHABLE("memory tagging not supported");
278278
}
279279

280-
inline uptr addFixedTag(uptr Ptr, uptr Tag) {
280+
inline NORETURN uptr addFixedTag(uptr Ptr, uptr Tag) {
281281
(void)Ptr;
282282
(void)Tag;
283283
UNREACHABLE("memory tagging not supported");
284284
}
285285

286-
inline uptr storeTags(uptr Begin, uptr End) {
286+
inline NORETURN uptr storeTags(uptr Begin, uptr End) {
287287
(void)Begin;
288288
(void)End;
289289
UNREACHABLE("memory tagging not supported");
290290
}
291291

292-
inline void storeTag(uptr Ptr) {
292+
inline NORETURN void storeTag(uptr Ptr) {
293293
(void)Ptr;
294294
UNREACHABLE("memory tagging not supported");
295295
}
296296

297-
inline uptr loadTag(uptr Ptr) {
297+
inline NORETURN uptr loadTag(uptr Ptr) {
298298
(void)Ptr;
299299
UNREACHABLE("memory tagging not supported");
300300
}
301301

302302
#endif
303303

304+
#pragma clang diagnostic push
305+
#pragma clang diagnostic ignored "-Wmissing-noreturn"
304306
inline void setRandomTag(void *Ptr, uptr Size, uptr ExcludeMask,
305307
uptr *TaggedBegin, uptr *TaggedEnd) {
306308
*TaggedBegin = selectRandomTag(reinterpret_cast<uptr>(Ptr), ExcludeMask);
307309
*TaggedEnd = storeTags(*TaggedBegin, *TaggedBegin + Size);
308310
}
311+
#pragma clang diagnostic pop
309312

310313
inline void *untagPointer(void *Ptr) {
311314
return reinterpret_cast<void *>(untagPointer(reinterpret_cast<uptr>(Ptr)));

0 commit comments

Comments
 (0)