aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2009-10-30 14:58:19 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2009-10-30 14:58:19 +0100
commit6528a7ede69259e73a6a560cec80d4278b89007e (patch)
treec558e86b253a79fb4eef0c8ec6e7c54be0810742 /gcc
parentcafdbd2e9d68402e124f8c345d2524f2b0bb0051 (diff)
downloadgcc-6528a7ede69259e73a6a560cec80d4278b89007e.zip
gcc-6528a7ede69259e73a6a560cec80d4278b89007e.tar.gz
gcc-6528a7ede69259e73a6a560cec80d4278b89007e.tar.bz2
[multiple changes]
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. From-SVN: r153749
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog22
-rw-r--r--gcc/ada/adaint.c26
-rw-r--r--gcc/ada/adaint.h2
-rw-r--r--gcc/ada/gnatlink.adb19
-rw-r--r--gcc/ada/link.c15
-rw-r--r--gcc/ada/make.adb102
-rw-r--r--gcc/ada/osint.adb4
-rw-r--r--gcc/ada/osint.ads1
-rw-r--r--gcc/ada/sem_scil.adb9
9 files changed, 133 insertions, 67 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index e81446a..8c1d75d 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,27 @@
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
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index e26f3ca..5bce387 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -325,7 +325,7 @@ const int __gnat_vmsp = 0;
#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);
@@ -378,7 +378,7 @@ to_ptr32 (char **ptr64)
#endif
void
-reset_attributes
+__gnat_reset_attributes
(struct file_attributes* attr)
{
attr->exists = -1;
@@ -1133,7 +1133,7 @@ long
__gnat_file_length (int fd)
{
struct file_attributes attr;
- reset_attributes (&attr);
+ __gnat_reset_attributes (&attr);
return __gnat_file_length_attr (fd, NULL, &attr);
}
@@ -1141,7 +1141,7 @@ long
__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);
}
@@ -1371,7 +1371,7 @@ OS_Time
__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);
}
@@ -1465,7 +1465,7 @@ OS_Time
__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);
}
@@ -1819,7 +1819,7 @@ int
__gnat_file_exists (char *name)
{
struct file_attributes attr;
- reset_attributes (&attr);
+ __gnat_reset_attributes (&attr);
return __gnat_file_exists_attr (name, &attr);
}
@@ -1876,7 +1876,7 @@ int
__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);
}
@@ -1894,7 +1894,7 @@ int
__gnat_is_directory (char *name)
{
struct file_attributes attr;
- reset_attributes (&attr);
+ __gnat_reset_attributes (&attr);
return __gnat_is_directory_attr (name, &attr);
}
@@ -2118,7 +2118,7 @@ int
__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);
}
@@ -2156,7 +2156,7 @@ int
__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);
}
@@ -2192,7 +2192,7 @@ int
__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);
}
@@ -2334,7 +2334,7 @@ int
__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);
}
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index fbdb4ff..76a181a 100644
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -155,7 +155,7 @@ extern int __gnat_is_writable_file (char *);
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 *);
diff --git a/gcc/ada/gnatlink.adb b/gcc/ada/gnatlink.adb
index eb255d9..5347269 100644
--- a/gcc/ada/gnatlink.adb
+++ b/gcc/ada/gnatlink.adb
@@ -189,6 +189,13 @@ procedure Gnatlink is
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)
@@ -2141,11 +2148,15 @@ begin
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;
diff --git a/gcc/ada/link.c b/gcc/ada/link.c
index c36d8e7..6ebd329 100644
--- a/gcc/ada/link.c
+++ b/gcc/ada/link.c
@@ -62,6 +62,9 @@
/* 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. */
@@ -89,6 +92,7 @@ const char *__gnat_run_path_option = "-Wl,-rpath,";
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;
@@ -99,6 +103,7 @@ const char *__gnat_run_path_option = "-Wl,-rpath,";
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;
@@ -109,6 +114,7 @@ const char *__gnat_run_path_option = "";
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;
@@ -119,6 +125,7 @@ const char *__gnat_run_path_option = "-Wl,+b,";
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;
@@ -129,6 +136,7 @@ const char *__gnat_run_path_option = "";
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;
@@ -137,6 +145,7 @@ 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;
@@ -147,6 +156,7 @@ unsigned char __gnat_separate_run_path_options = 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;
@@ -157,6 +167,7 @@ unsigned char __gnat_separate_run_path_options = 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;
@@ -167,6 +178,7 @@ unsigned char __gnat_separate_run_path_options = 0;
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;
@@ -177,6 +189,7 @@ unsigned char __gnat_separate_run_path_options = 1;
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;
@@ -187,6 +200,7 @@ 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;
@@ -200,6 +214,7 @@ unsigned char __gnat_separate_run_path_options = 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;
diff --git a/gcc/ada/make.adb b/gcc/ada/make.adb
index ee85764..12e6386 100644
--- a/gcc/ada/make.adb
+++ b/gcc/ada/make.adb
@@ -1866,7 +1866,8 @@ package body Make is
Normalize_Pathname
(Dir_Name
(Get_Name_String (Full_Lib_File)),
- Resolve_Links => True,
+ Resolve_Links =>
+ Opt.Follow_Links_For_Dirs,
Case_Sensitive => False);
begin
@@ -2561,7 +2562,7 @@ package body Make is
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,
@@ -2606,11 +2607,11 @@ package body Make is
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
@@ -3401,6 +3402,10 @@ package body Make is
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
@@ -3416,20 +3421,11 @@ package body Make is
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,
@@ -3438,7 +3434,49 @@ package body Make is
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
@@ -3501,34 +3539,6 @@ package body Make is
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);
diff --git a/gcc/ada/osint.adb b/gcc/ada/osint.adb
index 0c95ff1..1b1f508 100644
--- a/gcc/ada/osint.adb
+++ b/gcc/ada/osint.adb
@@ -3197,7 +3197,7 @@ package body Osint is
----------------------------
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
@@ -3216,7 +3216,7 @@ begin
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);
diff --git a/gcc/ada/osint.ads b/gcc/ada/osint.ads
index 741b28a..34b3f64 100644
--- a/gcc/ada/osint.ads
+++ b/gcc/ada/osint.ads
@@ -727,6 +727,7 @@ private
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,
diff --git a/gcc/ada/sem_scil.adb b/gcc/ada/sem_scil.adb
index f47d128..cd4e66b 100644
--- a/gcc/ada/sem_scil.adb
+++ b/gcc/ada/sem_scil.adb
@@ -285,6 +285,14 @@ package body Sem_SCIL is
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 |
@@ -505,7 +513,6 @@ package body Sem_SCIL is
N_Function_Call |
N_Function_Specification |
N_Generic_Association |
- N_Handled_Sequence_Of_Statements |
N_Identifier |
N_In |
N_Index_Or_Discriminant_Constraint |