4 | @@ -5,4 +5,6 @@
5 | { "include": [ "<mmintrin.h>", "private", "<immintrin.h>", "public" ] },
6 | { "include": [ "<smmintrin.h>", "private", "<immintrin.h>", "public" ] },
7 | { "include": [ "<tmmintrin.h>", "private", "<immintrin.h>", "public" ] },
8 | +
9 | + { "symbol": ["std::hash", "private", "<functional>", "public"] },
How do I specify "any header"?
Not sure if this is possible without fixing up iwyu.
In any case, I wanted to say that I don't see the point of this pull request. What is the exact harm you are trying to fix? What is the risk?
Right now, all you are doing is swapping one perfectly fine thing (for the compiler) with another one. Both are equally confusing and "wrong" for a reader, so I don't see the point for this churn here. Why does it need to change?
In the context of #33922, we can simply redeclare the primary template:
namespace std {
// Redeclaration of the primary template.
template <class T>
struct hash; // IWYU pragma: keep
/** Disable default std::hash for CTransactionRef to prevent accidentally
* comparing by pointer. Use CTransactionRefSaltedHash or provide a custom
* hasher. */
template <>
struct hash<CTransactionRef> {
size_t operator()(const CTransactionRef&) const = delete;
};
} // namespace std
What is the exact harm you are trying to fix?
CI spuriously fails for #33922.
What is the exact harm you are trying to fix?
CI spuriously fails for #33922.
Given how iwyu works, it is a harmless and arguably valid suggestion. Recall that the goal of using iwyu is to avoid missing includes, which have lead to compile failures in the past. Adding an include that already exists implicitly is harmless. And fwiw, CI did pass on commit 10acf818ed70d4cd2af864278a35a6b64de0bb16.
Working around that in the wrong way will just achieve the opposite. E.g. a no_include pragma may lead to the exact compile failures we are trying to avoid, down the line.