Is_Main_Unit => Parent (N) = Cunit (Main_Unit));
end if;
- -- Warn about references to unset objects, which is straightforward
- -- for packages with no bodies. For packages with bodies this is more
- -- complicated, because some of the objects might be set between spec
- -- and body elaboration, in nested or child packages, etc.
-
- Check_References (Id);
+ -- For package declarations at the library level, warn about
+ -- references to unset objects, which is straightforward for packages
+ -- with no bodies. For packages with bodies this is more complicated,
+ -- because some of the objects might be set between spec and body
+ -- elaboration, in nested or child packages, etc. Note that the
+ -- recursive calls in Check_References will handle nested package
+ -- specifications.
+
+ if Is_Library_Level_Entity (Id) then
+ Check_References (Id);
+ end if;
end if;
-- Set Body_Required indication on the compilation unit node