[Ada] Better error message on missing parentheses

Message ID 20211110085824.GA2810986@adacore.com
State Committed
Commit 29900c061a6ebbd773cbdfdd86a28df2680dfe8a
Headers
Series [Ada] Better error message on missing parentheses |

Commit Message

Pierre-Marie de Rodat Nov. 10, 2021, 8:58 a.m. UTC
  Adapt the test to issue a different error message when it is likely that
an if-expression is suspected, but parentheses are missing. This makes
the test more in line with its comment.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* par-ch4.adb (P_Primary): Adapt test for getting error message
	on missing parentheses.
  

Patch

diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb
--- a/gcc/ada/par-ch4.adb
+++ b/gcc/ada/par-ch4.adb
@@ -2892,8 +2892,10 @@  package body Ch4 is
                if Token_Is_At_Start_Of_Line
                  and then not
                    (Ada_Version >= Ada_2012
-                     and then Style_Check_Indentation /= 0
-                     and then Start_Column rem Style_Check_Indentation /= 0)
+                      and then
+                        (Style_Check_Indentation = 0
+                           or else
+                             Start_Column rem Style_Check_Indentation /= 0))
                then
                   Error_Msg_AP ("missing operand");
                   return Error;