diff mbox series

[committed,OG14] openmp: Fix error reporting in parsing of C++ OpenMP to/from clause

Message ID 20241206170544.624533-1-ams@baylibre.com
State New
Headers show
Series [committed,OG14] openmp: Fix error reporting in parsing of C++ OpenMP to/from clause | expand

Commit Message

Andrew Stubbs Dec. 6, 2024, 5:05 p.m. UTC
From: Kwok Cheung Yeung <kcyeung@baylibre.com>

The final 'else' when checking the motion modifiers is nested one level
too deep.

This patch should be folded into "OpenMP: Enable 'declare mapper' mappers for
'target update' directives" when merging to mainline.

gcc/cp/ChangeLog:

	* parser.cc (cp_parser_omp_clause_from_to): Move an "else" clause to
	a higher nesting level.
---
 gcc/cp/parser.cc | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index 4157d912039..f52446c5e46 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -42058,16 +42058,16 @@  cp_parser_omp_clause_from_to (cp_parser *parser, enum omp_clause_code kind,
 	      mapper_modifier = true;
 	      pos += 3;
 	    }
-	  else
-	    {
-	      cp_parser_error (parser, "%<to%> or %<from%> clause with "
-			       "modifier other than %<present%> or %<mapper%>");
-	      cp_parser_skip_to_closing_parenthesis (parser,
-						     /*recovering=*/true,
-						     /*or_comma=*/false,
-						     /*consume_paren=*/true);
-	      return list;
-	    }
+	}
+      else
+	{
+	  cp_parser_error (parser, "%<to%> or %<from%> clause with "
+			   "modifier other than %<present%> or %<mapper%>");
+	  cp_parser_skip_to_closing_parenthesis (parser,
+						 /*recovering=*/true,
+						 /*or_comma=*/false,
+						 /*consume_paren=*/true);
+	  return list;
 	}
     }