diff options
author | Jason Merrill <jason@redhat.com> | 2024-11-22 08:47:56 +0100 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2024-11-26 23:53:37 -0500 |
commit | d89d033e2731a53bf71a0db5259380504357d2f5 (patch) | |
tree | 90cc9008a7934d9e1e99486fdd5eb1cc3aaff297 /gcc/c-family | |
parent | 134dc932e1ceb13519846795c895319f77df3235 (diff) | |
download | gcc-d89d033e2731a53bf71a0db5259380504357d2f5.zip gcc-d89d033e2731a53bf71a0db5259380504357d2f5.tar.gz gcc-d89d033e2731a53bf71a0db5259380504357d2f5.tar.bz2 |
c++: enable -Warray-compare by default
Discussion of P2865R5 mentioned that we only enabled this warning with
-Wall; we should handle it like other deprecations.
gcc/c-family/ChangeLog:
* c-opts.cc (c_common_post_options): Enable -Warray-compare
in C++20.
gcc/testsuite/ChangeLog:
* g++.dg/tree-ssa/pr15791-1.C: Add -Wno-array-compare.
Diffstat (limited to 'gcc/c-family')
-rw-r--r-- | gcc/c-family/c-opts.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc index a002929..a02d011 100644 --- a/gcc/c-family/c-opts.cc +++ b/gcc/c-family/c-opts.cc @@ -1051,6 +1051,11 @@ c_common_post_options (const char **pfilename) warn_deprecated_literal_operator, deprecated_in (cxx23)); + /* -Warray-compare is enabled by default in C++20. */ + SET_OPTION_IF_UNSET (&global_options, &global_options_set, + warn_array_compare, + warn_array_compare || deprecated_in (cxx20)); + /* -Wtemplate-id-cdtor is enabled by default in C++20. */ SET_OPTION_IF_UNSET (&global_options, &global_options_set, warn_template_id_cdtor, |