aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2023-11-24 15:31:08 +0100
committerTobias Burnus <tobias@codesourcery.com>2023-11-24 15:31:08 +0100
commit449b6b817ed76173e6475debd02b195ea9dab0a0 (patch)
treefb600916fe66e127887ae99bcfb4cc34bd868bd5 /gcc
parent439779bacee869643c93a4710a29f89ad031ee4a (diff)
downloadgcc-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')
-rw-r--r--gcc/c-family/c.opt4
-rw-r--r--gcc/c/c-parser.cc40
-rw-r--r--gcc/cp/parser.cc16
-rw-r--r--gcc/cp/semantics.cc18
-rw-r--r--gcc/doc/invoke.texi7
-rw-r--r--gcc/fortran/lang.opt4
-rw-r--r--gcc/fortran/openmp.cc32
-rw-r--r--gcc/gimplify.cc4
-rw-r--r--gcc/omp-expand.cc11
-rw-r--r--gcc/omp-general.cc4
-rw-r--r--gcc/omp-low.cc29
-rw-r--r--gcc/omp-simd-clone.cc8
12 files changed, 105 insertions, 72 deletions
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 3848f37..c3d45a6 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -1175,6 +1175,10 @@ Wopenacc-parallelism
C C++ Var(warn_openacc_parallelism) Warning
Warn about potentially suboptimal choices related to OpenACC parallelism.
+Wopenmp
+C ObjC C++ ObjC++ Warning Var(warn_openmp) Init(1)
+Warn about suspicious OpenMP code
+
Wopenmp-simd
C C++ Var(warn_openmp_simd) Warning LangEnabledBy(C C++,Wall)
Warn if a simd directive is overridden by the vectorizer cost model.
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))
{
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index e4e2fea..2464d1a 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -41161,7 +41161,7 @@ cp_parser_omp_clause_dist_schedule (cp_parser *parser, tree list,
/* check_no_duplicate_clause (list, OMP_CLAUSE_DIST_SCHEDULE,
"dist_schedule", location); */
if (omp_find_clause (list, OMP_CLAUSE_DIST_SCHEDULE))
- warning_at (location, 0, "too many %qs clauses", "dist_schedule");
+ warning_at (location, OPT_Wopenmp, "too many %qs clauses", "dist_schedule");
OMP_CLAUSE_CHAIN (c) = list;
return c;
@@ -43233,7 +43233,7 @@ cp_parser_omp_depobj (cp_parser *parser, cp_token *pragma_tok)
&& destobj != error_mark_node
&& !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);
if (!c_parens.require_close (parser))
@@ -44106,8 +44106,9 @@ cp_parser_omp_scan_loop_body (cp_parser *parser)
substmt = cp_parser_omp_structured_block_sequence (parser, PRAGMA_OMP_SCAN);
else
{
- warning_at (tok->location, 0, "%<#pragma omp scan%> with zero preceding "
- "executable statements");
+ warning_at (tok->location, OPT_Wopenmp,
+ "%<#pragma omp scan%> with zero preceding executable "
+ "statements");
substmt = build_empty_stmt (tok->location);
}
substmt = build2 (OMP_SCAN, void_type_node, substmt, NULL_TREE);
@@ -44153,8 +44154,9 @@ cp_parser_omp_scan_loop_body (cp_parser *parser)
else
{
if (found_scan)
- warning_at (tok->location, 0, "%<#pragma omp scan%> with zero "
- "succeeding executable statements");
+ warning_at (tok->location, OPT_Wopenmp,
+ "%<#pragma omp scan%> with zero succeeding executable "
+ "statements");
substmt = build_empty_stmt (tok->location);
}
substmt = build2_loc (tok->location, OMP_SCAN, void_type_node, substmt,
@@ -47851,7 +47853,7 @@ cp_parser_omp_assumption_clauses (cp_parser *parser, cp_token *pragma_tok,
}
else if (startswith (p, "ext_"))
{
- warning_at (cloc, 0, "unknown assumption clause %qs", p);
+ warning_at (cloc, OPT_Wopenmp, "unknown assumption clause %qs", p);
cp_lexer_consume_token (parser->lexer);
if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN))
for (size_t n = cp_parser_skip_balanced_tokens (parser, 1) - 1;
diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
index f0a8372..3bf5864 100644
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -7561,7 +7561,9 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
"positive");
break;
default:
- warning_at (OMP_CLAUSE_LOCATION (c), 0,
+ warning_at (OMP_CLAUSE_LOCATION (c),
+ (flag_openmp || flag_openmp_simd)
+ ? OPT_Wopenmp : 0,
"%qs value must be positive",
omp_clause_code_name
[OMP_CLAUSE_CODE (c)]);
@@ -7596,7 +7598,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
if (TREE_CODE (t) == INTEGER_CST
&& tree_int_cst_sgn (t) != 1)
{
- warning_at (OMP_CLAUSE_LOCATION (c), 0,
+ warning_at (OMP_CLAUSE_LOCATION (c), OPT_Wopenmp,
"%qs value must be positive",
omp_clause_code_name
[OMP_CLAUSE_CODE (c)]);
@@ -7610,7 +7612,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
&& TREE_CODE (upper) == INTEGER_CST
&& tree_int_cst_lt (upper, t))
{
- warning_at (OMP_CLAUSE_LOCATION (c), 0,
+ warning_at (OMP_CLAUSE_LOCATION (c), OPT_Wopenmp,
"%<num_teams%> lower bound %qE bigger "
"than upper bound %qE", t, upper);
t = NULL_TREE;
@@ -7643,7 +7645,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
if (TREE_CODE (t) == INTEGER_CST
&& tree_int_cst_sgn (t) != 1)
{
- warning_at (OMP_CLAUSE_LOCATION (c), 0,
+ warning_at (OMP_CLAUSE_LOCATION (c), OPT_Wopenmp,
"chunk size value must be positive");
t = integer_one_node;
}
@@ -7739,7 +7741,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
if (TREE_CODE (t) == INTEGER_CST
&& tree_int_cst_sgn (t) != 1)
{
- warning_at (OMP_CLAUSE_LOCATION (c), 0,
+ warning_at (OMP_CLAUSE_LOCATION (c), OPT_Wopenmp,
"%<thread_limit%> value must be positive");
t = integer_one_node;
}
@@ -7935,7 +7937,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
}
else if (bitmap_bit_p (&aligned_head, DECL_UID (t)))
{
- warning_at (OMP_CLAUSE_LOCATION (c), 0,
+ warning_at (OMP_CLAUSE_LOCATION (c), OPT_Wopenmp,
"%qD appears more than once in %<allocate%> clauses",
t);
remove = true;
@@ -8707,7 +8709,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
if (TREE_CODE (t) == INTEGER_CST
&& tree_int_cst_sgn (t) != 1)
{
- warning_at (OMP_CLAUSE_LOCATION (c), 0,
+ warning_at (OMP_CLAUSE_LOCATION (c), OPT_Wopenmp,
"%<grainsize%> value must be positive");
t = integer_one_node;
}
@@ -8737,7 +8739,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
if (TREE_CODE (t) == INTEGER_CST
&& tree_int_cst_sgn (t) == -1)
{
- warning_at (OMP_CLAUSE_LOCATION (c), 0,
+ warning_at (OMP_CLAUSE_LOCATION (c), OPT_Wopenmp,
"%<priority%> value must be non-negative");
t = integer_one_node;
}
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 7801f80..23e2b74 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -383,7 +383,7 @@ Objective-C and Objective-C++ Dialects}.
-Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
-Wnull-dereference -Wno-odr
-Wopenacc-parallelism
--Wopenmp-simd
+-Wopenmp -Wopenmp-simd
-Wno-overflow -Woverlength-strings -Wno-override-init-side-effects
-Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded
-Wparentheses -Wno-pedantic-ms-format
@@ -9957,6 +9957,11 @@ Enabled by default.
@item -Wopenacc-parallelism
Warn about potentially suboptimal choices related to OpenACC parallelism.
+@opindex Wopenmp
+@opindex Wno-openmp
+@item -Wno-openmp
+Warn about suspicious OpenMP code.
+
@opindex Wopenmp-simd
@opindex Wno-openmp-simd
@item -Wopenmp-simd
diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt
index 08c7539..adcfc28 100644
--- a/gcc/fortran/lang.opt
+++ b/gcc/fortran/lang.opt
@@ -289,6 +289,10 @@ Wopenacc-parallelism
Fortran
; Documented in C
+Wopenmp
+Fortran
+; Documented in C
+
Wopenmp-simd
Fortran
; Documented in C
diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc
index b9ac611..794df19 100644
--- a/gcc/fortran/openmp.cc
+++ b/gcc/fortran/openmp.cc
@@ -21,6 +21,7 @@ along with GCC; see the file COPYING3. If not see
#include "config.h"
#include "system.h"
#include "coretypes.h"
+#include "options.h"
#include "gfortran.h"
#include "arith.h"
#include "match.h"
@@ -5563,8 +5564,9 @@ gfc_match_omp_declare_target (void)
&& !c->lists[OMP_LIST_ENTER]
&& !c->lists[OMP_LIST_TO]
&& !c->lists[OMP_LIST_LINK])
- gfc_warning_now (0, "OMP DECLARE TARGET directive at %L with only "
- "DEVICE_TYPE clause is ignored", &old_loc);
+ gfc_warning_now (OPT_Wopenmp,
+ "OMP DECLARE TARGET directive at %L with only "
+ "DEVICE_TYPE clause is ignored", &old_loc);
gfc_buffer_error (true);
@@ -7030,7 +7032,8 @@ resolve_positive_int_expr (gfc_expr *expr, const char *clause)
if (expr->expr_type == EXPR_CONSTANT
&& expr->ts.type == BT_INTEGER
&& mpz_sgn (expr->value.integer) <= 0)
- gfc_warning (0, "INTEGER expression of %s clause at %L must be positive",
+ gfc_warning ((flag_openmp || flag_openmp_simd) ? OPT_Wopenmp : 0,
+ "INTEGER expression of %s clause at %L must be positive",
clause, &expr->where);
}
@@ -7041,8 +7044,9 @@ resolve_nonnegative_int_expr (gfc_expr *expr, const char *clause)
if (expr->expr_type == EXPR_CONSTANT
&& expr->ts.type == BT_INTEGER
&& mpz_sgn (expr->value.integer) < 0)
- gfc_warning (0, "INTEGER expression of %s clause at %L must be "
- "non-negative", clause, &expr->where);
+ gfc_warning ((flag_openmp || flag_openmp_simd) ? OPT_Wopenmp : 0,
+ "INTEGER expression of %s clause at %L must be non-negative",
+ clause, &expr->where);
}
/* Emits error when symbol is pointer, cray pointer or cray pointee
@@ -7605,8 +7609,8 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses,
else if (expr->expr_type == EXPR_CONSTANT
&& expr->ts.type == BT_INTEGER
&& mpz_sgn (expr->value.integer) <= 0)
- gfc_warning (0, "INTEGER expression of SCHEDULE clause's chunk_size "
- "at %L must be positive", &expr->where);
+ gfc_warning (OPT_Wopenmp, "INTEGER expression of SCHEDULE clause's "
+ "chunk_size at %L must be positive", &expr->where);
}
if (omp_clauses->sched_kind != OMP_SCHED_NONE
&& omp_clauses->sched_nonmonotonic)
@@ -7916,8 +7920,8 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses,
}
if (n->sym->mark == 1)
{
- gfc_warning (0, "%qs appears more than once in %<allocate%> "
- "at %L" , n->sym->name, &n->where);
+ gfc_warning (OPT_Wopenmp, "%qs appears more than once in "
+ "%<allocate%> at %L" , n->sym->name, &n->where);
/* We have already seen this variable so it is a duplicate.
Remove it. */
if (prev != NULL && prev->next == n)
@@ -8915,8 +8919,8 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses,
&& omp_clauses->num_teams_upper->expr_type == EXPR_CONSTANT
&& mpz_cmp (omp_clauses->num_teams_lower->value.integer,
omp_clauses->num_teams_upper->value.integer) > 0)
- gfc_warning (0, "NUM_TEAMS lower bound at %L larger than upper bound at %L",
- &omp_clauses->num_teams_lower->where,
+ gfc_warning (OPT_Wopenmp, "NUM_TEAMS lower bound at %L larger than upper "
+ "bound at %L", &omp_clauses->num_teams_lower->where,
&omp_clauses->num_teams_upper->where);
if (omp_clauses->device)
resolve_scalar_int_expr (omp_clauses->device, "DEVICE");
@@ -9753,13 +9757,15 @@ gfc_resolve_omp_do_blocks (gfc_code *code, gfc_namespace *ns)
else
{
if (block->op == EXEC_OMP_SCAN)
- gfc_warning (0, "!$OMP SCAN at %L with zero executable "
+ gfc_warning (OPT_Wopenmp,
+ "!$OMP SCAN at %L with zero executable "
"statements in preceding structured block "
"sequence", &block->loc);
if ((block->op == EXEC_OMP_SCAN && !block->next)
|| (block->next && block->next->op == EXEC_OMP_SCAN
&& !block->next->next))
- gfc_warning (0, "!$OMP SCAN at %L with zero executable "
+ gfc_warning (OPT_Wopenmp,
+ "!$OMP SCAN at %L with zero executable "
"statements in succeeding structured block "
"sequence", block->op == EXEC_OMP_SCAN
? &block->loc : &block->next->loc);
diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index d52d71b..02f85e7 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -14382,7 +14382,7 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p)
OMP_CLAUSE_LASTPRIVATE))
if (OMP_CLAUSE_DECL (c3) == decl)
{
- warning_at (OMP_CLAUSE_LOCATION (c3), 0,
+ warning_at (OMP_CLAUSE_LOCATION (c3), OPT_Wopenmp,
"conditional %<lastprivate%> on loop "
"iterator %qD ignored", decl);
OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (c3) = 0;
@@ -14490,7 +14490,7 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p)
OMP_CLAUSE_LASTPRIVATE))
if (OMP_CLAUSE_DECL (c3) == decl)
{
- warning_at (OMP_CLAUSE_LOCATION (c3), 0,
+ warning_at (OMP_CLAUSE_LOCATION (c3), OPT_Wopenmp,
"conditional %<lastprivate%> on loop "
"iterator %qD ignored", decl);
OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (c3) = 0;
diff --git a/gcc/omp-expand.cc b/gcc/omp-expand.cc
index 5c6a7f2..8281ec6 100644
--- a/gcc/omp-expand.cc
+++ b/gcc/omp-expand.cc
@@ -3416,8 +3416,9 @@ expand_omp_ordered_sink (gimple_stmt_iterator *gsi, struct omp_for_data *fd,
forward = tree_int_cst_sgn (step) != -1;
}
if (forward ^ OMP_CLAUSE_DOACROSS_SINK_NEGATIVE (deps))
- warning_at (loc, 0, "%qs clause with %<sink%> modifier "
- "waiting for lexically later iteration",
+ warning_at (loc, OPT_Wopenmp,
+ "%qs clause with %<sink%> modifier "
+ "waiting for lexically later iteration",
OMP_CLAUSE_DOACROSS_DEPEND (c)
? "depend" : "doacross");
break;
@@ -3555,9 +3556,9 @@ expand_omp_ordered_sink (gimple_stmt_iterator *gsi, struct omp_for_data *fd,
build_int_cst (itype, 0));
if (integer_zerop (t) && !warned_step)
{
- warning_at (loc, 0, "%qs clause with %<sink%> modifier "
- "refers to iteration never in the iteration "
- "space",
+ warning_at (loc, OPT_Wopenmp,
+ "%qs clause with %<sink%> modifier refers to "
+ "iteration never in the iteration space",
OMP_CLAUSE_DOACROSS_DEPEND (c)
? "depend" : "doacross");
warned_step = true;
diff --git a/gcc/omp-general.cc b/gcc/omp-general.cc
index b88d593..8241574 100644
--- a/gcc/omp-general.cc
+++ b/gcc/omp-general.cc
@@ -1201,12 +1201,12 @@ omp_check_context_selector (location_t loc, tree ctx)
return error_mark_node;
}
else if (TREE_PURPOSE (t2))
- warning_at (loc, 0,
+ warning_at (loc, OPT_Wopenmp,
"unknown property %qs of %qs selector",
IDENTIFIER_POINTER (TREE_PURPOSE (t2)),
props[i].selector);
else
- warning_at (loc, 0,
+ warning_at (loc, OPT_Wopenmp,
"unknown property %qE of %qs selector",
TREE_VALUE (t2), props[i].selector);
break;
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;
diff --git a/gcc/omp-simd-clone.cc b/gcc/omp-simd-clone.cc
index 57b0793..3fbe428 100644
--- a/gcc/omp-simd-clone.cc
+++ b/gcc/omp-simd-clone.cc
@@ -387,13 +387,13 @@ simd_clone_clauses_extract (struct cgraph_node *node, tree clauses,
step = fold_convert (ssizetype, step);
if (!tree_fits_shwi_p (step))
{
- warning_at (OMP_CLAUSE_LOCATION (t), 0,
+ warning_at (OMP_CLAUSE_LOCATION (t), OPT_Wopenmp,
"ignoring large linear step");
return NULL;
}
else if (integer_zerop (step))
{
- warning_at (OMP_CLAUSE_LOCATION (t), 0,
+ warning_at (OMP_CLAUSE_LOCATION (t), OPT_Wopenmp,
"ignoring zero linear step");
return NULL;
}
@@ -455,7 +455,7 @@ simd_clone_clauses_extract (struct cgraph_node *node, tree clauses,
out:
if (TYPE_ATOMIC (TREE_TYPE (TREE_TYPE (node->decl))))
{
- warning_at (DECL_SOURCE_LOCATION (node->decl), 0,
+ warning_at (DECL_SOURCE_LOCATION (node->decl), OPT_Wopenmp,
"ignoring %<#pragma omp declare simd%> on function "
"with %<_Atomic%> qualified return type");
return NULL;
@@ -465,7 +465,7 @@ simd_clone_clauses_extract (struct cgraph_node *node, tree clauses,
if (TYPE_ATOMIC (args[argno])
&& clone_info->args[argno].arg_type != SIMD_CLONE_ARG_TYPE_UNIFORM)
{
- warning_at (DECL_SOURCE_LOCATION (node->decl), 0,
+ warning_at (DECL_SOURCE_LOCATION (node->decl), OPT_Wopenmp,
"ignoring %<#pragma omp declare simd%> on function "
"with %<_Atomic%> qualified non-%<uniform%> argument");
args.release ();