[PATCH] D106320: Remove (void) in loop as it is unnecessary and confusing

Alf via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 19 15:09:34 PDT 2021


gAlfonso-bit created this revision.
gAlfonso-bit added a reviewer: LLVM.
gAlfonso-bit created this object with edit policy "Administrators".
gAlfonso-bit added a project: LLVM.
Herald added a subscriber: dexonsmith.
gAlfonso-bit requested review of this revision.
Herald added a subscriber: llvm-commits.

Usually (void) is used when a return value is discarded or when it comes before a declaration or definition of a function. It has no place here and is unnecessarily confusing.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106320

Files:
  llvm/include/llvm/ADT/STLExtras.h


Index: llvm/include/llvm/ADT/STLExtras.h
===================================================================
--- llvm/include/llvm/ADT/STLExtras.h
+++ llvm/include/llvm/ADT/STLExtras.h
@@ -1363,7 +1363,7 @@
   // but that would be stdlib dependent.
   typedef
       typename std::iterator_traits<Iterator>::difference_type difference_type;
-  for (auto size = last - first; size > 1; ++first, (void)--size) {
+  for (auto size = last - first; size > 1; ++first, --size) {
     difference_type offset = g() % size;
     // Avoid self-assignment due to incorrect assertions in libstdc++
     // containers (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85828).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106320.359934.patch
Type: text/x-patch
Size: 659 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210719/c31d81e4/attachment.bin>


More information about the llvm-commits mailing list