[Ada] Suppress unused warnings in the presence of errors

Message ID 20191216103826.GA39499@adacore.com
State New
Headers show
  • [Ada] Suppress unused warnings in the presence of errors
Related show

Commit Message

Pierre-Marie de Rodat Dec. 16, 2019, 10:38 a.m.
The compiler no longer warns about unused use clauses, unused
declarations, and the like, if errors were already detected. This is an
improvement, because the errors can hide the relevant uses, and thus
cause things to look "unused" when they are not.

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

2019-12-16  Bob Duff  <duff@adacore.com>


	* errout.adb (Handle_Serious_Error): Disable the above-mentioned


--- gcc/ada/errout.adb
+++ gcc/ada/errout.adb
@@ -861,6 +861,14 @@  package body Errout is
                end if;
          end if;
+         --  Disable warnings on unused use clauses and the like. Otherwise, an
+         --  error might hide a reference to an entity in a used package, so
+         --  after fixing the error, the use clause no longer looks like it was
+         --  unused.
+         Check_Unreferenced := False;
+         Check_Unreferenced_Formals := False;
       end Handle_Serious_Error;
    --  Start of processing for Error_Msg_Internal