re PR ada/18680 (pragma Linker_Section problems)
authorSamuel Tardieu <sam@rfc1149.net>
Mon, 14 Apr 2008 13:41:25 +0000 (13:41 +0000)
committerSamuel Tardieu <sam@gcc.gnu.org>
Mon, 14 Apr 2008 13:41:25 +0000 (13:41 +0000)
    gcc/ada/
PR ada/18680
* sem_prag.adb (Analyze_Pragma, Linker_Section case): Refuse to
apply pragma Linker_Section on type.

    gcc/testsuite/
PR ada/18680
* gnat.dg/specs/linker_section.ads: New.

From-SVN: r134266

gcc/ada/ChangeLog
gcc/ada/sem_prag.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/specs/linker_section.ads [new file with mode: 0644]

index cdfcdfe4f9fdd8c1e4d2c974dfc58fcad4141216..5d37a15830a11aa744f0b9bfa99aff53a2180c07 100644 (file)
@@ -1,3 +1,9 @@
+2008-04-14  Samuel Tardieu  <sam@rfc1149.net>
+
+       PR ada/18680
+       * sem_prag.adb (Analyze_Pragma, Linker_Section case): Refuse to
+       apply pragma Linker_Section on type.
+
 2008-04-14  Samuel Tardieu  <sam@rfc1149.net>
 
        PR ada/16098
index 8a9a2e91f1107116ff63dc62f5c42500c880293f..c238367ba835ab3f513f6811b004064f5356b191 100644 (file)
@@ -8450,6 +8450,12 @@ 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
+
+            if Is_Type (Entity (Expression (Arg1))) then
+               Error_Pragma_Arg ("pragma% cannot apply to type", Arg1);
+            end if;
+
             --  The only processing required is to link this item on to the
             --  list of rep items for the given entity. This is accomplished
             --  by the call to Rep_Item_Too_Late (when no error is detected
index 5bb51e82d8ce55f18fa77338759c9b6c6b66b887..8af67f7b0b75409313531151feac7fe6cf883cc0 100644 (file)
@@ -1,3 +1,8 @@
+2008-04-14  Samuel Tardieu  <sam@rfc1149.net>
+
+       PR ada/18680
+       * gnat.dg/specs/linker_section.ads: New.
+
 2008-04-14  Samuel Tardieu  <sam@rfc1149.net>
 
        PR ada/16098
diff --git a/gcc/testsuite/gnat.dg/specs/linker_section.ads b/gcc/testsuite/gnat.dg/specs/linker_section.ads
new file mode 100644 (file)
index 0000000..ae2d402
--- /dev/null
@@ -0,0 +1,10 @@
+package Linker_Section is
+   Data1 : constant String := "12345678901234567";
+   pragma Linker_Section (Entity  => Data1,
+                          Section => ".eeprom");
+   type EEPROM_String is new String;
+   pragma Linker_Section (Entity  => EEPROM_String, -- { dg-error "type" }
+                          Section => ".eeprom");
+   Data2 : constant EEPROM_String := "12345678901234567";
+end Linker_Section;
+