[PATCH] D98204: [NFC] Fix "unused parameter" error revealed in the Linux self-build.

Aaron Ballman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 10 04:55:19 PST 2021


aaron.ballman added a reviewer: aaron.ballman.
aaron.ballman added a comment.

I think we typically prefer not naming the parameter in the definition over a cast to `void` (and likely, we should be using `[[maybe_unused]]` in places where we currently cast to `void` because the variable is sometimes used, such as in an `assert`).



================
Comment at: llvm/include/llvm/ADT/DenseMapInfo.h:261-262
   template <unsigned I>
   static unsigned getHashValueImpl(const Tuple &values, std::true_type) {
+    (void)values;
     return 0;
----------------



================
Comment at: llvm/include/llvm/ADT/DenseMapInfo.h:273
   static bool isEqualImpl(const Tuple &lhs, const Tuple &rhs, std::false_type) {
+    (void)rhs;
     using EltType = typename std::tuple_element<I, Tuple>::type;
----------------
This looks suspicious -- `rhs` looks to be used below in the call to `std:get<I>()` and `isEqualImpl<I + 1>()`. Is this needed?


================
Comment at: llvm/include/llvm/ADT/DenseMapInfo.h:281-282
   template <unsigned I>
   static bool isEqualImpl(const Tuple &lhs, const Tuple &rhs, std::true_type) {
+    (void)lhs;
     return true;
----------------
If it's complaining about `lhs`, I would imagine it would also be complaining about `rhs`?


================
Comment at: llvm/include/llvm/ADT/Hashing.h:659-660
 hash_code hash_value_tuple_helper(const std::tuple<Ts...> &arg,
                                   std::index_sequence<Indices...> indices) {
+  (void)indices;
   return hash_combine(std::get<Indices>(arg)...);
----------------



================
Comment at: llvm/include/llvm/ADT/Optional.h:384-385
 
 template <typename T> constexpr bool operator<(const Optional<T> &X, NoneType) {
+  (void)X;
   return false;
----------------



================
Comment at: llvm/include/llvm/Support/MathExtras.h:401-402
 template <unsigned N>
 constexpr inline std::enable_if_t<N >= 64, bool> isUInt(uint64_t X) {
+  (void)X;
   return true;
----------------



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

https://reviews.llvm.org/D98204



More information about the llvm-commits mailing list