google / glog

C++ implementation of the Google logging module
http://google.github.io/glog/
BSD 3-Clause "New" or "Revised" License
7k stars 2.05k forks source link

Can LOG(FATAL) insert `__builtin_unreachable()` after `Fail()` ? #977

Closed kvtb closed 10 months ago

kvtb commented 10 months ago

Can LOG(FATAL) insert __builtin_unreachable() after Fail() ?

~LogMessageFatal() having [[noreturn]] is not enough to suppress all silly compiler warnings, e.g.

int f() {
 switch (someenum) {
  case A: return 1;
  case B: return 2;
 }
 LOG(FATAL) << "unexpected someenum: " << (int)someenum;
}

compiler blames that the function does not return int

sergiud commented 10 months ago

I'm not seeing any warnings or errors even when compiling using -Wall -Wextra -pedantic -Werror.

Please provide a full reproducer including exact compiler and glog version, options necessary provoke the warnings etc.

sergiud commented 10 months ago

Closing due to lack of response. Please let us know once you have more information on how to reproduce the issue.