===================================================================
@@ -2788,7 +2788,7 @@ package body Ch4 is
end if;
Scan; -- past IF or ELSIF
- Append_To (Exprs, P_Expression_No_Right_Paren);
+ Append_To (Exprs, P_Condition);
TF_Then;
Append_To (Exprs, P_Expression);
===================================================================
@@ -709,6 +709,9 @@ function Par (Configuration_Pragmas : Bo
-------------
package Ch5 is
+ function P_Condition return Node_Id;
+ -- Scan out and return a condition
+
function P_Statement_Name (Name_Node : Node_Id) return Node_Id;
-- Given a node representing a name (which is a call), converts it
-- to the syntactically corresponding procedure call statement.
@@ -1255,6 +1258,7 @@ function Par (Configuration_Pragmas : Bo
-- Start of processing for Par
begin
+ Compiler_State := Parsing;
-- Deal with configuration pragmas case first
@@ -1266,10 +1270,12 @@ begin
begin
loop
if Token = Tok_EOF then
+ Compiler_State := Analyzing;
return Pragmas;
elsif Token /= Tok_Pragma then
Error_Msg_SC ("only pragmas allowed in configuration file");
+ Compiler_State := Analyzing;
return Error_List;
else
@@ -1479,6 +1485,7 @@ begin
Restore_Opt_Config_Switches (Save_Config_Switches);
Set_Comes_From_Source_Default (False);
+ Compiler_State := Analyzing;
return Empty_List;
end if;
end Par;
===================================================================
@@ -34,7 +34,6 @@ package body Ch5 is
function P_Case_Statement return Node_Id;
function P_Case_Statement_Alternative return Node_Id;
- function P_Condition return Node_Id;
function P_Exit_Statement return Node_Id;
function P_Goto_Statement return Node_Id;
function P_If_Statement return Node_Id;
The style option -gnatyx checks for extra parentheses for conditional expressions in IF and WHILE statements, but did not apply to conditions in conditional expressions. This patch makes it apply to this case as well: The following should be compiled with -gnatyx 1. pragma Ada_2012; 2. package Condexx is 3. x : integer := (if (1 = 2) then 1 else 2); | >>> warning: redundant parentheses 4. end Condexx; Tested on x86_64-pc-linux-gnu, committed on trunk 2010-09-10 Robert Dewar <dewar@adacore.com> * par-ch4.adb (P_Conditional_Expression): Use P_Condition for condition * par-ch5.adb (P_Condition): Move from body to spec * par.adb (Ch5.P_Condition): Move from body to spec