diff options
Diffstat (limited to 'gcc/ada/prep.adb')
-rw-r--r-- | gcc/ada/prep.adb | 63 |
1 files changed, 29 insertions, 34 deletions
diff --git a/gcc/ada/prep.adb b/gcc/ada/prep.adb index bbfb5b723e5..b2ec857b96d 100644 --- a/gcc/ada/prep.adb +++ b/gcc/ada/prep.adb @@ -128,7 +128,7 @@ package body Prep is -- Behaviour -- --------------- - -- Accesses to procedure specified by procedure Initialize. + -- Accesses to procedure specified by procedure Initialize Error_Msg : Error_Msg_Proc; -- Report an error @@ -159,7 +159,7 @@ package body Prep is -- Used to detect multiple #else. Deleting : Boolean; - -- Set to True when the code should be deleted or commented out. + -- Set to True when the code should be deleted or commented out Match_Seen : Boolean; -- Set to True when a condition in an #if or an #elsif is True. @@ -276,8 +276,7 @@ package body Prep is then for J in Index + 1 .. Definition'Last loop case Definition (J) is - when '_' | '.' | '0' .. '9' | - 'a' .. 'z' | 'A' .. 'Z' => + when '_' | '.' | '0' .. '9' | 'a' .. 'z' | 'A' .. 'Z' => null; when others => @@ -336,8 +335,7 @@ package body Prep is -- Put the symbol name in the result declare - Sym : constant String := - Name_Buffer (1 .. Name_Len); + Sym : constant String := Name_Buffer (1 .. Name_Len); begin for Index in 1 .. Name_Len loop @@ -374,13 +372,13 @@ package body Prep is ---------------- function Expression (Evaluate_It : Boolean) return Boolean is - Evaluation : Boolean := Evaluate_It; + Evaluation : Boolean := Evaluate_It; -- Is set to False after an "or else" when left term is True and -- after an "and then" when left term is False. - Final_Result : Boolean := False; + Final_Result : Boolean := False; - Current_Result : Boolean := False; + Current_Result : Boolean := False; -- Value of a term Current_Operator : Operator := None; @@ -430,6 +428,7 @@ package body Prep is Scan.all; if Token = Tok_Apostrophe then + -- symbol'Defined Scan.all; @@ -690,9 +689,9 @@ package body Prep is procedure Output_Line (From, To : Source_Ptr); -- Output a line or the end of a line from the buffer to the output - -- file, followed by an end of line terminator. - -- Depending on the value of Deleting and the switches, the line - -- may be commented out, blank or not output at all. + -- file, followed by an end of line terminator. Depending on the value + -- of Deleting and the switches, the line may be commented out, blank or + -- not output at all. ------------ -- Output -- @@ -739,13 +738,12 @@ package body Prep is begin Start_Of_Processing := Scan_Ptr; - -- We need to call Scan for the first time, because Initialyze_Scanner + -- We need to call Scan for the first time, because Initialize_Scanner -- is no longer doing it. Scan.all; - Input_Line_Loop : - loop + Input_Line_Loop : loop exit Input_Line_Loop when Token = Tok_EOF; Preprocessor_Line := False; @@ -760,9 +758,9 @@ package body Prep is case Token is - when Tok_If => - -- #if + -- #if + when Tok_If => declare If_Ptr : constant Source_Ptr := Token_Ptr; @@ -806,9 +804,9 @@ package body Prep is end; end; - when Tok_Elsif => - -- #elsif + -- #elsif + when Tok_Elsif => Cond := False; if Pp_States.Last = 0 @@ -860,9 +858,9 @@ package body Prep is end if; end if; - when Tok_Else => - -- #else + -- #else + when Tok_Else => if Pp_States.Last = 0 then Error_Msg ("no IF for this ELSE", Token_Ptr); @@ -906,9 +904,9 @@ package body Prep is Go_To_End_Of_Line; end if; - when Tok_End => - -- #end if; + -- #end if; + when Tok_End => if Pp_States.Last = 0 then Error_Msg ("no IF for this END", Token_Ptr); end if; @@ -944,15 +942,15 @@ package body Prep is Go_To_End_Of_Line; - -- Decrement the depth of the #if stack. + -- Decrement the depth of the #if stack if Pp_States.Last > 0 then Pp_States.Decrement_Last; end if; - when others => - -- Illegal preprocessor line + -- Illegal preprocessor line + when others => if Pp_States.Last = 0 then Error_Msg ("IF expected", Token_Ptr); @@ -990,8 +988,8 @@ package body Prep is and then Special_Character = '$' then declare - Dollar_Ptr : constant Source_Ptr := Token_Ptr; - Symbol : Symbol_Id; + Dollar_Ptr : constant Source_Ptr := Token_Ptr; + Symbol : Symbol_Id; begin Scan.all; @@ -1004,8 +1002,7 @@ package body Prep is Symbol := Index_Of (Token_Name); - -- If there is such a symbol, replace it by its - -- value. + -- If symbol exists, replace by its value if Symbol /= No_Symbol then Output (Start_Of_Processing, Dollar_Ptr - 1); @@ -1070,15 +1067,13 @@ package body Prep is and then Sinput.Source (Token_Ptr + 1) = ASCII.LF) then Start_Of_Processing := Token_Ptr + 2; - else Start_Of_Processing := Token_Ptr + 1; end if; end if; - -- Now, we scan the first token of the next line. - -- If the token is EOF, the scan ponter will not move, and the token - -- will still be EOF. + -- Now, scan the first token of the next line. If the token is EOF, + -- the scan ponter will not move, and the token will still be EOF. Set_Ignore_Errors (To => True); Scan.all; |