]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
OpenMP: Add -Wopenmp and use it
authorTobias Burnus <tobias@codesourcery.com>
Fri, 24 Nov 2023 14:31:08 +0000 (15:31 +0100)
committerTobias Burnus <tobias@codesourcery.com>
Fri, 24 Nov 2023 14:31:08 +0000 (15:31 +0100)
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}.

12 files changed:
gcc/c-family/c.opt
gcc/c/c-parser.cc
gcc/cp/parser.cc
gcc/cp/semantics.cc
gcc/doc/invoke.texi
gcc/fortran/lang.opt
gcc/fortran/openmp.cc
gcc/gimplify.cc
gcc/omp-expand.cc
gcc/omp-general.cc
gcc/omp-low.cc
gcc/omp-simd-clone.cc

index 3848f378de1ac72d60c3fbbd3c97d05127db6c2a..c3d45a6ed967ede711e08e0b2cab4aeb7b5094d1 100644 (file)
@@ -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.
index 989c0503f37644ab7389502e961a86e6e0e17205..df9a07928b5662e970950019e99bbedbb5f1a2c4 100644 (file)
@@ -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))
            {
index e4e2feac48679777242b58c66c3053c8ada94dd5..2464d1a078394ef5e83abfe92eea8a28cdcd47ef 100644 (file)
@@ -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;
index f0a8372683db4b4b4453e8b477e61ce5b4e1f082..3bf586453dcbb30eee9d8c0a095734cb4cd31400 100644 (file)
@@ -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;
                    }
index 7801f80ff3c6819ba38204044fc0e7acef4d2e09..23e2b7415b1859115987c5a103d2a8ff24a17e66 100644 (file)
@@ -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
index 08c75394aa010f7c9b262cc9517c2c6f86cfbf2d..adcfc280b5ae29c7486a02d13ec7c023c69522ab 100644 (file)
@@ -289,6 +289,10 @@ Wopenacc-parallelism
 Fortran
 ; Documented in C
 
+Wopenmp
+Fortran
+; Documented in C
+
 Wopenmp-simd
 Fortran
 ; Documented in C
index b9ac61103af5763854a695a77948c33411bf2323..794df19a4d1accd083b4418d0e718423e1f251d3 100644 (file)
@@ -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);
index d52d71b9b6bc67d616849634114bedcaa98d0888..02f85e7109b30ba6ff84fa814f95eaae7495362c 100644 (file)
@@ -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;
index 5c6a7f2e381e8130094a5c826ffb85861828e3c2..8281ec67e003a6e9b19a26aa3a0cbaf91869b697 100644 (file)
@@ -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;
index b88d5930aab9a6724814ced632b2b32a2b589c09..8241574651d9d7dc313cc00c32616b8d2c7cd849 100644 (file)
@@ -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;
index 161bcfeec057a1dd26099ac457e565113500f79a..dd802ca37a6e94c08d8314ff5ec0e833a5048692 100644 (file)
@@ -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;
index 57b0793e1ad4892cef6431132cf92d2062bdb862..3fbe428125243bc02bd58f6e50a3333c773e8df8 100644 (file)
@@ -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 ();