2009-10-30 Emmanuel Briot <briot@adacore.com>
+ * make.adb (Start_Compile_If_Possible): Compute location of resulting
+ ALI file in this procedure instead of after the compilation itself,
+ since the current directory might have changed in between when using
+ -j<n>.
+
+ * osint.ads: Addded missing alignment clause.
+
+ * adaint.c, adaint.h, osint.adb (__gnat_reset_attributes,
+ __gnat_size_of_file_attributes): Rename reset_attributes and
+ size_of_file_attributes.
+
+2009-10-30 Javier Miranda <miranda@adacore.com>
+
+ * sem_scil.adb (Adjust_SCIL_Node): Add missing management of sequences
+ of statements when searching for SCIL nodes.
+
+2009-10-30 Tristan Gingold <gingold@adacore.com>
+
+ * gnatlink.adb, link.c: By default use shared libgcc on darwin.
+
+2009-10-30 Emmanuel Briot <briot@adacore.com>
+
* make.adb, osint.adb (Add_Lib_Search_Dir): Do not add if dir is
already in the list.
This saves system calls when looking for ALI files
#endif
/* Used for Ada bindings */
-const int size_of_file_attributes = sizeof (struct file_attributes);
+const int __gnat_size_of_file_attributes = sizeof (struct file_attributes);
/* Reset the file attributes as if no system call had been performed */
void __gnat_stat_to_attr (int fd, char* name, struct file_attributes* attr);
#endif
void
-reset_attributes
+__gnat_reset_attributes
(struct file_attributes* attr)
{
attr->exists = -1;
__gnat_file_length (int fd)
{
struct file_attributes attr;
- reset_attributes (&attr);
+ __gnat_reset_attributes (&attr);
return __gnat_file_length_attr (fd, NULL, &attr);
}
__gnat_named_file_length (char *name)
{
struct file_attributes attr;
- reset_attributes (&attr);
+ __gnat_reset_attributes (&attr);
return __gnat_file_length_attr (-1, name, &attr);
}
__gnat_file_time_name (char *name)
{
struct file_attributes attr;
- reset_attributes (&attr);
+ __gnat_reset_attributes (&attr);
return __gnat_file_time_name_attr (name, &attr);
}
__gnat_file_time_fd (int fd)
{
struct file_attributes attr;
- reset_attributes (&attr);
+ __gnat_reset_attributes (&attr);
return __gnat_file_time_fd_attr (fd, &attr);
}
__gnat_file_exists (char *name)
{
struct file_attributes attr;
- reset_attributes (&attr);
+ __gnat_reset_attributes (&attr);
return __gnat_file_exists_attr (name, &attr);
}
__gnat_is_regular_file (char *name)
{
struct file_attributes attr;
- reset_attributes (&attr);
+ __gnat_reset_attributes (&attr);
return __gnat_is_regular_file_attr (name, &attr);
}
__gnat_is_directory (char *name)
{
struct file_attributes attr;
- reset_attributes (&attr);
+ __gnat_reset_attributes (&attr);
return __gnat_is_directory_attr (name, &attr);
}
__gnat_is_readable_file (char *name)
{
struct file_attributes attr;
- reset_attributes (&attr);
+ __gnat_reset_attributes (&attr);
return __gnat_is_readable_file_attr (name, &attr);
}
__gnat_is_writable_file (char *name)
{
struct file_attributes attr;
- reset_attributes (&attr);
+ __gnat_reset_attributes (&attr);
return __gnat_is_writable_file_attr (name, &attr);
}
__gnat_is_executable_file (char *name)
{
struct file_attributes attr;
- reset_attributes (&attr);
+ __gnat_reset_attributes (&attr);
return __gnat_is_executable_file_attr (name, &attr);
}
__gnat_is_symbolic_link (char *name ATTRIBUTE_UNUSED)
{
struct file_attributes attr;
- reset_attributes (&attr);
+ __gnat_reset_attributes (&attr);
return __gnat_is_symbolic_link_attr (name, &attr);
}
extern int __gnat_is_readable_file (char *name);
extern int __gnat_is_executable_file (char *name);
-extern void reset_attributes (struct file_attributes* attr);
+extern void __gnat_reset_attributes (struct file_attributes* attr);
extern long __gnat_file_length_attr (int, char *, struct file_attributes *);
extern OS_Time __gnat_file_time_name_attr (char *, struct file_attributes *);
extern OS_Time __gnat_file_time_fd_attr (int, struct file_attributes *);
Object_List_File_Required : Boolean := False;
-- Set to True to force generation of a response file
+ Shared_Libgcc_Default : Character;
+ for Shared_Libgcc_Default'Size use Character'Size;
+ pragma Import
+ (C, Shared_Libgcc_Default, "__gnat_shared_libgcc_default");
+ -- Indicates wether libgcc should be statically linked (use 'T') or
+ -- dynamically linked (use 'H') by default.
+
function Base_Name (File_Name : String) return String;
-- Return just the file name part without the extension (if present)
if Linker_Path = Gcc_Path and then VM_Target = No_VM then
- -- If gcc is not called with -shared-libgcc, call it with
- -- -static-libgcc, as there are some platforms where one of
- -- these two switches is compulsory to link.
+ -- For systems where the default is to link statically
+ -- with libgcc, if gcc is not called with
+ -- -shared-libgcc, call it with -static-libgcc, as
+ -- there are some platforms where one of these two
+ -- switches is compulsory to link.
- if not Shared_Libgcc_Seen then
+ if Shared_Libgcc_Default = 'T'
+ and then not Shared_Libgcc_Seen
+ then
Linker_Options.Increment_Last;
Linker_Options.Table (Linker_Options.Last) := Static_Libgcc;
Num_Args := Num_Args + 1;
/* shared_libgnat_default gives the system dependent link method that */
/* be used by default for linking libgnat (shared or static) */
+/* shared_libgcc_default gives the system dependent link method that */
+/* be used by default for linking libgcc (shared or statis) */
+
/* using_gnu_linker is set to 1 when the GNU linker is used under this */
/* target. */
int __gnat_link_max = 10000;
unsigned char __gnat_objlist_file_supported = 1;
char __gnat_shared_libgnat_default = STATIC;
+char __gnat_shared_libgcc_default = STATIC;
unsigned char __gnat_using_gnu_linker = 0;
const char *__gnat_object_library_extension = ".a";
unsigned char __gnat_separate_run_path_options = 0;
int __gnat_link_max = 5000;
unsigned char __gnat_objlist_file_supported = 1;
char __gnat_shared_libgnat_default = STATIC;
+char __gnat_shared_libgcc_default = STATIC;
unsigned char __gnat_using_gnu_linker = 0;
const char *__gnat_object_library_extension = ".a";
unsigned char __gnat_separate_run_path_options = 0;
int __gnat_link_max = 30000;
unsigned char __gnat_objlist_file_supported = 1;
char __gnat_shared_libgnat_default = STATIC;
+char __gnat_shared_libgcc_default = STATIC;
unsigned char __gnat_using_gnu_linker = 1;
const char *__gnat_object_library_extension = ".a";
unsigned char __gnat_separate_run_path_options = 0;
int __gnat_link_max = 5000;
unsigned char __gnat_objlist_file_supported = 1;
char __gnat_shared_libgnat_default = STATIC;
+char __gnat_shared_libgcc_default = STATIC;
unsigned char __gnat_using_gnu_linker = 0;
const char *__gnat_object_library_extension = ".a";
unsigned char __gnat_separate_run_path_options = 0;
int __gnat_link_max = 15000;
const unsigned char __gnat_objlist_file_supported = 1;
char __gnat_shared_libgnat_default = STATIC;
+char __gnat_shared_libgcc_default = STATIC;
unsigned char __gnat_using_gnu_linker = 0;
const char *__gnat_object_library_extension = ".a";
unsigned char __gnat_separate_run_path_options = 0;
const char *__gnat_object_file_option = "";
const char *__gnat_run_path_option = "";
char __gnat_shared_libgnat_default = STATIC;
+char __gnat_shared_libgcc_default = STATIC;
int __gnat_link_max = 2147483647;
unsigned char __gnat_objlist_file_supported = 0;
unsigned char __gnat_using_gnu_linker = 0;
const char *__gnat_object_file_option = "";
const char *__gnat_run_path_option = "-Wl,-R";
char __gnat_shared_libgnat_default = STATIC;
+char __gnat_shared_libgcc_default = STATIC;
int __gnat_link_max = 2147483647;
unsigned char __gnat_objlist_file_supported = 0;
unsigned char __gnat_using_gnu_linker = 0;
const char *__gnat_object_file_option = "";
const char *__gnat_run_path_option = "-Wl,-rpath,";
char __gnat_shared_libgnat_default = STATIC;
+char __gnat_shared_libgcc_default = STATIC;
int __gnat_link_max = 8192;
unsigned char __gnat_objlist_file_supported = 1;
unsigned char __gnat_using_gnu_linker = 1;
const char *__gnat_object_file_option = "-Wl,-filelist,";
const char *__gnat_run_path_option = "-Wl,-rpath,";
char __gnat_shared_libgnat_default = STATIC;
+char __gnat_shared_libgcc_default = SHARED;
int __gnat_link_max = 262144;
unsigned char __gnat_objlist_file_supported = 1;
unsigned char __gnat_using_gnu_linker = 0;
const char *__gnat_object_file_option = "";
const char *__gnat_run_path_option = "-Wl,-rpath,";
char __gnat_shared_libgnat_default = STATIC;
+char __gnat_shared_libgcc_default = STATIC;
int __gnat_link_max = 8192;
unsigned char __gnat_objlist_file_supported = 1;
unsigned char __gnat_using_gnu_linker = 1;
const char *__gnat_object_file_option = "";
const char *__gnat_run_path_option = "";
char __gnat_shared_libgnat_default = STATIC;
+char __gnat_shared_libgcc_default = STATIC;
int __gnat_link_max = 2147483647;
unsigned char __gnat_objlist_file_supported = 0;
unsigned char __gnat_using_gnu_linker = 0;
const char *__gnat_run_path_option = "";
const char *__gnat_object_file_option = "";
char __gnat_shared_libgnat_default = STATIC;
+char __gnat_shared_libgcc_default = STATIC;
int __gnat_link_max = 2147483647;
unsigned char __gnat_objlist_file_supported = 0;
unsigned char __gnat_using_gnu_linker = 0;
Normalize_Pathname
(Dir_Name
(Get_Name_String (Full_Lib_File)),
- Resolve_Links => True,
+ Resolve_Links =>
+ Opt.Follow_Links_For_Dirs,
Case_Sensitive => False);
begin
pragma Assert (Pid /= Invalid_Pid);
Running_Compile (OC1) :=
- (Pid => Pid,
+ (Pid => Pid,
Full_Source_File => Sfile,
Lib_File => Afile,
Full_Lib_File => Full_Lib_File,
for J in Running_Compile'First .. Outstanding_Compiles loop
if Pid = Running_Compile (J).Pid then
- Data := Running_Compile (J);
+ Data := Running_Compile (J);
Project := Running_Compile (J).Project;
- -- If a mapping file was used by this compilation,
- -- get its file name for reuse by a subsequent compilation
+ -- If a mapping file was used by this compilation, get its
+ -- file name for reuse by a subsequent compilation.
if Running_Compile (J).Mapping_File /= No_Mapping_File then
Comp_Data := Project_Compilation_Htable.Get
end if;
end if;
+ -- Compute where the ALI file must be generated in
+ -- In_Place_Mode (this does not require to know the
+ -- location of the object directory)
+
if In_Place_Mode then
if Full_Lib_File = No_File then
-- If the library file was not found, then save
Lib_File := Full_Lib_File;
end if;
-
- Lib_File_Attr := Unknown_Attributes;
-
- else
- -- We will recompile, so we'll have to guess the
- -- location of the object file based on the command
- -- line switches and Object_Dir.
-
- Full_Lib_File := No_File;
- Lib_File_Attr := Unknown_Attributes;
end if;
- -- Start the compilation and record it. We can do this
- -- because there is at least one free process.
+ -- Start the compilation and record it. We can do
+ -- this because there is at least one free process.
+ -- This might change the current directory
Collect_Arguments_And_Compile
(Full_Source_File => Full_Source_File,
Pid => Pid,
Process_Created => Process_Created);
- -- Make sure we could successfully start the compilation
+ -- Compute where the ALI file will be generated (for
+ -- cases that might require to know the current
+ -- directory). The current directory might be changed
+ -- when compiling other files so we cannot rely on it
+ -- being the same to find the resulting ALI file.
+
+ if not In_Place_Mode then
+ -- Compute the expected location of the ALI file. This
+ -- can be from several places:
+ -- -i => in place mode. In such a case,
+ -- Full_Lib_File has already been set above
+ -- -D => if specified
+ -- or defaults in current dir
+ -- We could simply use a call similar to
+ -- Osint.Full_Lib_File_Name (Lib_File)
+ -- but that involves system calls and is thus slower
+
+ if Object_Directory_Path /= null then
+ Name_Len := 0;
+ Add_Str_To_Name_Buffer (Object_Directory_Path.all);
+ Add_Str_To_Name_Buffer (Get_Name_String (Lib_File));
+ Full_Lib_File := Name_Find;
+ else
+ if Project_Of_Current_Object_Directory /=
+ No_Project
+ then
+ Get_Name_String
+ (Project_Of_Current_Object_Directory
+ .Object_Directory.Name);
+ Add_Str_To_Name_Buffer
+ (Get_Name_String (Lib_File));
+ Full_Lib_File := Name_Find;
+ else
+ Full_Lib_File := Lib_File;
+ end if;
+ end if;
+
+ end if;
+
+ Lib_File_Attr := Unknown_Attributes;
+
+ -- Make sure we could successfully start
+ -- the Compilation.
if Process_Created then
if Pid = Invalid_Pid then
and Compilation_OK
and (Output_Is_Object or Do_Bind_Step);
- if Data.Full_Lib_File = No_File then
- -- Compute the expected location of the ALI file. This
- -- can be from several places:
- -- -i => in place mode. In such a case, Full_Lib_File
- -- has already been set above
- -- -D => if specified
- -- or defaults in current dir.
- --
- -- We could simply use a call similar to
- -- Osint.Full_Lib_File_Name (Lib_File)
- -- but that involves system calls and is thus slower.
-
- if Object_Directory_Path /= null then
- Name_Len := 0;
- Add_Str_To_Name_Buffer (Object_Directory_Path.all);
- Add_Str_To_Name_Buffer
- (Get_Name_String (Data.Lib_File));
- Data.Full_Lib_File := Name_Find;
- else
- Data.Full_Lib_File := Data.Lib_File;
- end if;
-
- -- Invalidate the cache for the attributes, since the
- -- file was just created.
-
- Data.Lib_File_Attr := Unknown_Attributes;
- end if;
-
Text := Read_Library_Info_From_Full
(Data.Full_Lib_File, Data.Lib_File_Attr'Access);
----------------------------
procedure Reset_File_Attributes (Attr : System.Address);
- pragma Import (C, Reset_File_Attributes, "reset_attributes");
+ pragma Import (C, Reset_File_Attributes, "__gnat_reset_attributes");
begin
Initialization : declare
Sizeof_File_Attributes : Integer;
pragma Import (C, Sizeof_File_Attributes,
- "size_of_file_attributes");
+ "__gnat_size_of_file_attributes");
begin
pragma Assert (Sizeof_File_Attributes <= File_Attributes_Size);
type File_Attributes is
array (1 .. File_Attributes_Size)
of System.Storage_Elements.Storage_Element;
+ for File_Attributes'Alignment use Standard'Maximum_Alignment;
Unknown_Attributes : constant File_Attributes := (others => 0);
-- Will be initialized properly at elaboration (for efficiency later on,
return Found_Node;
end if;
+ -- Actions in handled sequence of statements
+
+ when
+ N_Handled_Sequence_Of_Statements =>
+ if Find_SCIL_Node (Statements (P)) then
+ return Found_Node;
+ end if;
+
-- Conditions of while expression or elsif.
when N_Iteration_Scheme |
N_Function_Call |
N_Function_Specification |
N_Generic_Association |
- N_Handled_Sequence_Of_Statements |
N_Identifier |
N_In |
N_Index_Or_Discriminant_Constraint |