diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2023-11-24 15:31:08 +0100 |
---|---|---|
committer | Tobias Burnus <tobias@codesourcery.com> | 2023-11-24 15:31:08 +0100 |
commit | 449b6b817ed76173e6475debd02b195ea9dab0a0 (patch) | |
tree | fb600916fe66e127887ae99bcfb4cc34bd868bd5 /gcc/omp-low.cc | |
parent | 439779bacee869643c93a4710a29f89ad031ee4a (diff) | |
download | gcc-449b6b817ed76173e6475debd02b195ea9dab0a0.zip gcc-449b6b817ed76173e6475debd02b195ea9dab0a0.tar.gz gcc-449b6b817ed76173e6475debd02b195ea9dab0a0.tar.bz2 |
OpenMP: Add -Wopenmp and use it
The new warning has two purposes: First, it makes clearer to the
user that it is about OpenMP and, secondly and more importantly,
it permits to use -Wno-openmp.
The newly added -Wopenmp is enabled by default and replaces the
'0' (always warning) in several OpenMP-related warning calls.
For code shared with OpenACC, it only uses OPT_Wopenmp for
'flag_openmp | flag_openmp_simd'.
gcc/c-family/ChangeLog:
* c.opt (Wopenmp): Add, enable by default.
gcc/c/ChangeLog:
* c-parser.cc (c_parser_omp_clause_num_threads,
c_parser_omp_clause_num_tasks, c_parser_omp_clause_grainsize,
c_parser_omp_clause_priority, c_parser_omp_clause_schedule,
c_parser_omp_clause_num_teams, c_parser_omp_clause_thread_limit,
c_parser_omp_clause_dist_schedule, c_parser_omp_depobj,
c_parser_omp_scan_loop_body, c_parser_omp_assumption_clauses):
Add OPT_Wopenmp to warning_at.
gcc/cp/ChangeLog:
* parser.cc (cp_parser_omp_clause_dist_schedule,
cp_parser_omp_scan_loop_body, cp_parser_omp_assumption_clauses,
cp_parser_omp_depobj): Add OPT_Wopenmp to warning_at.
* semantics.cc (finish_omp_clauses): Likewise.
gcc/ChangeLog:
* doc/invoke.texi (-Wopenmp): Add.
* gimplify.cc (gimplify_omp_for): Add OPT_Wopenmp to warning_at.
* omp-expand.cc (expand_omp_ordered_sink): Likewise.
* omp-general.cc (omp_check_context_selector): Likewise.
* omp-low.cc (scan_omp_for, check_omp_nesting_restrictions,
lower_omp_ordered_clauses): Likewise.
* omp-simd-clone.cc (simd_clone_clauses_extract): Likewise.
gcc/fortran/ChangeLog:
* lang.opt (Wopenmp): Add, enabled by dafault and documented in C.
* openmp.cc (gfc_match_omp_declare_target, resolve_positive_int_expr,
resolve_nonnegative_int_expr, resolve_omp_clauses,
gfc_resolve_omp_do_blocks): Use OPT_Wopenmp with gfc_warning{,_now}.
Diffstat (limited to 'gcc/omp-low.cc')
-rw-r--r-- | gcc/omp-low.cc | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/gcc/omp-low.cc b/gcc/omp-low.cc index 161bcfe..dd802ca 100644 --- a/gcc/omp-low.cc +++ b/gcc/omp-low.cc @@ -2844,12 +2844,13 @@ scan_omp_for (gomp_for *stmt, omp_context *outer_ctx) tree_code outer_op = OMP_CLAUSE_REDUCTION_CODE (outer_clause); if (outer_var == local_var && outer_op != local_op) { - warning_at (OMP_CLAUSE_LOCATION (local_clause), 0, - "conflicting reduction operations for %qE", - local_var); - inform (OMP_CLAUSE_LOCATION (outer_clause), - "location of the previous reduction for %qE", - outer_var); + if (warning_at (OMP_CLAUSE_LOCATION (local_clause), + OPT_Wopenmp, "conflicting reduction " + "operations for %qE", + local_var)) + inform (OMP_CLAUSE_LOCATION (outer_clause), + "location of the previous reduction for %qE", + outer_var); } if (outer_var == local_var) { @@ -2880,7 +2881,7 @@ scan_omp_for (gomp_for *stmt, omp_context *outer_ctx) } } if (!found) - warning_at (gimple_location (curr_loop->stmt), 0, + warning_at (gimple_location (curr_loop->stmt), OPT_Wopenmp, "nested loop in reduction needs " "reduction clause for %qE", local_var); @@ -3427,12 +3428,12 @@ check_omp_nesting_restrictions (gimple *stmt, omp_context *ctx) ctx->cancellable = true; if (omp_find_clause (gimple_omp_for_clauses (ctx->stmt), OMP_CLAUSE_NOWAIT)) - warning_at (gimple_location (stmt), 0, + warning_at (gimple_location (stmt), OPT_Wopenmp, "%<cancel for%> inside " "%<nowait%> for construct"); if (omp_find_clause (gimple_omp_for_clauses (ctx->stmt), OMP_CLAUSE_ORDERED)) - warning_at (gimple_location (stmt), 0, + warning_at (gimple_location (stmt), OPT_Wopenmp, "%<cancel for%> inside " "%<ordered%> for construct"); } @@ -3452,7 +3453,7 @@ check_omp_nesting_restrictions (gimple *stmt, omp_context *ctx) if (omp_find_clause (gimple_omp_sections_clauses (ctx->stmt), OMP_CLAUSE_NOWAIT)) - warning_at (gimple_location (stmt), 0, + warning_at (gimple_location (stmt), OPT_Wopenmp, "%<cancel sections%> inside " "%<nowait%> sections construct"); } @@ -3465,7 +3466,7 @@ check_omp_nesting_restrictions (gimple *stmt, omp_context *ctx) if (omp_find_clause (gimple_omp_sections_clauses (ctx->outer->stmt), OMP_CLAUSE_NOWAIT)) - warning_at (gimple_location (stmt), 0, + warning_at (gimple_location (stmt), OPT_Wopenmp, "%<cancel sections%> inside " "%<nowait%> sections construct"); } @@ -3928,7 +3929,7 @@ check_omp_nesting_restrictions (gimple *stmt, omp_context *ctx) if (c && OMP_CLAUSE_DEVICE_ANCESTOR (c)) break; } - warning_at (gimple_location (stmt), 0, + warning_at (gimple_location (stmt), OPT_Wopenmp, "%qs construct inside of %qs region", stmt_name, ctx_stmt_name); } @@ -9783,8 +9784,8 @@ lower_omp_ordered_clauses (gimple_stmt_iterator *gsi_p, gomp_ordered *ord_stmt, wi::abs (wi::to_wide (fd.loops[i].step)), UNSIGNED)) { - warning_at (OMP_CLAUSE_LOCATION (c), 0, - "ignoring sink clause with offset that is not " + warning_at (OMP_CLAUSE_LOCATION (c), OPT_Wopenmp, + "ignoring %<sink%> clause with offset that is not " "a multiple of the loop step"); remove = true; goto next_ordered_clause; |