From 2efcad9f79ca7e4708a3f029b88e83b15eaa0727 Mon Sep 17 00:00:00 2001 From: Robert Dewar Date: Mon, 14 Apr 2008 16:38:16 +0000 Subject: [PATCH] sem_prag.adb (Analyze_Pragma, [...]): Extend error to every non-object and change error message. 2008-04-14 Robert Dewar 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 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/sem_prag.adb | 6 +++--- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gnat.dg/specs/linker_section.ads | 5 ++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 199fe294a83..fe278db8a5a 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2008-04-14 Robert Dewar + + * sem_prag.adb (Analyze_Pragma, Linker_Section case): Extend error + to every non-object and change error message. + 2008-04-14 Robert Dewar * sem_util.ads, sem_util.adb (In_Subprogram): Remove. diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index c238367ba83..6b819803705 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8af67f7b0b7..5bf5cab06dc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2008-04-14 Robert Dewar + + * gnat.dg/specs/linker_section.ads: Check for more error conditions. + 2008-04-14 Samuel Tardieu PR ada/18680 diff --git a/gcc/testsuite/gnat.dg/specs/linker_section.ads b/gcc/testsuite/gnat.dg/specs/linker_section.ads index ae2d4029cf9..73e89aa48e1 100644 --- a/gcc/testsuite/gnat.dg/specs/linker_section.ads +++ b/gcc/testsuite/gnat.dg/specs/linker_section.ads @@ -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; -- 2.30.2