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] gnatmake fixes


Tested on i686-linux, committed on trunk

As gnatmake transmits to the compiler some of the options it does
not recognize, missing one of the two hyphens of some of the gnatmake
options (such as --RTS=...) may go unnoticed as the compiler may ignore
the transmitted option. This patch ensure that such incorrect options
will not go unnoticed.
The test for this is to invoke gnatmake with option -RTS=none: it should
fail immediately with an error.

When gnatmake invokes the compiler for predefined files, it always
add the compiler switch -gnatpg. Putting this switch before the user
switches allows to remove any style checks with -gnatyN.
The test for this is to compile a predefined file with a different
style, using gnatmake -a -gnatyN. There should be no style error
reported.

For annex J renamings Calendar, Machine_Code, Unchecked_Conversion and
Unchecked_Deallocation, it was not possible to recompile a replacement
without using switch -gnatg. It is now possible without -gnatg.
The test for this is to declare a package Calendar and to invoke
the compiler without -gnatg. No error message indicating that
"language defined units may not be recompiled" should be issued.

When a runtime source is copied in a project file, but not compiled
because gnatmake was not invoked with -a, its ALI file is not in the
the object directory, so putting this unit in the mapping file with
a non existent ALI file results in a gnatbind failure.

The test for this is to invoke:

   gnatmake -C -P prj.gpr

Where prj.gpr contains:
project Prj is
   for Main use ("main.adb");
end Prj;

and where there are two sources, main.adb and gnat.ads:

package GNAT is
end GNAT;

with GNAT;
procedure Main is
begin
   null;
end Main;

The build should succeed.

When on the path, there are several GCC bin directories, the first one
without the Ada compiler (GNAT), gnatmake invoked without directory
information (from the second bin dir) will spawn gcc from the first bin
dir, resulting with a failure, as gnat1 cannot be found. This patch fixes
this: gcc from the correct bin dir will now be used.
The test for this is to have two GCC bin directories on the path, the
first one without GNAT, and to invoke gnatmake to build an executable.

The switch -S, when used in a gnatmake invocation, was transmitted to
the compiler so that it produces an assembly file instead of an object
file. Creating a switch -S had changed this behaviour. So, the recently
created gnatmake switch -S is changed to -eS.

New switches for gnatmake -ws (ignore warnings), -wn (display warnings
as warnings, the default) and -we (treat warnings as errors) are added
to gnatmake, used when parsing project files.
Consider the following project file:

project Prj is
   package Test is
      for Makefile use "Makefile";
      for Make     use "makes";
   end Test;
end Prj;

When gnatmake is invoked with -ws, no warnings should be output.
When gnatmake is invoked with -we, gnatmake should fail as in:

$ gnatmake -we -P prj
prj.gpr:2:12: warning: "test" is not a known package name
gnatmake: "prj" processing failed

2007-04-06  Vincent Celier  <celier@adacore.com>

	* errutil.adb (Initialize): Initialize warnings table, if all warnings
	are suppressed, supply an initial dummy entry covering all possible
	source locations.

	* make.adb (Scan_Make_Arg): Reject options that should start with "--"
	and start with only one, such as "-RTS=none".
	(Collect_Arguments): Do not check for sources outside of projects.
	Do not collect arguments if project is externally built.
	(Compile_Sources): Do nothing, not even check if the source is up to
	date, if its project is externally built.
	(Compile): When compiling a predefined source, add -gnatpg
	as the second switch, after -c.
	(Compile_Sources): Allow compilation of Annex J renames without -a
	(Is_In_Object_Directory): Check if the ALI file is in the object
	even if there is no project extension.
	(Create_Binder_Mapping_File): Only put a unit in the mapping file for
	gnatbind if the ALI file effectively exists.
	(Initialize): Add the directory where gnatmake is invoked in front of
	the path if it is invoked from a bin directory, even without directory
	information, so that the correct GNAT tools will be used when spawned
	without directory information.

	* makeusg.adb: Change switch -S to -eS
	Add lines for new switches -we, -wn and -ws
	Add line for new switch -p

	* prj-proc.adb (Process): Set Success to False when Warning_Mode is
	Treat_As_Error and there are warnings.

	* switch-m.ads, switch-m.adb (Normalize_Compiler_Switches): Do not skip
	-gnatww Change gnatmake switch -S to -eS
	(Scan_Make_Switches): Code reorganisation. Process separately multi
	character switches and single character switches.
	(Scan_Make_Switches): New Boolean out parameter Success. Set Success to
	False when switch is not recognized by gnatmake.
	(Scan_Make_Switches): Set Setup_Projects True when -p or
	--create-missing-dirs is specified.

	* fname.adb (Is_Predefined_File_Name): Return True for annex J
	renamings Calendar, Machine_Code, Unchecked_Conversion and
	Unchecked_Deallocation only when Renamings_Included is True.

	* par.adb: Allow library units Calendar, Machine_Code,
	Unchecked_Conversion and Unchecked_Deallocation to be recompiled even
	when -gnatg is not specified.
	(P_Interface_Type_Definition): Remove the formal Is_Synchronized because
	there is no need to generate always a record_definition_node in case
	of synchronized interface types.
	(SIS_Entry_Active): Initialize global variable to False
	(P_Null_Exclusion): For AI-447: Add parameter Allow_Anonymous_In_95 to
	indicate cases where AI-447 says "not null" is legal.

	* makeutl.ads, makeutil.adb (Executable_Prefix_Path): New function

	* makegpr.adb (Check_Compilation_Needed): Take into account dependency
	files with with several lines starting with the object fileb name.
	(Scan_Arg): Set Setup_Projects True when -p or --create-missing-dirs
	is specified.
	(Initialize): Add the directory where gprmake is invoked in front of the
	path, if it is invoked from a bin directory or with directory
	information, so that the correct GNAT tools will be used when invoked
	directly.
	(Check_Compilation_Needed): Process correctly backslashes on Windows.

	* vms_data.ads: Update switches/qualifiers

Attachment: difs
Description: Text document


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