[PATCH] D88833: [clang-tidy] Do not warn on pointer decays in system macros

Carlos Galvez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 6 13:42:47 PST 2022


carlosgalvezp added a comment.

I see, thanks for the examples! Since you mention modern C++, I can guess you are using std::array in your code. Maybe just pass "buffer.data()" to the third-party functions? I think it's a bit cleaner than casts. If you use C arrays, consider switching to std::array or pass "std::begin(buffer)". That's actually what we do in our code more than wrappers.

My gut feeling is that it feels strange to add this exception, it's still user code after all. If you enable the warning it's because you care about the problems of pointer decay. Warnings typically add some level of "pain" that need to be traded off with the benefit they provide. I'm also afraid this opens the door for more such exceptions, making the logic more complicated and harder to maintain.

That's just my 2 cents, I don't intend to block this patch in any way :) just came in as I saw it was related to my patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88833



More information about the cfe-commits mailing list