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

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 29 12:53:37 PDT 2022


vitalybuka accepted this revision.
vitalybuka added inline comments.
This revision is now accepted and ready to land.


================
Comment at: compiler-rt/lib/scudo/standalone/memtag.h:46
+#pragma clang diagnostic ignored "-Wmissing-noreturn"
 inline uptr archMemoryTagGranuleSize() {
   UNREACHABLE("memory tagging not supported");
----------------
ddcc wrote:
> vitalybuka wrote:
> > ddcc wrote:
> > > 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`.
> > I am asking about:
> > NORETURN inline uptr archMemoryTagGranuleSize() 
> > 
> > If this does not suppress the warning then just
> > return 0;
> > 
> > Which compiler do you use?
> > Can you paste warning content with context?
> Oh sorry I misunderstood. Yeah adding noreturn avoids most of the warnings, except for the one on `setRandomTag`. This is because that warning only gets emitted while compiling memtag_test.cpp, which does not include combined.h, which has the only non-fatal uses of setRandomTag. But it's not correct to declare it noreturn in general, because the other uses are not fatal.
> 
> ```
> include/internal/scudo/memtag.h:305:62: error: function 'setRandomTag' could be declared with attribute 'noreturn'
>       [-Werror,-Wmissing-noreturn]
>                          uptr *TaggedBegin, uptr *TaggedEnd) {
>                                                              ^
> ```
> 
> ```
> include/internal/scudo/memtag.h:308:1: error: function declared 'noreturn' should not return [-Werror,-Winvalid-noreturn]
> }
> ```
I don't like pragma there but NORETURN setRandomTag is incorrect.


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