This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] project file fixes


Tested on i686-linux, committed on trunk

In some circumstances, the location of some error is not known.
Procedure Prj.Nmsc.Error_Msg was not protected against this and was
calling Prj.Err.Error with an unknown location, resulting in a crash.

The test for this is to call "gnatmake -P prj.gpr" for the following
project file prj.gpr:

project Prj is

   for Library_Name use "prj";
   for Library_Dir  use "lib";

   Interface_List := ("toto", "titi");

   for Library_Interface use Interface_List;

end Prj;

when the file toto.ads is in the project directory, but not the file
titi.ads. gnatmake should report
   unknown unit "titi"
and should not crash.

Also enhance warning message when a spec or a body file
name is specified for a unit and the file does not exist.

The test for this is to have a project Prj:

with "imp/imp.gpr";
project Prj is
   package Naming is
     for Spec ("Toto") use "toto_spec.ada";
     for Body ("Toto") use "toto_body.ada";
   end Naming;
end Prj;

but the files toto_spec.ada and toto_body.ada do not exist.

It imports a project Imp that contains the spec of a package Toto (toto.ads);
	
The following warnings should then be issued when building project Prj:
prj.gpr:4:28: warning: source of spec of unit "toto" ("toto_spec.ada")
                       cannot be found in this project
prj.gpr:5:28: warning: source of body of unit "toto" ("toto_body.ada")
                       cannot be found in this project

Finally, it is now possible to specify to the Project Manager what should be
done when there are no Ada sources in a project where they should be some:
issue an error (the default), issue a warning or be silent.
There is no test for this, as the current tools using the project manager
are not modified and use the default: error.

2006-02-13  Vincent Celier  <celier@adacore.com>

	* prj.ads (Error_Warning): New enumeration type

	* prj-nmsc.ads, prj-nmsc.adb (Error_Msg): If location parameter is
	unknown, use the location of the project to report the error.
	(When_No_Sources): New global variable
	(Report_No_Ada_Sources): New procedure
	(Check): New parameter When_No_Sources. Set value of global variable
	When_No_Sources,
	(Find_Sources): Call Report_No_Ada_Sources when appropriate
	(Get_Sources_From_File): Ditto
	(Warn_If_Not_Sources): Better warning messages indicating the unit name
	and the file name.

	* prj-pars.ads, prj-pars.adb (Parse): New parameter When_No_Sources.
	Call Prj.Proc.Process with parameter When_No_Sources.

	* prj-proc.ads, prj-proc.adb (Check): New parameter When_No_Sources.
	Call Recursive_Check with parameter When_No_Sources.
	(Recursive_Check): New parameter When_No_Sources. Call itself and
	Prj.Nmsc.Check with parameter When_No_Sources.
	(Process): New parameter When_No_Sources. Call Check with parameter
	When_No_Sources.
	(Copy_Package_Declarations): New procedure to copy renamed parameters
	and setting the location of the declared attributes to the location
	of the renamed package.
	(Process_Declarative_Items): Call Copy_Package_Declarations for renamed
	packages.

Attachment: difs.65
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]