Commit 2efcad9f by Robert Dewar Committed by Samuel Tardieu

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
parent 96a791f7
2008-04-14 Robert Dewar <dewar@adacore.com> 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. * sem_util.ads, sem_util.adb (In_Subprogram): Remove.
* sem_attr.adb (Anayze_Attribute): Check for Current_Subprogram * sem_attr.adb (Anayze_Attribute): Check for Current_Subprogram
directly. directly.
...@@ -8450,10 +8450,10 @@ package body Sem_Prag is ...@@ -8450,10 +8450,10 @@ package body Sem_Prag is
Check_Arg_Is_Library_Level_Local_Name (Arg1); Check_Arg_Is_Library_Level_Local_Name (Arg1);
Check_Arg_Is_Static_Expression (Arg2, Standard_String); 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 if not Is_Object (Entity (Expression (Arg1))) then
Error_Pragma_Arg ("pragma% cannot apply to type", Arg1); Error_Pragma_Arg ("pragma% applies only to objects", Arg1);
end if; end if;
-- The only processing required is to link this item on to the -- The only processing required is to link this item on to the
......
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> 2008-04-14 Samuel Tardieu <sam@rfc1149.net>
PR ada/18680 PR ada/18680
...@@ -3,8 +3,11 @@ package Linker_Section is ...@@ -3,8 +3,11 @@ package Linker_Section is
pragma Linker_Section (Entity => Data1, pragma Linker_Section (Entity => Data1,
Section => ".eeprom"); Section => ".eeprom");
type EEPROM_String is new String; 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"); Section => ".eeprom");
Data2 : constant EEPROM_String := "12345678901234567"; Data2 : constant EEPROM_String := "12345678901234567";
package Inner is end;
pragma Linker_Section (Entity => Inner, -- { dg-error "objects" }
Section => ".eeprom");
end Linker_Section; end Linker_Section;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment