+2015-11-18 Thomas Quinot <quinot@adacore.com>
+
+ * s-os_lib.ads, s-os_lib.adb(Normalize_Pathname): Support the case of
+ an unresolved Directory argument, by recursively resolving it
+ against the current dir.
+
+2015-11-18 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch6.adb (Process_Formals): A function declaration that
+ returns a class-wide type must have freeing deferred, so that it
+ is not frozen before the class-wide type and its root type are
+ frozen. This is significant when there may be a limited view of
+ the class_wide type in another package.
+
2015-11-18 Hristian Kirtchev <kirtchev@adacore.com>
* einfo.adb (Has_Non_Null_Refinement): Rename to
-------------------
function Get_Directory (Dir : String) return String is
- Result : String (1 .. Dir'Length + 1);
- Length : constant Natural := Dir'Length;
-
begin
-- Directory given, add directory separator if needed
- if Length > 0 then
- Result (1 .. Length) := Dir;
+ if Dir'Length > 0 then
+ declare
+ Result : String :=
+ Normalize_Pathname (Dir, "") & Directory_Separator;
+ Last : Positive := Result'Last - 1;
- -- On Windows, change all '/' to '\'
+ begin
+ -- On Windows, change all '/' to '\'
+
+ if On_Windows then
+ for J in Result'First .. Last - 1 loop
+ if Result (J) = '/' then
+ Result (J) := Directory_Separator;
+ end if;
+ end loop;
+ end if;
- if On_Windows then
- for J in 1 .. Length loop
- if Result (J) = '/' then
- Result (J) := Directory_Separator;
- end if;
- end loop;
- end if;
+ -- Include additional directory separator, if needed
- -- Add directory separator, if needed
+ if Result (Last) /= Directory_Separator then
+ Last := Last + 1;
+ end if;
- if Result (Length) = Directory_Separator then
- return Result (1 .. Length);
- else
- Result (Result'Length) := Directory_Separator;
- return Result;
- end if;
+ return Result (Result'First .. Last);
+ end;
-- Directory name not given, get current directory
Resolve_Links : Boolean := True;
Case_Sensitive : Boolean := True) return String;
-- Returns a file name as an absolute path name, resolving all relative
- -- directories, and symbolic links. The parameter Directory is a fully
- -- resolved path name for a directory, or the empty string (the default).
- -- Name is the name of a file, which is either relative to the given
- -- directory name, if Directory is non-null, or to the current working
- -- directory if Directory is null. The result returned is the normalized
- -- name of the file. For most cases, if two file names designate the same
- -- file through different paths, Normalize_Pathname will return the same
- -- canonical name in both cases. However, there are cases when this is not
- -- true; for example, this is not true in Unix for two hard links
- -- designating the same file.
+ -- directories, and symbolic links. If Name is a relative path, it is
+ -- interpreted relative to Directory, or to the current directory if
+ -- Directory is the empty string (the default). The result returned is
+ -- the normalized name of the file, containing no "." or ".." components,
+ -- and no duplicated directory separators. For most cases, if two file
+ -- names designate the same file through different paths,
+ -- Normalize_Pathname will return the same canonical name in both cases.
+ -- However, there are cases when this is not true; for example, this is
+ -- not true in Unix for two hard links designating the same file.
--
- -- On Windows, the returned path will start with a drive letter except
- -- when Directory is not empty and does not include a drive letter. If
+ -- On Windows, the returned path will start with a drive letter. If
-- Directory is empty (the default) and Name is a relative path or an
-- absolute path without drive letter, the letter of the current drive
-- will start the returned path. If Case_Sensitive is True (the default),
if Nkind (Related_Nod) = N_Function_Specification then
Analyze_Return_Type (Related_Nod);
+
+ -- If return type is class-wide, subprogram freezing may be
+ -- delayed as well.
+
+ if Is_Class_Wide_Type (Etype (Current_Scope))
+ and then not Is_Thunk (Current_Scope)
+ and then Nkind (Unit_Declaration_Node (Current_Scope)) =
+ N_Subprogram_Declaration
+ then
+ Set_Has_Delayed_Freeze (Current_Scope);
+ end if;
end if;
-- Now set the kind (mode) of each formal