OSDN Git Service

2007-12-06 Robert Dewar <dewar@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 3,  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 COPYING3.  If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license.          --
20 --                                                                          --
21 -- GNAT was originally developed  by the GNAT team at  New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
23 --                                                                          --
24 ------------------------------------------------------------------------------
25
26 with Atree;    use Atree;
27 with Casing;   use Casing;
28 with Debug;    use Debug;
29 with Einfo;    use Einfo;
30 with Errout;   use Errout;
31 with Exp_Ch11; use Exp_Ch11;
32 with Exp_Tss;  use Exp_Tss;
33 with Exp_Util; use Exp_Util;
34 with Expander; use Expander;
35 with Namet;    use Namet;
36 with Nlists;   use Nlists;
37 with Nmake;    use Nmake;
38 with Opt;      use Opt;
39 with Restrict; use Restrict;
40 with Rident;   use Rident;
41 with Rtsfind;  use Rtsfind;
42 with Sem;      use Sem;
43 with Sem_Eval; use Sem_Eval;
44 with Sem_Res;  use Sem_Res;
45 with Sem_Util; use Sem_Util;
46 with Sinfo;    use Sinfo;
47 with Sinput;   use Sinput;
48 with Snames;   use Snames;
49 with Stringt;  use Stringt;
50 with Stand;    use Stand;
51 with Targparm; use Targparm;
52 with Tbuild;   use Tbuild;
53 with Uintp;    use Uintp;
54
55 package body Exp_Prag is
56
57    -----------------------
58    -- Local Subprograms --
59    -----------------------
60
61    function Arg1 (N : Node_Id) return Node_Id;
62    function Arg2 (N : Node_Id) return Node_Id;
63    --  Obtain specified pragma argument expression
64
65    procedure Expand_Pragma_Abort_Defer             (N : Node_Id);
66    procedure Expand_Pragma_Assert                  (N : Node_Id);
67    procedure Expand_Pragma_Common_Object           (N : Node_Id);
68    procedure Expand_Pragma_Import_Or_Interface     (N : Node_Id);
69    procedure Expand_Pragma_Import_Export_Exception (N : Node_Id);
70    procedure Expand_Pragma_Inspection_Point        (N : Node_Id);
71    procedure Expand_Pragma_Interrupt_Priority      (N : Node_Id);
72    procedure Expand_Pragma_Psect_Object            (N : Node_Id);
73
74    ----------
75    -- Arg1 --
76    ----------
77
78    function Arg1 (N : Node_Id) return Node_Id is
79       Arg : constant Node_Id := First (Pragma_Argument_Associations (N));
80    begin
81       if Present (Arg)
82         and then Nkind (Arg) = N_Pragma_Argument_Association
83       then
84          return Expression (Arg);
85       else
86          return Arg;
87       end if;
88    end Arg1;
89
90    ----------
91    -- Arg2 --
92    ----------
93
94    function Arg2 (N : Node_Id) return Node_Id is
95       Arg1 : constant Node_Id := First (Pragma_Argument_Associations (N));
96    begin
97       if No (Arg1) then
98          return Empty;
99       else
100          declare
101             Arg : constant Node_Id := Next (Arg1);
102          begin
103             if Present (Arg)
104               and then Nkind (Arg) = N_Pragma_Argument_Association
105             then
106                return Expression (Arg);
107             else
108                return Arg;
109             end if;
110          end;
111       end if;
112    end Arg2;
113
114    ---------------------
115    -- Expand_N_Pragma --
116    ---------------------
117
118    procedure Expand_N_Pragma (N : Node_Id) is
119    begin
120       --  Note: we may have a pragma whose chars field is not a
121       --  recognized pragma, and we must ignore it at this stage.
122
123       if Is_Pragma_Name (Chars (N)) then
124          case Get_Pragma_Id (Chars (N)) is
125
126             --  Pragmas requiring special expander action
127
128             when Pragma_Abort_Defer =>
129                Expand_Pragma_Abort_Defer (N);
130
131             when Pragma_Assert =>
132                Expand_Pragma_Assert (N);
133
134             when Pragma_Common_Object =>
135                Expand_Pragma_Common_Object (N);
136
137             when Pragma_Export_Exception =>
138                Expand_Pragma_Import_Export_Exception (N);
139
140             when Pragma_Import =>
141                Expand_Pragma_Import_Or_Interface (N);
142
143             when Pragma_Import_Exception =>
144                Expand_Pragma_Import_Export_Exception (N);
145
146             when Pragma_Inspection_Point =>
147                Expand_Pragma_Inspection_Point (N);
148
149             when Pragma_Interface =>
150                Expand_Pragma_Import_Or_Interface (N);
151
152             when Pragma_Interrupt_Priority =>
153                Expand_Pragma_Interrupt_Priority (N);
154
155             when Pragma_Psect_Object =>
156                Expand_Pragma_Psect_Object (N);
157
158             --  All other pragmas need no expander action
159
160             when others => null;
161          end case;
162       end if;
163
164    end Expand_N_Pragma;
165
166    -------------------------------
167    -- Expand_Pragma_Abort_Defer --
168    -------------------------------
169
170    --  An Abort_Defer pragma appears as the first statement in a handled
171    --  statement sequence (right after the begin). It defers aborts for
172    --  the entire statement sequence, but not for any declarations or
173    --  handlers (if any) associated with this statement sequence.
174
175    --  The transformation is to transform
176
177    --    pragma Abort_Defer;
178    --    statements;
179
180    --  into
181
182    --    begin
183    --       Abort_Defer.all;
184    --       statements
185    --    exception
186    --       when all others =>
187    --          Abort_Undefer.all;
188    --          raise;
189    --    at end
190    --       Abort_Undefer_Direct;
191    --    end;
192
193    procedure Expand_Pragma_Abort_Defer (N : Node_Id) is
194       Loc  : constant Source_Ptr := Sloc (N);
195       Stm  : Node_Id;
196       Stms : List_Id;
197       HSS  : Node_Id;
198       Blk  : constant Entity_Id :=
199         New_Internal_Entity (E_Block, Current_Scope, Sloc (N), 'B');
200
201    begin
202       Stms := New_List (Build_Runtime_Call (Loc, RE_Abort_Defer));
203
204       loop
205          Stm := Remove_Next (N);
206          exit when No (Stm);
207          Append (Stm, Stms);
208       end loop;
209
210       HSS :=
211         Make_Handled_Sequence_Of_Statements (Loc,
212           Statements => Stms,
213           At_End_Proc =>
214             New_Occurrence_Of (RTE (RE_Abort_Undefer_Direct), Loc));
215
216       Rewrite (N,
217         Make_Block_Statement (Loc,
218           Handled_Statement_Sequence => HSS));
219
220       Set_Scope (Blk, Current_Scope);
221       Set_Etype (Blk, Standard_Void_Type);
222       Set_Identifier (N, New_Occurrence_Of (Blk, Sloc (N)));
223       Expand_At_End_Handler (HSS, Blk);
224       Analyze (N);
225    end Expand_Pragma_Abort_Defer;
226
227    --------------------------
228    -- Expand_Pragma_Assert --
229    --------------------------
230
231    procedure Expand_Pragma_Assert (N : Node_Id) is
232       Loc  : constant Source_Ptr := Sloc (N);
233       Cond : constant Node_Id    := Arg1 (N);
234       Msg  : String_Id;
235
236    begin
237       --  We already know that assertions are enabled, because otherwise
238       --  the semantic pass dealt with rewriting the assertion (see Sem_Prag)
239
240       pragma Assert (Assertions_Enabled);
241
242       --  Since assertions are on, we rewrite the pragma with its
243       --  corresponding if statement, and then analyze the statement
244       --  The normal case expansion transforms:
245
246       --    pragma Assert (condition [,message]);
247
248       --  into
249
250       --    if not condition then
251       --       System.Assertions.Raise_Assert_Failure (Str);
252       --    end if;
253
254       --  where Str is the message if one is present, or the default of
255       --  file:line if no message is given.
256
257       --  An alternative expansion is used when the No_Exception_Propagation
258       --  restriction is active and there is a local Assert_Failure handler.
259       --  This is not a common combination of circumstances, but it occurs in
260       --  the context of Aunit and the zero footprint profile. In this case we
261       --  generate:
262
263       --    if not condition then
264       --       raise Assert_Failure;
265       --    end if;
266
267       --  This will then be transformed into a goto, and the local handler will
268       --  be able to handle the assert error (which would not be the case if a
269       --  call is made to the Raise_Assert_Failure procedure).
270
271       --  Note that the reason we do not always generate a direct raise is that
272       --  the form in which the procedure is called allows for more efficient
273       --  breakpointing of assertion errors.
274
275       --  Generate the appropriate if statement. Note that we consider this to
276       --  be an explicit conditional in the source, not an implicit if, so we
277       --  do not call Make_Implicit_If_Statement.
278
279       --  Case where we generate a direct raise
280
281       if (Debug_Flag_Dot_G
282           or else Restriction_Active (No_Exception_Propagation))
283         and then Present (Find_Local_Handler (RTE (RE_Assert_Failure), N))
284       then
285          Rewrite (N,
286            Make_If_Statement (Loc,
287              Condition =>
288                Make_Op_Not (Loc,
289                  Right_Opnd => Cond),
290              Then_Statements => New_List (
291                Make_Raise_Statement (Loc,
292                  Name =>
293                    New_Reference_To (RTE (RE_Assert_Failure), Loc)))));
294
295       --  Case where we call the procedure
296
297       else
298          --  First, we need to prepare the string literal
299
300          if Present (Arg2 (N)) then
301             Msg := Strval (Expr_Value_S (Arg2 (N)));
302          else
303             Build_Location_String (Loc);
304             Msg := String_From_Name_Buffer;
305          end if;
306
307          --  Now rewrite as an if statement
308
309          Rewrite (N,
310            Make_If_Statement (Loc,
311              Condition =>
312                Make_Op_Not (Loc,
313                  Right_Opnd => Cond),
314              Then_Statements => New_List (
315                Make_Procedure_Call_Statement (Loc,
316                  Name =>
317                    New_Reference_To (RTE (RE_Raise_Assert_Failure), Loc),
318                  Parameter_Associations => New_List (
319                    Make_String_Literal (Loc, Msg))))));
320       end if;
321
322       Analyze (N);
323
324       --  If new condition is always false, give a warning
325
326       if Warn_On_Assertion_Failure
327         and then 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;