Re: [PATCH] c-family: Implement -Warray-compare [PR97573]

2021-10-01 Thread Jakub Jelinek via Gcc-patches
On Fri, Oct 01, 2021 at 04:11:08PM -0400, Marek Polacek via Gcc-patches wrote: > + auto_diagnostic_group d; > + if (warning_at (location, OPT_Warray_compare, > + "comparison between two arrays%s", > + (c_dialect_cxx () && cxx_dialect >= cxx20) > + ? " is

[PATCH] c-family: Implement -Warray-compare [PR97573]

2021-10-01 Thread Marek Polacek via Gcc-patches
This patch addresses one of my leftovers from GCC 11. C++20 introduced [depr.array.comp]: "Equality and relational comparisons between two operands of array type are deprecated." so this patch adds -Warray-compare. Since the code in question is dubious (the comparison doesn't actually compare