[PATCH] D121853: [scudo][NFC] Suppress warnings for missing-noreturn, conditional-uninitialized, zero-length-array

Dominic Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 25 16:42:02 PDT 2022


ddcc added inline comments.


================
Comment at: compiler-rt/lib/scudo/standalone/memtag.h:46
+#pragma clang diagnostic ignored "-Wmissing-noreturn"
 inline uptr archMemoryTagGranuleSize() {
   UNREACHABLE("memory tagging not supported");
----------------
vitalybuka wrote:
> can you avoid pragmas with NORETURN?
Sorry, I don't understand the question. The `UNREACHABLE` macro calls the `die()` function that is labeled with `NORETURN`, which causes the compiler to warn about functions that don't return but that aren't labeled `NORETURN`. I can remove `NORETURN` from that function, but that would also require changing its' callers as well, such as `dieOnMapUnmapError`.


================
Comment at: compiler-rt/lib/scudo/standalone/secondary.h:247-274
     if (Found) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wconditional-uninitialized"
       *H = reinterpret_cast<LargeBlock::Header *>(
           LargeBlock::addHeaderTag<Config>(HeaderPos));
+#pragma clang diagnostic pop
       *Zeroed = Entry.Time == 0;
----------------
vitalybuka wrote:
> 
The issue is on `HeaderPos`; for some reason the compiler thinks it may be uninitialized. I can just initialize that to zero instead.


================
Comment at: compiler-rt/lib/scudo/standalone/secondary.h:400
 
   CachedBlock Entries[Config::SecondaryCacheEntriesArraySize] = {};
+#pragma clang diagnostic push
----------------
vitalybuka wrote:
> Can you avoid this by extractioing Quarantine with template specialization
> 
> ```
> class <size_t Size>
> class Quarantine {
>   doStuff1() {blocks...}
>   doStuff2() {blocks...}
> private
>   CachedBlock blocks[Size];
> };
> 
> template<> class Quarantine<0> {
>   doStuff1() {}
>   doStuff2() {}
> }
> ```
I'll split this off into another patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121853/new/

https://reviews.llvm.org/D121853



More information about the llvm-commits mailing list