jcai19 marked 2 inline comments as done.
jcai19 added inline comments.

================
Comment at: clang-tools-extra/test/clang-tidy/bugprone-posix-return.cpp:96
+  if (posix_fadvise(0, 0, 0, 0) < 0) {}
+  if (posix_fadvise(0, 0, 0, 0) >= 0) {} else {}
+  if (posix_fadvise(0, 0, 0, 0) == -1) {}
----------------
gribozavr wrote:
> jcai19 wrote:
> > gribozavr wrote:
> > > Shouldn't there be a warning in the else branch?
> > This check only matches calls to the POSIX functions in the global scope, 
> > not member functions or functions defined within namespaces. Although in 
> > the global scope,  this particular case will still pass as there won't be a 
> > ``<`` binary operator for the else branch so no matching will happen.
> Sorry, yes, that's what I meant -- if we warn on `< 0`, then we should warn 
> on the else branch of `>=`. I just commented on the wrong test -- sorry about 
> that.
Thanks for the clarification. Actually >= 0 is always true since the call 
return 0 on success and a positive value on error, so the else branch will 
never be reached. I have update my check and the warning message to reflect 
this. Good catch!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63623



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to