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/c/c-parser.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/c/c-parser.cc')
-rw-r--r-- | gcc/c/c-parser.cc | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index 989c050..df9a079 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -16071,7 +16071,7 @@ c_parser_omp_clause_num_threads (c_parser *parser, tree list) protected_set_expr_location (c, expr_loc); if (c == boolean_true_node) { - warning_at (expr_loc, 0, + warning_at (expr_loc, OPT_Wopenmp, "%<num_threads%> value must be positive"); t = integer_one_node; } @@ -16132,7 +16132,8 @@ c_parser_omp_clause_num_tasks (c_parser *parser, tree list) SET_EXPR_LOCATION (c, expr_loc); if (c == boolean_true_node) { - warning_at (expr_loc, 0, "%<num_tasks%> value must be positive"); + warning_at (expr_loc, OPT_Wopenmp, + "%<num_tasks%> value must be positive"); t = integer_one_node; } @@ -16193,7 +16194,8 @@ c_parser_omp_clause_grainsize (c_parser *parser, tree list) SET_EXPR_LOCATION (c, expr_loc); if (c == boolean_true_node) { - warning_at (expr_loc, 0, "%<grainsize%> value must be positive"); + warning_at (expr_loc, OPT_Wopenmp, + "%<grainsize%> value must be positive"); t = integer_one_node; } @@ -16241,7 +16243,8 @@ c_parser_omp_clause_priority (c_parser *parser, tree list) SET_EXPR_LOCATION (c, expr_loc); if (c == boolean_true_node) { - warning_at (expr_loc, 0, "%<priority%> value must be non-negative"); + warning_at (expr_loc, OPT_Wopenmp, + "%<priority%> value must be non-negative"); t = integer_one_node; } @@ -17383,7 +17386,7 @@ c_parser_omp_clause_schedule (c_parser *parser, tree list) protected_set_expr_location (s, loc); if (s == boolean_true_node) { - warning_at (loc, 0, + warning_at (loc, OPT_Wopenmp, "chunk size value must be positive"); t = integer_one_node; } @@ -17545,7 +17548,8 @@ c_parser_omp_clause_num_teams (c_parser *parser, tree list) protected_set_expr_location (c, upper_loc); if (c == boolean_true_node) { - warning_at (upper_loc, 0, "%<num_teams%> value must be positive"); + warning_at (upper_loc, OPT_Wopenmp, + "%<num_teams%> value must be positive"); upper = integer_one_node; } if (lower) @@ -17555,15 +17559,17 @@ c_parser_omp_clause_num_teams (c_parser *parser, tree list) protected_set_expr_location (c, lower_loc); if (c == boolean_true_node) { - warning_at (lower_loc, 0, "%<num_teams%> value must be positive"); + warning_at (lower_loc, OPT_Wopenmp, + "%<num_teams%> value must be positive"); lower = NULL_TREE; } else if (TREE_CODE (lower) == INTEGER_CST && TREE_CODE (upper) == INTEGER_CST && tree_int_cst_lt (upper, lower)) { - warning_at (lower_loc, 0, "%<num_teams%> lower bound %qE bigger " - "than upper bound %qE", lower, upper); + warning_at (lower_loc, OPT_Wopenmp, + "%<num_teams%> lower bound %qE bigger than upper " + "bound %qE", lower, upper); lower = NULL_TREE; } } @@ -17610,7 +17616,8 @@ c_parser_omp_clause_thread_limit (c_parser *parser, tree list) protected_set_expr_location (c, expr_loc); if (c == boolean_true_node) { - warning_at (expr_loc, 0, "%<thread_limit%> value must be positive"); + warning_at (expr_loc, OPT_Wopenmp, + "%<thread_limit%> value must be positive"); t = integer_one_node; } @@ -18840,7 +18847,7 @@ c_parser_omp_clause_dist_schedule (c_parser *parser, tree list) /* check_no_duplicate_clause (list, OMP_CLAUSE_DIST_SCHEDULE, "dist_schedule"); */ if (omp_find_clause (list, OMP_CLAUSE_DIST_SCHEDULE)) - warning_at (loc, 0, "too many %qs clauses", "dist_schedule"); + warning_at (loc, OPT_Wopenmp, "too many %qs clauses", "dist_schedule"); if (t == error_mark_node) return list; @@ -21680,7 +21687,7 @@ c_parser_omp_depobj (c_parser *parser) && !operand_equal_p (destobj, depobj, OEP_MATCH_SIDE_EFFECTS | OEP_LEXICOGRAPHIC)) - warning_at (EXPR_LOC_OR_LOC (destobj, c_loc), 0, + warning_at (EXPR_LOC_OR_LOC (destobj, c_loc), OPT_Wopenmp, "the %<destroy%> expression %qE should be the same " "as the %<depobj%> argument %qE", destobj, depobj); c_parens.skip_until_found_close (parser); @@ -21915,7 +21922,7 @@ c_parser_omp_scan_loop_body (c_parser *parser, bool open_brace_parsed) substmt = c_parser_omp_structured_block_sequence (parser, PRAGMA_OMP_SCAN); else { - warning_at (c_parser_peek_token (parser)->location, 0, + warning_at (c_parser_peek_token (parser)->location, OPT_Wopenmp, "%<#pragma omp scan%> with zero preceding executable " "statements"); substmt = build_empty_stmt (loc); @@ -21963,8 +21970,9 @@ c_parser_omp_scan_loop_body (c_parser *parser, bool open_brace_parsed) else { if (found_scan) - warning_at (loc, 0, "%<#pragma omp scan%> with zero succeeding " - "executable statements"); + warning_at (loc, OPT_Wopenmp, + "%<#pragma omp scan%> with zero succeeding executable " + "statements"); substmt = build_empty_stmt (loc); } substmt = build2 (OMP_SCAN, void_type_node, substmt, clauses); @@ -26270,7 +26278,7 @@ c_parser_omp_assumption_clauses (c_parser *parser, bool is_assume) } else if (startswith (p, "ext_")) { - warning_at (cloc, 0, "unknown assumption clause %qs", p); + warning_at (cloc, OPT_Wopenmp, "unknown assumption clause %qs", p); c_parser_consume_token (parser); if (c_parser_next_token_is (parser, CPP_OPEN_PAREN)) { |