diff options
author | Martin Sebor <msebor@redhat.com> | 2021-06-24 17:29:34 -0600 |
---|---|---|
committer | Martin Sebor <msebor@redhat.com> | 2021-06-24 19:23:43 -0600 |
commit | 65870e75616ee4359d1c13b99be794e6a577bc65 (patch) | |
tree | 43087958a3c2c1a1b87e87a17557399f8f698d9a /gcc/cp/semantics.c | |
parent | 43c3f96f296b272614e0981fe3b25b0b1997db96 (diff) | |
download | gcc-65870e75616ee4359d1c13b99be794e6a577bc65.zip gcc-65870e75616ee4359d1c13b99be794e6a577bc65.tar.gz gcc-65870e75616ee4359d1c13b99be794e6a577bc65.tar.bz2 |
cp: add support for per-location warning groups.
gcc/cp/ChangeLog:
* call.c (build_over_call): Replace direct uses of TREE_NO_WARNING
with warning_suppressed_p, suppress_warning, and copy_no_warning, or
nothing if not necessary.
(set_up_extended_ref_temp): Same.
* class.c (layout_class_type): Same.
* constraint.cc (constraint_satisfaction_value): Same.
* coroutines.cc (finish_co_await_expr): Same.
(finish_co_yield_expr): Same.
(finish_co_return_stmt): Same.
(build_actor_fn): Same.
(coro_rewrite_function_body): Same.
(morph_fn_to_coro): Same.
* cp-gimplify.c (genericize_eh_spec_block): Same.
(gimplify_expr_stmt): Same.
(cp_genericize_r): Same.
(cp_fold): Same.
* cp-ubsan.c (cp_ubsan_instrument_vptr): Same.
* cvt.c (cp_fold_convert): Same.
(convert_to_void): Same.
* decl.c (wrapup_namespace_globals): Same.
(grokdeclarator): Same.
(finish_function): Same.
(require_deduced_type): Same.
* decl2.c (no_linkage_error): Same.
(c_parse_final_cleanups): Same.
* except.c (expand_end_catch_block): Same.
* init.c (build_new_1): Same.
(build_new): Same.
(build_vec_delete_1): Same.
(build_vec_init): Same.
(build_delete): Same.
* method.c (defaultable_fn_check): Same.
* parser.c (cp_parser_fold_expression): Same.
(cp_parser_primary_expression): Same.
* pt.c (push_tinst_level_loc): Same.
(tsubst_copy): Same.
(tsubst_omp_udr): Same.
(tsubst_copy_and_build): Same.
* rtti.c (build_if_nonnull): Same.
* semantics.c (maybe_convert_cond): Same.
(finish_return_stmt): Same.
(finish_parenthesized_expr): Same.
(cp_check_omp_declare_reduction): Same.
* tree.c (build_cplus_array_type): Same.
* typeck.c (build_ptrmemfunc_access_expr): Same.
(cp_build_indirect_ref_1): Same.
(cp_build_function_call_vec): Same.
(warn_for_null_address): Same.
(cp_build_binary_op): Same.
(unary_complex_lvalue): Same.
(cp_build_modify_expr): Same.
(build_x_modify_expr): Same.
(convert_for_assignment): Same.
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r-- | gcc/cp/semantics.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index fbaabf6..b080259 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -835,12 +835,12 @@ maybe_convert_cond (tree cond) cond = convert_from_reference (cond); if (TREE_CODE (cond) == MODIFY_EXPR - && !TREE_NO_WARNING (cond) && warn_parentheses + && !warning_suppressed_p (cond, OPT_Wparentheses) && warning_at (cp_expr_loc_or_input_loc (cond), OPT_Wparentheses, "suggest parentheses around " "assignment used as truth value")) - TREE_NO_WARNING (cond) = 1; + suppress_warning (cond, OPT_Wparentheses); return condition_conversion (cond); } @@ -1197,7 +1197,7 @@ finish_return_stmt (tree expr) { /* Suppress -Wreturn-type for this function. */ if (warn_return_type) - TREE_NO_WARNING (current_function_decl) = true; + suppress_warning (current_function_decl, OPT_Wreturn_type); return error_mark_node; } @@ -1219,7 +1219,8 @@ finish_return_stmt (tree expr) } r = build_stmt (input_location, RETURN_EXPR, expr); - TREE_NO_WARNING (r) |= no_warning; + if (no_warning) + suppress_warning (r, OPT_Wreturn_type); r = maybe_cleanup_point_expr_void (r); r = add_stmt (r); @@ -2105,7 +2106,7 @@ finish_parenthesized_expr (cp_expr expr) { if (EXPR_P (expr)) /* This inhibits warnings in c_common_truthvalue_conversion. */ - TREE_NO_WARNING (expr) = 1; + suppress_warning (expr, OPT_Wparentheses); if (TREE_CODE (expr) == OFFSET_REF || TREE_CODE (expr) == SCOPE_REF) @@ -5979,12 +5980,12 @@ cp_check_omp_declare_reduction (tree udr) { gcc_assert (TREE_CODE (data.stmts[0]) == DECL_EXPR && TREE_CODE (data.stmts[1]) == DECL_EXPR); - if (TREE_NO_WARNING (DECL_EXPR_DECL (data.stmts[0]))) + if (warning_suppressed_p (DECL_EXPR_DECL (data.stmts[0]) /* What warning? */)) return true; data.combiner_p = true; if (cp_walk_tree (&data.stmts[2], cp_check_omp_declare_reduction_r, &data, NULL)) - TREE_NO_WARNING (DECL_EXPR_DECL (data.stmts[0])) = 1; + suppress_warning (DECL_EXPR_DECL (data.stmts[0]) /* What warning? */); } if (i >= 6) { @@ -5995,7 +5996,7 @@ cp_check_omp_declare_reduction (tree udr) &data, NULL) || cp_walk_tree (&DECL_INITIAL (DECL_EXPR_DECL (data.stmts[3])), cp_check_omp_declare_reduction_r, &data, NULL)) - TREE_NO_WARNING (DECL_EXPR_DECL (data.stmts[0])) = 1; + suppress_warning (DECL_EXPR_DECL (data.stmts[0]) /* Wat warning? */); if (i == 7) gcc_assert (TREE_CODE (data.stmts[6]) == DECL_EXPR); } |