]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Add dependency lines for External_Initialization
authorRonan Desplanques <desplanques@adacore.com>
Tue, 10 Sep 2024 13:54:52 +0000 (15:54 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 8 Oct 2024 08:37:14 +0000 (10:37 +0200)
When a file included through External_Initialization has been modified,
the unit including it must be recompiled. This patch adds the
generation of dependency lines to the handling of the
External_Initialization aspect, to signal that fact to gnatmake and
other tools that invoke GNAT.

gcc/ada/ChangeLog:
* lib-writ.ads (Add_Preprocessing_Dependency): Update
documentation comment.
* sem_ch3.adb (Apply_External_Initialization): Add call to
Add_Preprocessing_Dependency.

gcc/ada/lib-writ.ads
gcc/ada/sem_ch3.adb

index fd62ef9363c28677ca0bbcf36a64ebbd207c8b7e..38206179dfc742317f2cac55ac93a0e6412605b4 100644 (file)
@@ -1064,6 +1064,7 @@ package Lib.Writ is
 
    procedure Add_Preprocessing_Dependency (S : Source_File_Index);
    --  Indicate that there is a dependency to be added on a preprocessing data
-   --  file or on a preprocessing definition file.
+   --  file, on a preprocessing definition file or on a file included through
+   --  External_Initialization.
 
 end Lib.Writ;
index 2a48882d83c3282d0e9a2cde9a8e5ce300fd9158..ea0a97bd39fcf34ae4ee5432a756e6db6a0d25ac 100644 (file)
@@ -47,6 +47,7 @@ with Ghost;          use Ghost;
 with Itypes;         use Itypes;
 with Layout;         use Layout;
 with Lib;            use Lib;
+with Lib.Writ;
 with Lib.Xref;       use Lib.Xref;
 with Mutably_Tagged;    use Mutably_Tagged;
 with Namet;          use Namet;
@@ -3947,6 +3948,8 @@ package body Sem_Ch3 is
                   return;
                end if;
 
+               Lib.Writ.Add_Preprocessing_Dependency (Source_File_I);
+
                Expr :=
                  Make_External_Initializer
                    (Sloc (Specification), Source_File_I);