[multiple changes]

2016-04-21  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_ch5.adb: Minor reformatting.

2016-04-21  Eric Botcazou  <ebotcazou@adacore.com>

	* exp_ch2.adb (Expand_Current_Value): Make an appropriate
	character literal if the entity is of a character type.

2016-04-21  Arnaud Charlet  <charlet@adacore.com>

	* exp_aggr.adb (Backend_Processing_Possible): Return False
	when generating C and aggregate contains function calls.

2016-04-21  Tristan Gingold  <gingold@adacore.com>

	* krunch.adb (Krunch): Only partially krunch children of
	Interfaces that aren't known.

2016-04-21  Ed Schonberg  <schonberg@adacore.com>

	* sem_prag.adb (Make_Inline): Handle properly the instantiation
	of a generic subpprogram that carries an Inline aspect. Place
	inline info on the anonymous subprogram that is constructed in
	the wrapper package.
	(Analyze_Pragma, case Pure): Do not check placement if pragma
	appears within an instantiation, which can be nested at any level.
	* sem_ch12.adb (Analyze_Instance_And_Renamings): Do not copy Freeze
	node from anonymous subprogram to its visible renaming. The
	freeze node will be constructed if the subprogram carries
	delayed aspects.
	(Set_Global): Preserve dimension information if present (from
	code reading).

2016-04-21  Vasiliy Fofanov  <fofanov@adacore.com>

	* gnatlink.adb: Change wording of the warning message on
	problematic filenames to be more neutral. Add a new substring
	"patch" introduced on Windows 10.

From-SVN: r235313
This commit is contained in:
Arnaud Charlet 2016-04-21 10:50:36 +02:00
parent 08f52d9f84
commit 2d6aa71558
7 changed files with 135 additions and 31 deletions

View File

@ -1,3 +1,43 @@
2016-04-21 Hristian Kirtchev <kirtchev@adacore.com>
* sem_ch5.adb: Minor reformatting.
2016-04-21 Eric Botcazou <ebotcazou@adacore.com>
* exp_ch2.adb (Expand_Current_Value): Make an appropriate
character literal if the entity is of a character type.
2016-04-21 Arnaud Charlet <charlet@adacore.com>
* exp_aggr.adb (Backend_Processing_Possible): Return False
when generating C and aggregate contains function calls.
2016-04-21 Tristan Gingold <gingold@adacore.com>
* krunch.adb (Krunch): Only partially krunch children of
Interfaces that aren't known.
2016-04-21 Ed Schonberg <schonberg@adacore.com>
* sem_prag.adb (Make_Inline): Handle properly the instantiation
of a generic subpprogram that carries an Inline aspect. Place
inline info on the anonymous subprogram that is constructed in
the wrapper package.
(Analyze_Pragma, case Pure): Do not check placement if pragma
appears within an instantiation, which can be nested at any level.
* sem_ch12.adb (Analyze_Instance_And_Renamings): Do not copy Freeze
node from anonymous subprogram to its visible renaming. The
freeze node will be constructed if the subprogram carries
delayed aspects.
(Set_Global): Preserve dimension information if present (from
code reading).
2016-04-21 Vasiliy Fofanov <fofanov@adacore.com>
* gnatlink.adb: Change wording of the warning message on
problematic filenames to be more neutral. Add a new substring
"patch" introduced on Windows 10.
2016-04-21 Philippe Gil <gil@adacore.com>
* tracebak.c (__gnat_backtrace): handle bad RIP values (win64 only)

View File

@ -547,14 +547,16 @@ package body Exp_Aggr is
-- 11. When generating C code, N must be part of a N_Object_Declaration
-- 12. When generating C code, N must not include function calls
function Backend_Processing_Possible (N : Node_Id) return Boolean is
Typ : constant Entity_Id := Etype (N);
-- Typ is the correct constrained array subtype of the aggregate
function Component_Check (N : Node_Id; Index : Node_Id) return Boolean;
-- This routine checks components of aggregate N, enforcing checks
-- 1, 7, 8, and 9. In the multi-dimensional case, these checks are
-- performed on subaggregates. The Index value is the current index
-- 1, 7, 8, 9, 11 and 12. In the multi-dimensional case, these checks
-- are performed on subaggregates. The Index value is the current index
-- being checked in the multi-dimensional case.
---------------------
@ -573,7 +575,7 @@ package body Exp_Aggr is
-- Checks 11: (part of an object declaration)
if Generate_C_Code
if Modify_Tree_For_C
and then Nkind (Parent (N)) /= N_Object_Declaration
and then
(Nkind (Parent (N)) /= N_Qualified_Expression
@ -613,6 +615,12 @@ package body Exp_Aggr is
return False;
end if;
-- Checks 12: (no function call)
if Modify_Tree_For_C and then Nkind (Expr) = N_Function_Call then
return False;
end if;
-- Recursion to following indexes for multiple dimension case
if Present (Next_Index (Index))
@ -4106,7 +4114,7 @@ package body Exp_Aggr is
Analyze_And_Resolve (N, Typ);
end if;
-- Is Static_Eaboration_Desired has been specified, diagnose aggregates
-- If Static_Eaboration_Desired has been specified, diagnose aggregates
-- that will still require initialization code.
if (Ekind (Current_Scope) = E_Package

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1996-2015, Free Software Foundation, Inc. --
-- Copyright (C) 1996-2016, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@ -1680,10 +1680,10 @@ begin
-- Special warnings for worrisome file names on windows
-- Windows-7 will not allow an executable file whose name contains any
-- of the substrings "install", "setup", or "update" to load without
-- special administration privileges. This rather incredible behavior
-- is Microsoft's idea of a useful security precaution.
-- Recent versions of Windows by default cause privilege escalation if an
-- executable file name contains substrings "install", "setup", "update"
-- or "patch". A console application will typically fail to load as a
-- result, so we should warn the user.
Bad_File_Names_On_Windows : declare
FN : String := Output_File_Name.all;
@ -1696,13 +1696,10 @@ begin
for J in 1 .. FN'Length - (S'Length - 1) loop
if FN (J .. J + (S'Length - 1)) = S then
Error_Msg
("warning: possible problem with executable name """
& Output_File_Name.all & '"');
("warning: executable file name """ & Output_File_Name.all
& """ contains substring """ & S & '"');
Error_Msg
("file name contains substring """ & S & '"');
Error_Msg
("admin privileges may be required on Windows 7 "
& "to load this file");
("admin privileges may be required to run this file");
end if;
end loop;
end Check_File_Name;
@ -1723,6 +1720,7 @@ begin
Check_File_Name ("install");
Check_File_Name ("setup");
Check_File_Name ("update");
Check_File_Name ("patch");
end if;
end Bad_File_Names_On_Windows;

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2014, Free Software Foundation, Inc. --
-- Copyright (C) 1992-2016, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@ -95,7 +95,23 @@ begin
Startloc := 3;
Buffer (2 .. Len - 9) := Buffer (11 .. Len);
Curlen := Len - 9;
Krlen := 8;
-- Only fully krunch historical units. For new units, simply use
-- the 'i-' prefix instead of 'interfaces-'. Packages Interfaces.C
-- and Interfaces.Cobol are already in the right form. Package
-- Interfaces.Definitions is krunched for backward compatibility.
if (Curlen > 3 and then Buffer (3 .. 4) = "c-")
or else (Curlen > 3 and then Buffer (3 .. 4) = "c_")
or else (Curlen = 13 and then Buffer (3 .. 13) = "definitions")
or else (Curlen = 9 and then Buffer (3 .. 9) = "fortran")
or else (Curlen = 16 and then Buffer (3 .. 16) = "packed_decimal")
or else (Curlen > 9 and then Buffer (3 .. 9) = "vxworks")
then
Krlen := 8;
else
Krlen := Maxlen;
end if;
-- For the renamings in the obsolescent section, we also force krunching
-- to 8 characters, but no other special processing is required here.

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
-- Copyright (C) 1992-2016, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@ -4947,9 +4947,13 @@ package body Sem_Ch12 is
Set_Cunit_Entity (Current_Sem_Unit, Pack_Id);
end if;
-- The instance is not a freezing point for the new subprogram
-- The instance is not a freezing point for the new subprogram.
-- The anonymous subprogram may have a freeze node, created for
-- some delayed aspects. This freeze node must not be inherited
-- by the visible subprogram entity.
Set_Is_Frozen (Act_Decl_Id, False);
Set_Is_Frozen (Act_Decl_Id, False);
Set_Freeze_Node (Act_Decl_Id, Empty);
if Nkind (Defining_Entity (N)) = N_Defining_Operator_Symbol then
Valid_Operator_Definition (Act_Decl_Id);
@ -7690,6 +7694,18 @@ package body Sem_Ch12 is
end if;
end if;
-- Propagate dimensions if present, so that they are reflected in the
-- instance.
if Nkind (N) in N_Has_Etype
and then (Nkind (N) in N_Op or else Is_Entity_Name (N))
and then Present (Etype (N))
and then Is_Floating_Point_Type (Etype (N))
and then Has_Dimension_System (Etype (N))
then
Copy_Dimensions (N, New_N);
end if;
return New_N;
end Copy_Generic_Node;
@ -14140,6 +14156,13 @@ package body Sem_Ch12 is
Set_Etype (N2, Full_View (Typ));
end if;
end if;
if Is_Floating_Point_Type (Typ)
and then Has_Dimension_System (Typ)
then
Copy_Dimensions (N2, N);
end if;
end Set_Global_Type;
------------------

View File

@ -2201,9 +2201,11 @@ package body Sem_Ch5 is
Error_Msg_N ("variable container expected", N);
end if;
-- It could be a function, which
-- Is_Dependent_Component_Of_Mutable_Object doesn't like,
-- so check that it's a component.
-- Detect a case where the iterator denotes a component
-- of a mutable object which depends on a discriminant.
-- Note that the iterator may denote a function call in
-- qualified form, in which case this check should not
-- be performed.
if Nkind (Orig_Iter_Name) = N_Selected_Component
and then Ekind_In

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
-- Copyright (C) 1992-2016, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@ -8610,9 +8610,16 @@ package body Sem_Prag is
-- Processing for procedure, operator or function. If subprogram
-- is aliased (as for an instance) indicate that the renamed
-- entity (if declared in the same unit) is inlined.
-- If this is the anonymous subprogram created for a subprogram
-- instance, the inlining applies to it directly. Otherwise we
-- retrieve it as the alias of the visible subprogram instance.
if Is_Subprogram (Subp) then
Inner_Subp := Ultimate_Alias (Inner_Subp);
if Is_Wrapper_Package (Scope (Subp)) then
Inner_Subp := Subp;
else
Inner_Subp := Ultimate_Alias (Inner_Subp);
end if;
if In_Same_Source_Unit (Subp, Inner_Subp) then
Set_Inline_Flags (Inner_Subp);
@ -8624,18 +8631,20 @@ package body Sem_Prag is
then
Set_Inline_Flags (Corresponding_Body (Decl));
elsif Is_Generic_Instance (Subp) then
elsif Is_Generic_Instance (Subp)
and then Comes_From_Source (Subp)
then
-- Indicate that the body needs to be created for
-- inlining subsequent calls. The instantiation node
-- follows the declaration of the wrapper package
-- created for it.
-- created for it. The subprogram that requires the
-- body is the anonymous one in the wrapper package.
if Scope (Subp) /= Standard_Standard
and then
Need_Subprogram_Instance_Body
(Next (Unit_Declaration_Node (Scope (Alias (Subp)))),
Subp)
(Next (Unit_Declaration_Node
(Scope (Alias (Subp)))), Subp)
then
null;
end if;
@ -19397,7 +19406,15 @@ package body Sem_Prag is
begin
Check_Ada_83_Warning;
Check_Valid_Library_Unit_Pragma;
-- If the pragma comes from a subprogram instantiation, nothing to
-- check, this can happen at any level of nesting.
if Is_Wrapper_Package (Current_Scope) then
return;
else
Check_Valid_Library_Unit_Pragma;
end if;
if Nkind (N) = N_Null_Statement then
return;