yronglin wrote:

> Thanks for the warning! It's a cool feature, but the diagnostic is IMHO not 
> super great at the moment.
> 
> I'm doing the cleanup for the warning in Chromium at the moment, and here's 
> an example that's now analyzed (from 
> https://source.chromium.org/chromium/chromium/src/+/main:net/dns/httpssvc_metrics.cc;l=25?q=httpssvc_metrics):
> 
> ```
> enum HttpssvcDnsRcode TranslateDnsRcodeForHttpssvcExperiment(uint8_t rcode) {
>   switch (rcode) {
>     case dns_protocol::kRcodeNOERROR:
>       return HttpssvcDnsRcode::kNoError;
>     case dns_protocol::kRcodeFORMERR:
>       return HttpssvcDnsRcode::kFormErr;
>     case dns_protocol::kRcodeSERVFAIL:
>       return HttpssvcDnsRcode::kServFail;
>     case dns_protocol::kRcodeNXDOMAIN:
>       return HttpssvcDnsRcode::kNxDomain;
>     case dns_protocol::kRcodeNOTIMP:
>       return HttpssvcDnsRcode::kNotImp;
>     case dns_protocol::kRcodeREFUSED:
>       return HttpssvcDnsRcode::kRefused;
>     default:
>       return HttpssvcDnsRcode::kUnrecognizedRcode;
>   }
>   NOTREACHED();
> }
> ```
> 
> Here's the diagnostic:
> 
> ```
> [4890/84790] CXX obj/net/dns/dns/httpssvc_metrics.o
> In file included from ../../net/dns/httpssvc_metrics.cc:5:
> In file included from ../../net/dns/httpssvc_metrics.h:13:
> In file included from ../../base/containers/flat_set.h:12:
> In file included from ../../base/containers/flat_tree.h:19:
> ../../base/check.h:200:11: warning: code will never be executed 
> [-Wunreachable-code]
>   200 |           base::Location::CurrentWithoutFunctionName());
>       |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1 warning generated.
> ```
> 
> It points to somewhere in the implementation of `NOTREACHED()`. It does not 
> mention where the invocation of that macro that causes the diagnostic is. (At 
> least it prints the right cc file, but not where in that file I'm supposed to 
> look.)

Thanks a lot for report this! 100% agree that we need to find the correct 
source location. I'm not sure it's the same issue with 
https://github.com/llvm/llvm-project/issues/123064, I try to find a reproducer.

https://github.com/llvm/llvm-project/pull/127338
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to