OSDN Git Service

2007-08-31 Hristian Kirtchev <kirtchev@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / exp_prag.adb
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                             E X P _ P R A G                              --
6 --                                                                          --
7 --                                 B o d y                                  --
8 --                                                                          --
9 --          Copyright (C) 1992-2007, Free Software Foundation, Inc.         --
10 --                                                                          --
11 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
12 -- terms of the  GNU General Public License as published  by the Free Soft- --
13 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
14 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
17 -- for  more details.  You should have  received  a copy of the GNU General --
18 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
19 -- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
20 -- Boston, MA 02110-1301, USA.                                              --
21 --                                                                          --
22 -- GNAT was originally developed  by the GNAT team at  New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
24 --                                                                          --
25 ------------------------------------------------------------------------------
26
27 with Atree;    use Atree;
28 with Casing;   use Casing;
29 with Debug;    use Debug;
30 with Einfo;    use Einfo;
31 with Errout;   use Errout;
32 with Exp_Ch11; use Exp_Ch11;
33 with Exp_Tss;  use Exp_Tss;
34 with Exp_Util; use Exp_Util;
35 with Expander; use Expander;
36 with Namet;    use Namet;
37 with Nlists;   use Nlists;
38 with Nmake;    use Nmake;
39 with Opt;      use Opt;
40 with Restrict; use Restrict;
41 with Rident;   use Rident;
42 with Rtsfind;  use Rtsfind;
43 with Sem;      use Sem;
44 with Sem_Eval; use Sem_Eval;
45 with Sem_Res;  use Sem_Res;
46 with Sem_Util; use Sem_Util;
47 with Sinfo;    use Sinfo;
48 with Sinput;   use Sinput;
49 with Snames;   use Snames;
50 with Stringt;  use Stringt;
51 with Stand;    use Stand;
52 with Targparm; use Targparm;
53 with Tbuild;   use Tbuild;
54 with Uintp;    use Uintp;
55
56 package body Exp_Prag is
57
58    -----------------------
59    -- Local Subprograms --
60    -----------------------
61
62    function Arg1 (N : Node_Id) return Node_Id;
63    function Arg2 (N : Node_Id) return Node_Id;
64    --  Obtain specified pragma argument expression
65
66    procedure Expand_Pragma_Abort_Defer             (N : Node_Id);
67    procedure Expand_Pragma_Assert                  (N : Node_Id);
68    procedure Expand_Pragma_Common_Object           (N : Node_Id);
69    procedure Expand_Pragma_Import_Or_Interface     (N : Node_Id);
70    procedure Expand_Pragma_Import_Export_Exception (N : Node_Id);
71    procedure Expand_Pragma_Inspection_Point        (N : Node_Id);
72    procedure Expand_Pragma_Interrupt_Priority      (N : Node_Id);
73    procedure Expand_Pragma_Psect_Object            (N : Node_Id);
74
75    ----------
76    -- Arg1 --
77    ----------
78
79    function Arg1 (N : Node_Id) return Node_Id is
80       Arg : constant Node_Id := First (Pragma_Argument_Associations (N));
81    begin
82       if Present (Arg)
83         and then Nkind (Arg) = N_Pragma_Argument_Association
84       then
85          return Expression (Arg);
86       else
87          return Arg;
88       end if;
89    end Arg1;
90
91    ----------
92    -- Arg2 --
93    ----------
94
95    function Arg2 (N : Node_Id) return Node_Id is
96       Arg1 : constant Node_Id := First (Pragma_Argument_Associations (N));
97    begin
98       if No (Arg1) then
99          return Empty;
100       else
101          declare
102             Arg : constant Node_Id := Next (Arg1);
103          begin
104             if Present (Arg)
105               and then Nkind (Arg) = N_Pragma_Argument_Association
106             then
107                return Expression (Arg);
108             else
109                return Arg;
110             end if;
111          end;
112       end if;
113    end Arg2;
114
115    ---------------------
116    -- Expand_N_Pragma --
117    ---------------------
118
119    procedure Expand_N_Pragma (N : Node_Id) is
120    begin
121       --  Note: we may have a pragma whose chars field is not a
122       --  recognized pragma, and we must ignore it at this stage.
123
124       if Is_Pragma_Name (Chars (N)) then
125          case Get_Pragma_Id (Chars (N)) is
126
127             --  Pragmas requiring special expander action
128
129             when Pragma_Abort_Defer =>
130                Expand_Pragma_Abort_Defer (N);
131
132             when Pragma_Assert =>
133                Expand_Pragma_Assert (N);
134
135             when Pragma_Common_Object =>
136                Expand_Pragma_Common_Object (N);
137
138             when Pragma_Export_Exception =>
139                Expand_Pragma_Import_Export_Exception (N);
140
141             when Pragma_Import =>
142                Expand_Pragma_Import_Or_Interface (N);
143
144             when Pragma_Import_Exception =>
145                Expand_Pragma_Import_Export_Exception (N);
146
147             when Pragma_Inspection_Point =>
148                Expand_Pragma_Inspection_Point (N);
149
150             when Pragma_Interface =>
151                Expand_Pragma_Import_Or_Interface (N);
152
153             when Pragma_Interrupt_Priority =>
154                Expand_Pragma_Interrupt_Priority (N);
155
156             when Pragma_Psect_Object =>
157                Expand_Pragma_Psect_Object (N);
158
159             --  All other pragmas need no expander action
160
161             when others => null;
162          end case;
163       end if;
164
165    end Expand_N_Pragma;
166
167    -------------------------------
168    -- Expand_Pragma_Abort_Defer --
169    -------------------------------
170
171    --  An Abort_Defer pragma appears as the first statement in a handled
172    --  statement sequence (right after the begin). It defers aborts for
173    --  the entire statement sequence, but not for any declarations or
174    --  handlers (if any) associated with this statement sequence.
175
176    --  The transformation is to transform
177
178    --    pragma Abort_Defer;
179    --    statements;
180
181    --  into
182
183    --    begin
184    --       Abort_Defer.all;
185    --       statements
186    --    exception
187    --       when all others =>
188    --          Abort_Undefer.all;
189    --          raise;
190    --    at end
191    --       Abort_Undefer_Direct;
192    --    end;
193
194    procedure Expand_Pragma_Abort_Defer (N : Node_Id) is
195       Loc  : constant Source_Ptr := Sloc (N);
196       Stm  : Node_Id;
197       Stms : List_Id;
198       HSS  : Node_Id;
199       Blk  : constant Entity_Id :=
200         New_Internal_Entity (E_Block, Current_Scope, Sloc (N), 'B');
201
202    begin
203       Stms := New_List (Build_Runtime_Call (Loc, RE_Abort_Defer));
204
205       loop
206          Stm := Remove_Next (N);
207          exit when No (Stm);
208          Append (Stm, Stms);
209       end loop;
210
211       HSS :=
212         Make_Handled_Sequence_Of_Statements (Loc,
213           Statements => Stms,
214           At_End_Proc =>
215             New_Occurrence_Of (RTE (RE_Abort_Undefer_Direct), Loc));
216
217       Rewrite (N,
218         Make_Block_Statement (Loc,
219           Handled_Statement_Sequence => HSS));
220
221       Set_Scope (Blk, Current_Scope);
222       Set_Etype (Blk, Standard_Void_Type);
223       Set_Identifier (N, New_Occurrence_Of (Blk, Sloc (N)));
224       Expand_At_End_Handler (HSS, Blk);
225       Analyze (N);
226    end Expand_Pragma_Abort_Defer;
227
228    --------------------------
229    -- Expand_Pragma_Assert --
230    --------------------------
231
232    procedure Expand_Pragma_Assert (N : Node_Id) is
233       Loc  : constant Source_Ptr := Sloc (N);
234       Cond : constant Node_Id    := Arg1 (N);
235       Msg  : String_Id;
236
237    begin
238       --  We already know that assertions are enabled, because otherwise
239       --  the semantic pass dealt with rewriting the assertion (see Sem_Prag)
240
241       pragma Assert (Assertions_Enabled);
242
243       --  Since assertions are on, we rewrite the pragma with its
244       --  corresponding if statement, and then analyze the statement
245       --  The normal case expansion transforms:
246
247       --    pragma Assert (condition [,message]);
248
249       --  into
250
251       --    if not condition then
252       --       System.Assertions.Raise_Assert_Failure (Str);
253       --    end if;
254
255       --  where Str is the message if one is present, or the default of
256       --  file:line if no message is given.
257
258       --  An alternative expansion is used when the No_Exception_Propagation
259       --  restriction is active and there is a local Assert_Failure handler.
260       --  This is not a common combination of circumstances, but it occurs in
261       --  the context of Aunit and the zero footprint profile. In this case we
262       --  generate:
263
264       --    if not condition then
265       --       raise Assert_Failure;
266       --    end if;
267
268       --  This will then be transformed into a goto, and the local handler will
269       --  be able to handle the assert error (which would not be the case if a
270       --  call is made to the Raise_Assert_Failure procedure).
271
272       --  Note that the reason we do not always generate a direct raise is that
273       --  the form in which the procedure is called allows for more efficient
274       --  breakpointing of assertion errors.
275
276       --  Generate the appropriate if statement. Note that we consider this to
277       --  be an explicit conditional in the source, not an implicit if, so we
278       --  do not call Make_Implicit_If_Statement.
279
280       --  Case where we generate a direct raise
281
282       if (Debug_Flag_Dot_G
283           or else Restriction_Active (No_Exception_Propagation))
284         and then Present (Find_Local_Handler (RTE (RE_Assert_Failure), N))
285       then
286          Rewrite (N,
287            Make_If_Statement (Loc,
288              Condition =>
289                Make_Op_Not (Loc,
290                  Right_Opnd => Cond),
291              Then_Statements => New_List (
292                Make_Raise_Statement (Loc,
293                  Name =>
294                    New_Reference_To (RTE (RE_Assert_Failure), Loc)))));
295
296       --  Case where we call the procedure
297
298       else
299          --  First, we need to prepare the string literal
300
301          if Present (Arg2 (N)) then
302             Msg := Strval (Expr_Value_S (Arg2 (N)));
303          else
304             Build_Location_String (Loc);
305             Msg := String_From_Name_Buffer;
306          end if;
307
308          --  Now rewrite as an if statement
309
310          Rewrite (N,
311            Make_If_Statement (Loc,
312              Condition =>
313                Make_Op_Not (Loc,
314                  Right_Opnd => Cond),
315              Then_Statements => New_List (
316                Make_Procedure_Call_Statement (Loc,
317                  Name =>
318                    New_Reference_To (RTE (RE_Raise_Assert_Failure), Loc),
319                  Parameter_Associations => New_List (
320                    Make_String_Literal (Loc, Msg))))));
321       end if;
322
323       Analyze (N);
324
325       --  If new condition is always false, give a warning
326
327       if Nkind (N) = N_Procedure_Call_Statement
328         and then Is_RTE (Entity (Name (N)), RE_Raise_Assert_Failure)
329       then
330          --  If original condition was a Standard.False, we assume that this is
331          --  indeed intented to raise assert error and no warning is required.
332
333          if Is_Entity_Name (Original_Node (Cond))
334            and then Entity (Original_Node (Cond)) = Standard_False
335          then
336             return;
337          else
338             Error_Msg_N ("?assertion will fail at run-time", N);
339          end if;
340       end if;
341    end Expand_Pragma_Assert;
342
343    ---------------------------------
344    -- Expand_Pragma_Common_Object --
345    ---------------------------------
346
347    --  Use a machine attribute to replicate semantic effect in DEC Ada
348
349    --    pragma Machine_Attribute (intern_name, "common_object", extern_name);
350
351    --  For now we do nothing with the size attribute ???
352
353    procedure Expand_Pragma_Common_Object (N : Node_Id) is
354       Loc : constant Source_Ptr := Sloc (N);
355
356       Internal : constant Node_Id := Arg1 (N);
357       External : constant Node_Id := Arg2 (N);
358
359       Psect : Node_Id;
360       --  Psect value upper cased as string literal
361
362       Iloc : constant Source_Ptr := Sloc (Internal);
363       Eloc : constant Source_Ptr := Sloc (External);
364       Ploc : Source_Ptr;
365
366    begin
367       --  Acquire Psect value and fold to upper case
368
369       if Present (External) then
370          if Nkind (External) = N_String_Literal then
371             String_To_Name_Buffer (Strval (External));
372          else
373             Get_Name_String (Chars (External));
374          end if;
375
376          Set_All_Upper_Case;
377
378          Psect :=
379            Make_String_Literal (Eloc,
380              Strval => String_From_Name_Buffer);
381
382       else
383          Get_Name_String (Chars (Internal));
384          Set_All_Upper_Case;
385          Psect :=
386            Make_String_Literal (Iloc,
387              Strval => String_From_Name_Buffer);
388       end if;
389
390       Ploc := Sloc (Psect);
391
392       --  Insert the pragma
393
394       Insert_After_And_Analyze (N,
395
396          Make_Pragma (Loc,
397            Chars => Name_Machine_Attribute,
398            Pragma_Argument_Associations => New_List (
399              Make_Pragma_Argument_Association (Iloc,
400                Expression => New_Copy_Tree (Internal)),
401              Make_Pragma_Argument_Association (Eloc,
402                Expression =>
403                  Make_String_Literal (Sloc => Ploc,
404                    Strval => "common_object")),
405              Make_Pragma_Argument_Association (Ploc,
406                Expression => New_Copy_Tree (Psect)))));
407
408    end Expand_Pragma_Common_Object;
409
410    ---------------------------------------
411    -- Expand_Pragma_Import_Or_Interface --
412    ---------------------------------------
413
414    --  When applied to a variable, the default initialization must not be
415    --  done. As it is already done when the pragma is found, we just get rid
416    --  of the call the initialization procedure which followed the object
417    --  declaration. The call is inserted after the declaration, but validity
418    --  checks may also have been inserted and the initialization call does
419    --  not necessarily appear immediately after the object declaration.
420
421    --  We can't use the freezing mechanism for this purpose, since we
422    --  have to elaborate the initialization expression when it is first
423    --  seen (i.e. this elaboration cannot be deferred to the freeze point).
424
425    procedure Expand_Pragma_Import_Or_Interface (N : Node_Id) is
426       Def_Id    : constant Entity_Id := Entity (Arg2 (N));
427       Typ       : Entity_Id;
428       Init_Call : Node_Id;
429
430    begin
431       if Ekind (Def_Id) = E_Variable then
432          Typ  := Etype (Def_Id);
433
434          --  Iterate from declaration of object to import pragma, to find
435          --  generated initialization call for object, if any.
436
437          Init_Call := Next (Parent (Def_Id));
438          while Present (Init_Call) and then Init_Call /= N loop
439             if Has_Non_Null_Base_Init_Proc (Typ)
440               and then Nkind (Init_Call) = N_Procedure_Call_Statement
441               and then Is_Entity_Name (Name (Init_Call))
442               and then Entity (Name (Init_Call)) = Base_Init_Proc (Typ)
443             then
444                Remove (Init_Call);
445                exit;
446             else
447                Next (Init_Call);
448             end if;
449          end loop;
450
451          --  Any default initialization expression should be removed
452          --  (e.g., null defaults for access objects, zero initialization
453          --  of packed bit arrays). Imported objects aren't allowed to
454          --  have explicit initialization, so the expression must have
455          --  been generated by the compiler.
456
457          if Init_Call = N
458            and then Present (Expression (Parent (Def_Id)))
459          then
460             Set_Expression (Parent (Def_Id), Empty);
461          end if;
462       end if;
463    end Expand_Pragma_Import_Or_Interface;
464
465    -------------------------------------------
466    -- Expand_Pragma_Import_Export_Exception --
467    -------------------------------------------
468
469    --  For a VMS exception fix up the language field with "VMS"
470    --  instead of "Ada" (gigi needs this), create a constant that will be the
471    --  value of the VMS condition code and stuff the Interface_Name field
472    --  with the unexpanded name of the exception (if not already set).
473    --  For a Ada exception, just stuff the Interface_Name field
474    --  with the unexpanded name of the exception (if not already set).
475
476    procedure Expand_Pragma_Import_Export_Exception (N : Node_Id) is
477    begin
478       --  This pragma is only effective on OpenVMS systems, it was ignored
479       --  on non-VMS systems, and we need to ignore it here as well.
480
481       if not OpenVMS_On_Target then
482          return;
483       end if;
484
485       declare
486          Id     : constant Entity_Id := Entity (Arg1 (N));
487          Call   : constant Node_Id := Register_Exception_Call (Id);
488          Loc    : constant Source_Ptr := Sloc (N);
489
490       begin
491          if Present (Call) then
492             declare
493                Excep_Internal : constant Node_Id :=
494                                  Make_Defining_Identifier
495                                   (Loc, New_Internal_Name ('V'));
496                Export_Pragma  : Node_Id;
497                Excep_Alias    : Node_Id;
498                Excep_Object   : Node_Id;
499                Excep_Image : String_Id;
500                Exdata      : List_Id;
501                Lang1       : Node_Id;
502                Lang2       : Node_Id;
503                Lang3       : Node_Id;
504                Code        : Node_Id;
505
506             begin
507                if Present (Interface_Name (Id)) then
508                   Excep_Image := Strval (Interface_Name (Id));
509                else
510                   Get_Name_String (Chars (Id));
511                   Set_All_Upper_Case;
512                   Excep_Image := String_From_Name_Buffer;
513                end if;
514
515                Exdata := Component_Associations (Expression (Parent (Id)));
516
517                if Is_VMS_Exception (Id) then
518                   Lang1 := Next (First (Exdata));
519                   Lang2 := Next (Lang1);
520                   Lang3 := Next (Lang2);
521
522                   Rewrite (Expression (Lang1),
523                     Make_Character_Literal (Loc,
524                       Chars => Name_uV,
525                       Char_Literal_Value =>
526                         UI_From_Int (Character'Pos ('V'))));
527                   Analyze (Expression (Lang1));
528
529                   Rewrite (Expression (Lang2),
530                     Make_Character_Literal (Loc,
531                       Chars => Name_uM,
532                       Char_Literal_Value =>
533                         UI_From_Int (Character'Pos ('M'))));
534                   Analyze (Expression (Lang2));
535
536                   Rewrite (Expression (Lang3),
537                     Make_Character_Literal (Loc,
538                       Chars => Name_uS,
539                       Char_Literal_Value =>
540                         UI_From_Int (Character'Pos ('S'))));
541                   Analyze (Expression (Lang3));
542
543                   if Exception_Code (Id) /= No_Uint then
544                      Code :=
545                        Make_Integer_Literal (Loc,
546                          Intval => Exception_Code (Id));
547
548                      Excep_Object :=
549                        Make_Object_Declaration (Loc,
550                          Defining_Identifier => Excep_Internal,
551                          Object_Definition   =>
552                            New_Reference_To (RTE (RE_Exception_Code), Loc));
553
554                      Insert_Action (N, Excep_Object);
555                      Analyze (Excep_Object);
556
557                      Start_String;
558                      Store_String_Int
559                        (UI_To_Int (Exception_Code (Id)) / 8 * 8);
560
561                      Excep_Alias :=
562                        Make_Pragma
563                          (Loc,
564                           Name_Linker_Alias,
565                           New_List
566                             (Make_Pragma_Argument_Association
567                                (Sloc => Loc,
568                                 Expression =>
569                                   New_Reference_To (Excep_Internal, Loc)),
570
571                              Make_Pragma_Argument_Association
572                                (Sloc => Loc,
573                                 Expression =>
574                                   Make_String_Literal
575                                     (Sloc => Loc,
576                                      Strval => End_String))));
577
578                      Insert_Action (N, Excep_Alias);
579                      Analyze (Excep_Alias);
580
581                      Export_Pragma :=
582                        Make_Pragma
583                          (Loc,
584                           Name_Export,
585                           New_List
586                             (Make_Pragma_Argument_Association
587                                (Sloc => Loc,
588                                 Expression => Make_Identifier (Loc, Name_C)),
589
590                              Make_Pragma_Argument_Association
591                                (Sloc => Loc,
592                                 Expression =>
593                                   New_Reference_To (Excep_Internal, Loc)),
594
595                              Make_Pragma_Argument_Association
596                                (Sloc => Loc,
597                                 Expression =>
598                                   Make_String_Literal
599                                     (Sloc => Loc,
600                                      Strval => Excep_Image)),
601
602                              Make_Pragma_Argument_Association
603                                (Sloc => Loc,
604                                 Expression =>
605                                   Make_String_Literal
606                                     (Sloc => Loc,
607                                      Strval => Excep_Image))));
608
609                      Insert_Action (N, Export_Pragma);
610                      Analyze (Export_Pragma);
611
612                   else
613                      Code :=
614                         Unchecked_Convert_To (RTE (RE_Exception_Code),
615                           Make_Function_Call (Loc,
616                             Name =>
617                               New_Reference_To (RTE (RE_Import_Value), Loc),
618                             Parameter_Associations => New_List
619                               (Make_String_Literal (Loc,
620                                 Strval => Excep_Image))));
621                   end if;
622
623                   Rewrite (Call,
624                     Make_Procedure_Call_Statement (Loc,
625                       Name => New_Reference_To
626                                 (RTE (RE_Register_VMS_Exception), Loc),
627                       Parameter_Associations => New_List (
628                         Code,
629                         Unchecked_Convert_To (RTE (RE_Exception_Data_Ptr),
630                           Make_Attribute_Reference (Loc,
631                             Prefix         => New_Occurrence_Of (Id, Loc),
632                             Attribute_Name => Name_Unrestricted_Access)))));
633
634                   Analyze_And_Resolve (Code, RTE (RE_Exception_Code));
635                   Analyze (Call);
636                end if;
637
638                if No (Interface_Name (Id)) then
639                   Set_Interface_Name (Id,
640                      Make_String_Literal
641                        (Sloc => Loc,
642                         Strval => Excep_Image));
643                end if;
644             end;
645          end if;
646       end;
647    end Expand_Pragma_Import_Export_Exception;
648
649    ------------------------------------
650    -- Expand_Pragma_Inspection_Point --
651    ------------------------------------
652
653    --  If no argument is given, then we supply a default argument list that
654    --  includes all objects declared at the source level in all subprograms
655    --  that enclose the inspection point pragma.
656
657    procedure Expand_Pragma_Inspection_Point (N : Node_Id) is
658       Loc : constant Source_Ptr := Sloc (N);
659       A     : List_Id;
660       Assoc : Node_Id;
661       S     : Entity_Id;
662       E     : Entity_Id;
663
664    begin
665       if No (Pragma_Argument_Associations (N)) then
666          A := New_List;
667          S := Current_Scope;
668
669          while S /= Standard_Standard loop
670             E := First_Entity (S);
671             while Present (E) loop
672                if Comes_From_Source (E)
673                  and then Is_Object (E)
674                  and then not Is_Entry_Formal (E)
675                  and then Ekind (E) /= E_Component
676                  and then Ekind (E) /= E_Discriminant
677                  and then Ekind (E) /= E_Generic_In_Parameter
678                  and then Ekind (E) /= E_Generic_In_Out_Parameter
679                then
680                   Append_To (A,
681                     Make_Pragma_Argument_Association (Loc,
682                       Expression => New_Occurrence_Of (E, Loc)));
683                end if;
684
685                Next_Entity (E);
686             end loop;
687
688             S := Scope (S);
689          end loop;
690
691          Set_Pragma_Argument_Associations (N, A);
692       end if;
693
694       --  Expand the arguments of the pragma. Expanding an entity reference
695       --  is a noop, except in a protected operation, where a reference may
696       --  have to be transformed into a reference to the corresponding prival.
697       --  Are there other pragmas that may require this ???
698
699       Assoc := First (Pragma_Argument_Associations (N));
700
701       while Present (Assoc) loop
702          Expand (Expression (Assoc));
703          Next (Assoc);
704       end loop;
705    end Expand_Pragma_Inspection_Point;
706
707    --------------------------------------
708    -- Expand_Pragma_Interrupt_Priority --
709    --------------------------------------
710
711    --  Supply default argument if none exists (System.Interrupt_Priority'Last)
712
713    procedure Expand_Pragma_Interrupt_Priority (N : Node_Id) is
714       Loc : constant Source_Ptr := Sloc (N);
715
716    begin
717       if No (Pragma_Argument_Associations (N)) then
718          Set_Pragma_Argument_Associations (N, New_List (
719            Make_Pragma_Argument_Association (Loc,
720              Expression =>
721                Make_Attribute_Reference (Loc,
722                  Prefix =>
723                    New_Occurrence_Of (RTE (RE_Interrupt_Priority), Loc),
724                  Attribute_Name => Name_Last))));
725       end if;
726    end Expand_Pragma_Interrupt_Priority;
727
728    --------------------------------
729    -- Expand_Pragma_Psect_Object --
730    --------------------------------
731
732    --  Convert to Common_Object, and expand the resulting pragma
733
734    procedure Expand_Pragma_Psect_Object (N : Node_Id) is
735    begin
736       Set_Chars (N, Name_Common_Object);
737       Expand_Pragma_Common_Object (N);
738    end Expand_Pragma_Psect_Object;
739
740 end Exp_Prag;