aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family/c-opts.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-family/c-opts.cc')
-rw-r--r--gcc/c-family/c-opts.cc26
1 files changed, 19 insertions, 7 deletions
diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc
index f1c276f..795f5a3 100644
--- a/gcc/c-family/c-opts.cc
+++ b/gcc/c-family/c-opts.cc
@@ -192,7 +192,7 @@ void
c_common_diagnostics_set_defaults (diagnostic_context *context)
{
diagnostic_text_finalizer (context) = c_diagnostic_text_finalizer;
- context->m_opt_permissive = OPT_fpermissive;
+ context->set_permissive_option (OPT_fpermissive);
}
/* Input charset configuration for diagnostics. */
@@ -1165,6 +1165,9 @@ c_common_post_options (const char **pfilename)
warn_cxx20_compat = 0;
cpp_opts->cpp_warn_cxx20_compat = 0;
}
+ if (cxx_dialect >= cxx26)
+ /* Don't warn about C++26 compatibility changes in C++26 or later. */
+ warn_cxx26_compat = 0;
/* C++17 has stricter evaluation order requirements; let's use some of them
for earlier C++ as well, so chaining works as expected. */
@@ -1215,10 +1218,25 @@ c_common_post_options (const char **pfilename)
if (cxx_dialect >= cxx20)
flag_concepts = 1;
+ /* Coroutines are also a C++20 feature. */
+ SET_OPTION_IF_UNSET (&global_options, &global_options_set,
+ flag_coroutines, cxx_dialect >= cxx20);
+
/* Enable lifetime extension of range based for temporaries for C++23. */
SET_OPTION_IF_UNSET (&global_options, &global_options_set,
flag_range_for_ext_temps, cxx_dialect >= cxx23);
+ /* EnabledBy unfortunately can't specify value to use if set and
+ LangEnabledBy can't specify multiple options with &&. For -Wunused
+ or -Wunused -Wextra we want these to default to 3 unless user specified
+ some other level explicitly. */
+ if (warn_unused_but_set_parameter == 1)
+ SET_OPTION_IF_UNSET (&global_options, &global_options_set,
+ warn_unused_but_set_parameter, 3);
+ if (warn_unused_but_set_variable == 1)
+ SET_OPTION_IF_UNSET (&global_options, &global_options_set,
+ warn_unused_but_set_variable, 3);
+
/* -fimmediate-escalation has no effect when immediate functions are not
supported. */
if (flag_immediate_escalation && cxx_dialect < cxx20)
@@ -2009,8 +2027,6 @@ set_std_cxx20 (int iso)
flag_isoc94 = 1;
flag_isoc99 = 1;
flag_isoc11 = 1;
- /* C++20 includes coroutines. */
- flag_coroutines = true;
cxx_dialect = cxx20;
lang_hooks.name = "GNU C++20";
}
@@ -2027,8 +2043,6 @@ set_std_cxx23 (int iso)
flag_isoc94 = 1;
flag_isoc99 = 1;
flag_isoc11 = 1;
- /* C++23 includes coroutines. */
- flag_coroutines = true;
cxx_dialect = cxx23;
lang_hooks.name = "GNU C++23";
}
@@ -2045,8 +2059,6 @@ set_std_cxx26 (int iso)
flag_isoc94 = 1;
flag_isoc99 = 1;
flag_isoc11 = 1;
- /* C++26 includes coroutines. */
- flag_coroutines = true;
cxx_dialect = cxx26;
lang_hooks.name = "GNU C++26";
}