]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
omp-general.cc: Remove 'if' around call to always 'true' returning function [PR118627]
authorTobias Burnus <tburnus@baylibre.com>
Tue, 25 Mar 2025 14:02:54 +0000 (15:02 +0100)
committerTobias Burnus <tburnus@baylibre.com>
Tue, 25 Mar 2025 14:02:54 +0000 (15:02 +0100)
Before omp_parse_access_method and omp_parse_access_methods unconditionally
returned true, now they are void functions.
Accordingly, calls had to be updated by removing the 'if' around the call;
this also fixes Clang's -Wsometimes-uninitialized warning when compiling
omp-general.cc as one variable remained uninitialized for a never occurring
false.

gcc/ChangeLog:

PR middle-end/118627

* omp-general.cc (omp_parse_access_method): Change to return void.
(omp_parse_access_methods): Return void; remove 'if' around a
function call.
(omp_parse_expr): Remove 'if' around a function call.

gcc/omp-general.cc

index 0a2dd6b5be79f871fbcb4a80af593bae7aaae063..0b7c3b9d3181bd655c63c850e38eae85d170800f 100644 (file)
@@ -4185,7 +4185,7 @@ omp_parse_pointer (tree *expr0, bool *has_offset)
   return false;
 }
 
-static bool
+static void
 omp_parse_access_method (tree *expr0, enum access_method_kinds *kind)
 {
   tree expr = *expr0;
@@ -4216,18 +4216,17 @@ omp_parse_access_method (tree *expr0, enum access_method_kinds *kind)
   STRIP_NOPS (expr);
 
   *expr0 = expr;
-  return true;
 }
 
-static bool
+static void
 omp_parse_access_methods (vec<omp_addr_token *> &addr_tokens, tree *expr0)
 {
   tree expr = *expr0;
   enum access_method_kinds kind;
   tree am_expr;
 
-  if (omp_parse_access_method (&expr, &kind))
-    am_expr = expr;
+  omp_parse_access_method (&expr, &kind);
+  am_expr = expr;
 
   if (TREE_CODE (expr) == INDIRECT_REF
       || TREE_CODE (expr) == MEM_REF
@@ -4237,7 +4236,6 @@ omp_parse_access_methods (vec<omp_addr_token *> &addr_tokens, tree *expr0)
   addr_tokens.safe_push (new omp_addr_token (kind, am_expr));
 
   *expr0 = expr;
-  return true;
 }
 
 static bool omp_parse_structured_expr (vec<omp_addr_token *> &, tree *);
@@ -4355,8 +4353,7 @@ omp_parse_expr (vec<omp_addr_token *> &addr_tokens, tree expr)
   using namespace omp_addr_tokenizer;
   auto_vec<omp_addr_token *> expr_access_tokens;
 
-  if (!omp_parse_access_methods (expr_access_tokens, &expr))
-    return false;
+  omp_parse_access_methods (expr_access_tokens, &expr);
 
   if (omp_parse_structured_expr (addr_tokens, &expr))
     ;