sem_prag.adb (Analyze_Pragma, [...]): Extend error to every non-object and change error message.

2008-04-14  Robert Dewar  <dewar@adacore.com>

    gcc/ada/
	* sem_prag.adb (Analyze_Pragma, Linker_Section case): Extend error
	to every non-object and change error message.

    gcc/testsuite/
	* gnat.dg/specs/linker_section.ads: Check for more error conditions.

From-SVN: r134280
This commit is contained in:
Robert Dewar 2008-04-14 16:38:16 +00:00 committed by Samuel Tardieu
parent 96a791f748
commit 2efcad9f79
4 changed files with 16 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2008-04-14 Robert Dewar <dewar@adacore.com>
* sem_prag.adb (Analyze_Pragma, Linker_Section case): Extend error
to every non-object and change error message.
2008-04-14 Robert Dewar <dewar@adacore.com>
* sem_util.ads, sem_util.adb (In_Subprogram): Remove.

View File

@ -8450,10 +8450,10 @@ package body Sem_Prag is
Check_Arg_Is_Library_Level_Local_Name (Arg1);
Check_Arg_Is_Static_Expression (Arg2, Standard_String);
-- This pragma does not apply to types
-- This pragma applies only to objects
if Is_Type (Entity (Expression (Arg1))) then
Error_Pragma_Arg ("pragma% cannot apply to type", Arg1);
if not Is_Object (Entity (Expression (Arg1))) then
Error_Pragma_Arg ("pragma% applies only to objects", Arg1);
end if;
-- The only processing required is to link this item on to the

View File

@ -1,3 +1,7 @@
2008-04-14 Robert Dewar <dewar@adacore.com>
* gnat.dg/specs/linker_section.ads: Check for more error conditions.
2008-04-14 Samuel Tardieu <sam@rfc1149.net>
PR ada/18680

View File

@ -3,8 +3,11 @@ package Linker_Section is
pragma Linker_Section (Entity => Data1,
Section => ".eeprom");
type EEPROM_String is new String;
pragma Linker_Section (Entity => EEPROM_String, -- { dg-error "type" }
pragma Linker_Section (Entity => EEPROM_String, -- { dg-error "objects" }
Section => ".eeprom");
Data2 : constant EEPROM_String := "12345678901234567";
package Inner is end;
pragma Linker_Section (Entity => Inner, -- { dg-error "objects" }
Section => ".eeprom");
end Linker_Section;