This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] ada/18680: Refuse to apply pragma Linker_Section to types


Arnaud Charlet wrote:
    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.

This patch is OK, thanks.


Arno

actually, looking at this more closely, although the patch is fine as it stands, it may as well go further and check for other cases, e.g. packages, so I suggest changing this to:

-- This pragma applies only to objects

            if not Is_Object (Entity (Expression (Arg1))) then
               Error_Pragma_Arg ("pragma% applies only to objects", Arg1);
            end if;

and use the following test program:


Compiling: linker_section.ads

     1. package Linker_Section is
     2.    Data1 : constant String := "12345678901234567";
     3.    pragma Linker_Section (Entity  => Data1,
     4.                           Section => ".eeprom");
     5.    type EEPROM_String is new String;
     6.    pragma Linker_Section (Entity  => EEPROM_String,
                                             |
        >>> pragma "Linker_Section" applies only to objects

     7.                           Section => ".eeprom");
     8.    Data2 : constant EEPROM_String := "12345678901234567";
     9.    package Inner is end;
    10.    pragma Linker_Section (Entity => Inner,
                                            |
        >>> pragma "Linker_Section" applies only to objects

    11.                           Section => ".eeprom");
    12. end Linker_Section;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]