diff options
author | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-22 17:43:43 -0300 |
---|---|---|
committer | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-22 17:43:43 -0300 |
commit | a926878ddbd5a98b272c22171ce58663fc04c3e0 (patch) | |
tree | 86af256e5d9a9c06263c00adc90e5fe348008c43 /gcc/ada/erroutc.adb | |
parent | 542730f087133690b47e036dfd43eb0db8a650ce (diff) | |
parent | 07cbaed8ba7d1b6e4ab3a9f44175502a4e1ecdb1 (diff) | |
download | gcc-devel/autopar_devel.zip gcc-devel/autopar_devel.tar.gz gcc-devel/autopar_devel.tar.bz2 |
Merge branch 'autopar_rebase2' into autopar_develdevel/autopar_devel
Quickly commit changes in the rebase branch.
Diffstat (limited to 'gcc/ada/erroutc.adb')
-rw-r--r-- | gcc/ada/erroutc.adb | 58 |
1 files changed, 46 insertions, 12 deletions
diff --git a/gcc/ada/erroutc.adb b/gcc/ada/erroutc.adb index 3bab352..0c5d98c 100644 --- a/gcc/ada/erroutc.adb +++ b/gcc/ada/erroutc.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2019, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -52,7 +52,7 @@ package body Erroutc is ----------------------- function Matches (S : String; P : String) return Boolean; - -- Returns true if the String S patches the pattern P, which can contain + -- Returns true if the String S matches the pattern P, which can contain -- wildcard chars (*). The entire pattern must match the entire string. -- Case is ignored in the comparison (so X matches x). @@ -249,14 +249,48 @@ package body Erroutc is ------------------------ function Compilation_Errors return Boolean is + Warnings_Count : constant Int + := Warnings_Detected - Warning_Info_Messages; begin - return - Total_Errors_Detected /= 0 - or else (Warnings_Detected - Warning_Info_Messages /= 0 - and then Warning_Mode = Treat_As_Error) - or else Warnings_Treated_As_Errors /= 0; + if Total_Errors_Detected /= 0 then + return True; + + elsif Warnings_Treated_As_Errors /= 0 then + return True; + + -- We should never treat warnings that originate from a + -- Compile_Time_Warning pragma as an error. Warnings_Count is the sum + -- of both "normal" and Compile_Time_Warning warnings. This means that + -- there are only one or more non-Compile_Time_Warning warnings when + -- Warnings_Count is greater than Count_Compile_Time_Pragma_Warnings. + + elsif Warning_Mode = Treat_As_Error + and then Warnings_Count > Count_Compile_Time_Pragma_Warnings + then + return True; + end if; + + return False; end Compilation_Errors; + ---------------------------------------- + -- Count_Compile_Time_Pragma_Warnings -- + ---------------------------------------- + + function Count_Compile_Time_Pragma_Warnings return Int is + Result : Int := 0; + begin + for J in 1 .. Errors.Last loop + begin + if Errors.Table (J).Warn and Errors.Table (J).Compile_Time_Pragma + then + Result := Result + 1; + end if; + end; + end loop; + return Result; + end Count_Compile_Time_Pragma_Warnings; + ------------------ -- Debug_Output -- ------------------ @@ -375,17 +409,17 @@ package body Erroutc is if PPtr = PLast and then P (PPtr) = '*' then return True; - -- Return True if both pattern and string exhausted + -- Return True if both pattern and string exhausted elsif PPtr > PLast and then SPtr > Slast then return True; - -- Return False, if one exhausted and not the other + -- Return False, if one exhausted and not the other elsif PPtr > PLast or else SPtr > Slast then return False; - -- Case where pattern starts with asterisk + -- Case where pattern starts with asterisk elsif P (PPtr) = '*' then @@ -401,13 +435,13 @@ package body Erroutc is return False; - -- Dealt with end of string and *, advance if we have a match + -- Dealt with end of string and *, advance if we have a match elsif Fold_Lower (S (SPtr)) = Fold_Lower (P (PPtr)) then SPtr := SPtr + 1; PPtr := PPtr + 1; - -- If first characters do not match, that's decisive + -- If first characters do not match, that's decisive else return False; |