[Ada] Remove tiny and incomplete optimization for unset references
authorPiotr Trojanek <trojanek@adacore.com>
Thu, 20 Jan 2022 21:37:30 +0000 (22:37 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 10 May 2022 08:19:26 +0000 (08:19 +0000)
Code cleanup; behaviour is unaffected.

gcc/ada/

* sem_warn.adb (Check_Unset_Reference): The early test was only
saving time of calls to Original_Node, Comes_From_Source and
Nkind, which are all quick and cheap.

gcc/ada/sem_warn.adb

index 8ca5c76..31ba4d1 100644 (file)
@@ -1882,15 +1882,6 @@ package body Sem_Warn is
          return;
       end if;
 
-      --  Nothing to do for numeric or string literal. Do this test early to
-      --  save time in a common case (it does not matter that we do not include
-      --  character literal here, since that will be caught later on in the
-      --  when others branch of the case statement).
-
-      if Nkind (N) in N_Numeric_Or_String_Literal then
-         return;
-      end if;
-
       --  Ignore reference unless it comes from source. Almost always if we
       --  have a reference from generated code, it is bogus (e.g. calls to init
       --  procs to set default discriminant values).