Daily bump.
[official-gcc.git] / gcc / ada / par-prag.adb
blobcea58991e65f2f305a3ce1b10f1103f6c5ea8c37
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- P A R . P R A G --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 1992-2017, 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 ------------------------------------------------------------------------------
26 -- Generally the parser checks the basic syntax of pragmas, but does not
27 -- do specialized syntax checks for individual pragmas, these are deferred
28 -- to semantic analysis time (see unit Sem_Prag). There are some pragmas
29 -- which require recognition and either partial or complete processing
30 -- during parsing, and this unit performs this required processing.
32 with Fname.UF; use Fname.UF;
33 with Osint; use Osint;
34 with Rident; use Rident;
35 with Restrict; use Restrict;
36 with Stringt; use Stringt;
37 with Stylesw; use Stylesw;
38 with Uintp; use Uintp;
39 with Uname; use Uname;
41 with System.WCh_Con; use System.WCh_Con;
43 separate (Par)
45 function Prag (Pragma_Node : Node_Id; Semi : Source_Ptr) return Node_Id is
46 Prag_Name : constant Name_Id := Pragma_Name_Unmapped (Pragma_Node);
47 Prag_Id : constant Pragma_Id := Get_Pragma_Id (Prag_Name);
48 Pragma_Sloc : constant Source_Ptr := Sloc (Pragma_Node);
49 Arg_Count : Nat;
50 Arg_Node : Node_Id;
52 -----------------------
53 -- Local Subprograms --
54 -----------------------
56 procedure Add_List_Pragma_Entry (PT : List_Pragma_Type; Loc : Source_Ptr);
57 -- Make a new entry in the List_Pragmas table if this entry is not already
58 -- in the table (it will always be the last one if there is a duplication
59 -- resulting from the use of Save/Restore_Scan_State).
61 function Arg1 return Node_Id;
62 function Arg2 return Node_Id;
63 function Arg3 return Node_Id;
64 -- Obtain specified Pragma_Argument_Association. It is allowable to call
65 -- the routine for the argument one past the last present argument, but
66 -- that is the only case in which a non-present argument can be referenced.
68 procedure Check_Arg_Count (Required : Int);
69 -- Check argument count for pragma = Required. If not give error and raise
70 -- Error_Resync.
72 procedure Check_Arg_Is_String_Literal (Arg : Node_Id);
73 -- Check the expression of the specified argument to make sure that it
74 -- is a string literal. If not give error and raise Error_Resync.
76 procedure Check_Arg_Is_On_Or_Off (Arg : Node_Id);
77 -- Check the expression of the specified argument to make sure that it
78 -- is an identifier which is either ON or OFF, and if not, then issue
79 -- an error message and raise Error_Resync.
81 procedure Check_No_Identifier (Arg : Node_Id);
82 -- Checks that the given argument does not have an identifier. If
83 -- an identifier is present, then an error message is issued, and
84 -- Error_Resync is raised.
86 procedure Check_Optional_Identifier (Arg : Node_Id; Id : Name_Id);
87 -- Checks if the given argument has an identifier, and if so, requires
88 -- it to match the given identifier name. If there is a non-matching
89 -- identifier, then an error message is given and Error_Resync raised.
91 procedure Check_Required_Identifier (Arg : Node_Id; Id : Name_Id);
92 -- Same as Check_Optional_Identifier, except that the name is required
93 -- to be present and to match the given Id value.
95 procedure Process_Restrictions_Or_Restriction_Warnings;
96 -- Common processing for Restrictions and Restriction_Warnings pragmas.
97 -- For the most part, restrictions need not be processed at parse time,
98 -- since they only affect semantic processing. This routine handles the
99 -- exceptions as follows
101 -- No_Obsolescent_Features must be processed at parse time, since there
102 -- are some obsolescent features (e.g. character replacements) which are
103 -- handled at parse time.
105 -- SPARK must be processed at parse time, since this restriction controls
106 -- whether the scanner recognizes a spark HIDE directive formatted as an
107 -- Ada comment (and generates a Tok_SPARK_Hide token for the directive).
109 -- No_Dependence must be processed at parse time, since otherwise it gets
110 -- handled too late.
112 -- Note that we don't need to do full error checking for badly formed cases
113 -- of restrictions, since these will be caught during semantic analysis.
115 ---------------------------
116 -- Add_List_Pragma_Entry --
117 ---------------------------
119 procedure Add_List_Pragma_Entry (PT : List_Pragma_Type; Loc : Source_Ptr) is
120 begin
121 if List_Pragmas.Last < List_Pragmas.First
122 or else (List_Pragmas.Table (List_Pragmas.Last)) /= ((PT, Loc))
123 then
124 List_Pragmas.Append ((PT, Loc));
125 end if;
126 end Add_List_Pragma_Entry;
128 ----------
129 -- Arg1 --
130 ----------
132 function Arg1 return Node_Id is
133 begin
134 return First (Pragma_Argument_Associations (Pragma_Node));
135 end Arg1;
137 ----------
138 -- Arg2 --
139 ----------
141 function Arg2 return Node_Id is
142 begin
143 return Next (Arg1);
144 end Arg2;
146 ----------
147 -- Arg3 --
148 ----------
150 function Arg3 return Node_Id is
151 begin
152 return Next (Arg2);
153 end Arg3;
155 ---------------------
156 -- Check_Arg_Count --
157 ---------------------
159 procedure Check_Arg_Count (Required : Int) is
160 begin
161 if Arg_Count /= Required then
162 Error_Msg ("wrong number of arguments for pragma%", Pragma_Sloc);
163 raise Error_Resync;
164 end if;
165 end Check_Arg_Count;
167 ----------------------------
168 -- Check_Arg_Is_On_Or_Off --
169 ----------------------------
171 procedure Check_Arg_Is_On_Or_Off (Arg : Node_Id) is
172 Argx : constant Node_Id := Expression (Arg);
174 begin
175 if Nkind (Expression (Arg)) /= N_Identifier
176 or else not Nam_In (Chars (Argx), Name_On, Name_Off)
177 then
178 Error_Msg_Name_2 := Name_On;
179 Error_Msg_Name_3 := Name_Off;
181 Error_Msg ("argument for pragma% must be% or%", Sloc (Argx));
182 raise Error_Resync;
183 end if;
184 end Check_Arg_Is_On_Or_Off;
186 ---------------------------------
187 -- Check_Arg_Is_String_Literal --
188 ---------------------------------
190 procedure Check_Arg_Is_String_Literal (Arg : Node_Id) is
191 begin
192 if Nkind (Expression (Arg)) /= N_String_Literal then
193 Error_Msg
194 ("argument for pragma% must be string literal",
195 Sloc (Expression (Arg)));
196 raise Error_Resync;
197 end if;
198 end Check_Arg_Is_String_Literal;
200 -------------------------
201 -- Check_No_Identifier --
202 -------------------------
204 procedure Check_No_Identifier (Arg : Node_Id) is
205 begin
206 if Chars (Arg) /= No_Name then
207 Error_Msg_N ("pragma% does not permit named arguments", Arg);
208 raise Error_Resync;
209 end if;
210 end Check_No_Identifier;
212 -------------------------------
213 -- Check_Optional_Identifier --
214 -------------------------------
216 procedure Check_Optional_Identifier (Arg : Node_Id; Id : Name_Id) is
217 begin
218 if Present (Arg) and then Chars (Arg) /= No_Name then
219 if Chars (Arg) /= Id then
220 Error_Msg_Name_2 := Id;
221 Error_Msg_N ("pragma% argument expects identifier%", Arg);
222 end if;
223 end if;
224 end Check_Optional_Identifier;
226 -------------------------------
227 -- Check_Required_Identifier --
228 -------------------------------
230 procedure Check_Required_Identifier (Arg : Node_Id; Id : Name_Id) is
231 begin
232 if Chars (Arg) /= Id then
233 Error_Msg_Name_2 := Id;
234 Error_Msg_N ("pragma% argument must have identifier%", Arg);
235 end if;
236 end Check_Required_Identifier;
238 --------------------------------------------------
239 -- Process_Restrictions_Or_Restriction_Warnings --
240 --------------------------------------------------
242 procedure Process_Restrictions_Or_Restriction_Warnings is
243 Arg : Node_Id;
244 Id : Name_Id;
245 Expr : Node_Id;
247 begin
248 Arg := Arg1;
249 while Present (Arg) loop
250 Id := Chars (Arg);
251 Expr := Expression (Arg);
253 if Id = No_Name and then Nkind (Expr) = N_Identifier then
254 case Chars (Expr) is
255 when Name_No_Obsolescent_Features =>
256 Set_Restriction (No_Obsolescent_Features, Pragma_Node);
257 Restriction_Warnings (No_Obsolescent_Features) :=
258 Prag_Id = Pragma_Restriction_Warnings;
260 when Name_SPARK
261 | Name_SPARK_05
263 Set_Restriction (SPARK_05, Pragma_Node);
264 Restriction_Warnings (SPARK_05) :=
265 Prag_Id = Pragma_Restriction_Warnings;
267 when others =>
268 null;
269 end case;
271 elsif Id = Name_No_Dependence then
272 Set_Restriction_No_Dependence
273 (Unit => Expr,
274 Warn => Prag_Id = Pragma_Restriction_Warnings
275 or else Treat_Restrictions_As_Warnings);
276 end if;
278 Next (Arg);
279 end loop;
280 end Process_Restrictions_Or_Restriction_Warnings;
282 -- Start of processing for Prag
284 begin
285 Error_Msg_Name_1 := Prag_Name;
287 -- Ignore unrecognized pragma. We let Sem post the warning for this, since
288 -- it is a semantic error, not a syntactic one (we have already checked
289 -- the syntax for the unrecognized pragma as required by (RM 2.8(11)).
291 if Prag_Id = Unknown_Pragma then
292 return Pragma_Node;
293 end if;
295 -- Ignore pragma if Ignore_Pragma applies. Also ignore pragma
296 -- Default_Scalar_Storage_Order if the -gnatI switch was given.
298 if Should_Ignore_Pragma_Par (Prag_Name)
299 or else (Prag_Id = Pragma_Default_Scalar_Storage_Order
300 and then Ignore_Rep_Clauses)
301 then
302 return Pragma_Node;
303 end if;
305 -- Count number of arguments. This loop also checks if any of the arguments
306 -- are Error, indicating a syntax error as they were parsed. If so, we
307 -- simply return, because we get into trouble with cascaded errors if we
308 -- try to perform our error checks on junk arguments.
310 Arg_Count := 0;
312 if Present (Pragma_Argument_Associations (Pragma_Node)) then
313 Arg_Node := Arg1;
314 while Arg_Node /= Empty loop
315 Arg_Count := Arg_Count + 1;
317 if Expression (Arg_Node) = Error then
318 return Error;
319 end if;
321 Next (Arg_Node);
322 end loop;
323 end if;
325 -- Remaining processing is pragma dependent
327 case Prag_Id is
329 ------------
330 -- Ada_83 --
331 ------------
333 -- This pragma must be processed at parse time, since we want to set
334 -- the Ada version properly at parse time to recognize the appropriate
335 -- Ada version syntax.
337 when Pragma_Ada_83 =>
338 if not Latest_Ada_Only then
339 Ada_Version := Ada_83;
340 Ada_Version_Explicit := Ada_83;
341 Ada_Version_Pragma := Pragma_Node;
342 end if;
344 ------------
345 -- Ada_95 --
346 ------------
348 -- This pragma must be processed at parse time, since we want to set
349 -- the Ada version properly at parse time to recognize the appropriate
350 -- Ada version syntax.
352 when Pragma_Ada_95 =>
353 if not Latest_Ada_Only then
354 Ada_Version := Ada_95;
355 Ada_Version_Explicit := Ada_95;
356 Ada_Version_Pragma := Pragma_Node;
357 end if;
359 ---------------------
360 -- Ada_05/Ada_2005 --
361 ---------------------
363 -- These pragmas must be processed at parse time, since we want to set
364 -- the Ada version properly at parse time to recognize the appropriate
365 -- Ada version syntax. However, it is only the zero argument form that
366 -- must be processed at parse time.
368 when Pragma_Ada_05
369 | Pragma_Ada_2005
371 if Arg_Count = 0 and not Latest_Ada_Only then
372 Ada_Version := Ada_2005;
373 Ada_Version_Explicit := Ada_2005;
374 Ada_Version_Pragma := Pragma_Node;
375 end if;
377 ---------------------
378 -- Ada_12/Ada_2012 --
379 ---------------------
381 -- These pragmas must be processed at parse time, since we want to set
382 -- the Ada version properly at parse time to recognize the appropriate
383 -- Ada version syntax. However, it is only the zero argument form that
384 -- must be processed at parse time.
386 when Pragma_Ada_12
387 | Pragma_Ada_2012
389 if Arg_Count = 0 then
390 Ada_Version := Ada_2012;
391 Ada_Version_Explicit := Ada_2012;
392 Ada_Version_Pragma := Pragma_Node;
393 end if;
395 ---------------------------
396 -- Compiler_Unit_Warning --
397 ---------------------------
399 -- This pragma must be processed at parse time, since the resulting
400 -- status may be tested during the parsing of the program.
402 when Pragma_Compiler_Unit
403 | Pragma_Compiler_Unit_Warning
405 Check_Arg_Count (0);
407 -- Only recognized in main unit
409 if Current_Source_Unit = Main_Unit then
410 Compiler_Unit := True;
411 end if;
413 -----------
414 -- Debug --
415 -----------
417 -- pragma Debug ([boolean_EXPRESSION,] PROCEDURE_CALL_STATEMENT);
419 when Pragma_Debug =>
420 Check_No_Identifier (Arg1);
422 if Arg_Count = 2 then
423 Check_No_Identifier (Arg2);
424 else
425 Check_Arg_Count (1);
426 end if;
428 -------------------------------
429 -- Extensions_Allowed (GNAT) --
430 -------------------------------
432 -- pragma Extensions_Allowed (Off | On)
434 -- The processing for pragma Extensions_Allowed must be done at
435 -- parse time, since extensions mode may affect what is accepted.
437 when Pragma_Extensions_Allowed =>
438 Check_Arg_Count (1);
439 Check_No_Identifier (Arg1);
440 Check_Arg_Is_On_Or_Off (Arg1);
442 if Chars (Expression (Arg1)) = Name_On then
443 Extensions_Allowed := True;
444 Ada_Version := Ada_2012;
445 else
446 Extensions_Allowed := False;
447 Ada_Version := Ada_Version_Explicit;
448 end if;
450 -------------------
451 -- Ignore_Pragma --
452 -------------------
454 -- Processing for this pragma must be done at parse time, since we want
455 -- be able to ignore pragmas that are otherwise processed at parse time.
457 when Pragma_Ignore_Pragma => Ignore_Pragma : declare
458 A : Node_Id;
460 begin
461 Check_Arg_Count (1);
462 Check_No_Identifier (Arg1);
463 A := Expression (Arg1);
465 if Nkind (A) /= N_Identifier then
466 Error_Msg ("incorrect argument for pragma %", Sloc (A));
467 else
468 Set_Name_Table_Boolean3 (Chars (A), True);
469 end if;
470 end Ignore_Pragma;
472 ----------------
473 -- List (2.8) --
474 ----------------
476 -- pragma List (Off | On)
478 -- The processing for pragma List must be done at parse time, since a
479 -- listing can be generated in parse only mode.
481 when Pragma_List =>
482 Check_Arg_Count (1);
483 Check_No_Identifier (Arg1);
484 Check_Arg_Is_On_Or_Off (Arg1);
486 -- We unconditionally make a List_On entry for the pragma, so that
487 -- in the List (Off) case, the pragma will print even in a region
488 -- of code with listing turned off (this is required).
490 Add_List_Pragma_Entry (List_On, Sloc (Pragma_Node));
492 -- Now generate the list off entry for pragma List (Off)
494 if Chars (Expression (Arg1)) = Name_Off then
495 Add_List_Pragma_Entry (List_Off, Semi);
496 end if;
498 ----------------
499 -- Page (2.8) --
500 ----------------
502 -- pragma Page;
504 -- Processing for this pragma must be done at parse time, since a
505 -- listing can be generated in parse only mode with semantics off.
507 when Pragma_Page =>
508 Check_Arg_Count (0);
509 Add_List_Pragma_Entry (Page, Semi);
511 ------------------
512 -- Restrictions --
513 ------------------
515 -- pragma Restrictions (RESTRICTION {, RESTRICTION});
517 -- RESTRICTION ::=
518 -- restriction_IDENTIFIER
519 -- | restriction_parameter_IDENTIFIER => EXPRESSION
521 -- We process the case of No_Obsolescent_Features, since this has
522 -- a syntactic effect that we need to detect at parse time (the use
523 -- of replacement characters such as colon for pound sign).
525 when Pragma_Restrictions =>
526 Process_Restrictions_Or_Restriction_Warnings;
528 --------------------------
529 -- Restriction_Warnings --
530 --------------------------
532 -- pragma Restriction_Warnings (RESTRICTION {, RESTRICTION});
534 -- RESTRICTION ::=
535 -- restriction_IDENTIFIER
536 -- | restriction_parameter_IDENTIFIER => EXPRESSION
538 -- See above comment for pragma Restrictions
540 when Pragma_Restriction_Warnings =>
541 Process_Restrictions_Or_Restriction_Warnings;
543 ----------------------------------------------------------
544 -- Source_File_Name and Source_File_Name_Project (GNAT) --
545 ----------------------------------------------------------
547 -- These two pragmas have the same syntax and semantics.
548 -- There are five forms of these pragmas:
550 -- pragma Source_File_Name[_Project] (
551 -- [UNIT_NAME =>] unit_NAME,
552 -- BODY_FILE_NAME => STRING_LITERAL
553 -- [, [INDEX =>] INTEGER_LITERAL]);
555 -- pragma Source_File_Name[_Project] (
556 -- [UNIT_NAME =>] unit_NAME,
557 -- SPEC_FILE_NAME => STRING_LITERAL
558 -- [, [INDEX =>] INTEGER_LITERAL]);
560 -- pragma Source_File_Name[_Project] (
561 -- BODY_FILE_NAME => STRING_LITERAL
562 -- [, DOT_REPLACEMENT => STRING_LITERAL]
563 -- [, CASING => CASING_SPEC]);
565 -- pragma Source_File_Name[_Project] (
566 -- SPEC_FILE_NAME => STRING_LITERAL
567 -- [, DOT_REPLACEMENT => STRING_LITERAL]
568 -- [, CASING => CASING_SPEC]);
570 -- pragma Source_File_Name[_Project] (
571 -- SUBUNIT_FILE_NAME => STRING_LITERAL
572 -- [, DOT_REPLACEMENT => STRING_LITERAL]
573 -- [, CASING => CASING_SPEC]);
575 -- CASING_SPEC ::= Uppercase | Lowercase | Mixedcase
577 -- Pragma Source_File_Name_Project (SFNP) is equivalent to pragma
578 -- Source_File_Name (SFN), however their usage is exclusive:
579 -- SFN can only be used when no project file is used, while
580 -- SFNP can only be used when a project file is used.
582 -- The Project Manager produces a configuration pragmas file that
583 -- is communicated to the compiler with -gnatec switch. This file
584 -- contains only SFNP pragmas (at least two for the default naming
585 -- scheme. As this configuration pragmas file is always the first
586 -- processed by the compiler, it prevents the use of pragmas SFN in
587 -- other config files when a project file is in use.
589 -- Note: we process this during parsing, since we need to have the
590 -- source file names set well before the semantic analysis starts,
591 -- since we load the spec and with'ed packages before analysis.
593 when Pragma_Source_File_Name
594 | Pragma_Source_File_Name_Project
596 Source_File_Name : declare
597 Unam : Unit_Name_Type;
598 Expr1 : Node_Id;
599 Pat : String_Ptr;
600 Typ : Character;
601 Dot : String_Ptr;
602 Cas : Casing_Type;
603 Nast : Nat;
604 Expr : Node_Id;
605 Index : Nat;
607 function Get_Fname (Arg : Node_Id) return File_Name_Type;
608 -- Process file name from unit name form of pragma
610 function Get_String_Argument (Arg : Node_Id) return String_Ptr;
611 -- Process string literal value from argument
613 procedure Process_Casing (Arg : Node_Id);
614 -- Process Casing argument of pattern form of pragma
616 procedure Process_Dot_Replacement (Arg : Node_Id);
617 -- Process Dot_Replacement argument of pattern form of pragma
619 ---------------
620 -- Get_Fname --
621 ---------------
623 function Get_Fname (Arg : Node_Id) return File_Name_Type is
624 begin
625 String_To_Name_Buffer (Strval (Expression (Arg)));
627 for J in 1 .. Name_Len loop
628 if Is_Directory_Separator (Name_Buffer (J)) then
629 Error_Msg
630 ("directory separator character not allowed",
631 Sloc (Expression (Arg)) + Source_Ptr (J));
632 end if;
633 end loop;
635 return Name_Find;
636 end Get_Fname;
638 -------------------------
639 -- Get_String_Argument --
640 -------------------------
642 function Get_String_Argument (Arg : Node_Id) return String_Ptr is
643 Str : String_Id;
645 begin
646 if Nkind (Expression (Arg)) /= N_String_Literal
647 and then
648 Nkind (Expression (Arg)) /= N_Operator_Symbol
649 then
650 Error_Msg_N
651 ("argument for pragma% must be string literal", Arg);
652 raise Error_Resync;
653 end if;
655 Str := Strval (Expression (Arg));
657 -- Check string has no wide chars
659 for J in 1 .. String_Length (Str) loop
660 if Get_String_Char (Str, J) > 255 then
661 Error_Msg
662 ("wide character not allowed in pattern for pragma%",
663 Sloc (Expression (Arg2)) + Text_Ptr (J) - 1);
664 end if;
665 end loop;
667 -- Acquire string
669 String_To_Name_Buffer (Str);
670 return new String'(Name_Buffer (1 .. Name_Len));
671 end Get_String_Argument;
673 --------------------
674 -- Process_Casing --
675 --------------------
677 procedure Process_Casing (Arg : Node_Id) is
678 Expr : constant Node_Id := Expression (Arg);
680 begin
681 Check_Required_Identifier (Arg, Name_Casing);
683 if Nkind (Expr) = N_Identifier then
684 if Chars (Expr) = Name_Lowercase then
685 Cas := All_Lower_Case;
686 return;
687 elsif Chars (Expr) = Name_Uppercase then
688 Cas := All_Upper_Case;
689 return;
690 elsif Chars (Expr) = Name_Mixedcase then
691 Cas := Mixed_Case;
692 return;
693 end if;
694 end if;
696 Error_Msg_N
697 ("Casing argument for pragma% must be " &
698 "one of Mixedcase, Lowercase, Uppercase",
699 Arg);
700 end Process_Casing;
702 -----------------------------
703 -- Process_Dot_Replacement --
704 -----------------------------
706 procedure Process_Dot_Replacement (Arg : Node_Id) is
707 begin
708 Check_Required_Identifier (Arg, Name_Dot_Replacement);
709 Dot := Get_String_Argument (Arg);
710 end Process_Dot_Replacement;
712 -- Start of processing for Source_File_Name and
713 -- Source_File_Name_Project pragmas.
715 begin
716 if Prag_Id = Pragma_Source_File_Name then
717 if Project_File_In_Use = In_Use then
718 Error_Msg
719 ("pragma Source_File_Name cannot be used " &
720 "with a project file", Pragma_Sloc);
722 else
723 Project_File_In_Use := Not_In_Use;
724 end if;
726 else
727 if Project_File_In_Use = Not_In_Use then
728 Error_Msg
729 ("pragma Source_File_Name_Project should only be used " &
730 "with a project file", Pragma_Sloc);
731 else
732 Project_File_In_Use := In_Use;
733 end if;
734 end if;
736 -- We permit from 1 to 3 arguments
738 if Arg_Count not in 1 .. 3 then
739 Check_Arg_Count (1);
740 end if;
742 Expr1 := Expression (Arg1);
744 -- If first argument is identifier or selected component, then
745 -- we have the specific file case of the Source_File_Name pragma,
746 -- and the first argument is a unit name.
748 if Nkind (Expr1) = N_Identifier
749 or else
750 (Nkind (Expr1) = N_Selected_Component
751 and then
752 Nkind (Selector_Name (Expr1)) = N_Identifier)
753 then
754 if Nkind (Expr1) = N_Identifier
755 and then Chars (Expr1) = Name_System
756 then
757 Error_Msg_N
758 ("pragma Source_File_Name may not be used for System",
759 Arg1);
760 return Error;
761 end if;
763 -- Process index argument if present
765 if Arg_Count = 3 then
766 Expr := Expression (Arg3);
768 if Nkind (Expr) /= N_Integer_Literal
769 or else not UI_Is_In_Int_Range (Intval (Expr))
770 or else Intval (Expr) > 999
771 or else Intval (Expr) <= 0
772 then
773 Error_Msg
774 ("pragma% index must be integer literal" &
775 " in range 1 .. 999", Sloc (Expr));
776 raise Error_Resync;
777 else
778 Index := UI_To_Int (Intval (Expr));
779 end if;
781 -- No index argument present
783 else
784 Check_Arg_Count (2);
785 Index := 0;
786 end if;
788 Check_Optional_Identifier (Arg1, Name_Unit_Name);
789 Unam := Get_Unit_Name (Expr1);
791 Check_Arg_Is_String_Literal (Arg2);
793 if Chars (Arg2) = Name_Spec_File_Name then
794 Set_File_Name
795 (Get_Spec_Name (Unam), Get_Fname (Arg2), Index);
797 elsif Chars (Arg2) = Name_Body_File_Name then
798 Set_File_Name
799 (Unam, Get_Fname (Arg2), Index);
801 else
802 Error_Msg_N
803 ("pragma% argument has incorrect identifier", Arg2);
804 return Pragma_Node;
805 end if;
807 -- If the first argument is not an identifier, then we must have
808 -- the pattern form of the pragma, and the first argument must be
809 -- the pattern string with an appropriate name.
811 else
812 if Chars (Arg1) = Name_Spec_File_Name then
813 Typ := 's';
815 elsif Chars (Arg1) = Name_Body_File_Name then
816 Typ := 'b';
818 elsif Chars (Arg1) = Name_Subunit_File_Name then
819 Typ := 'u';
821 elsif Chars (Arg1) = Name_Unit_Name then
822 Error_Msg_N
823 ("Unit_Name parameter for pragma% must be an identifier",
824 Arg1);
825 raise Error_Resync;
827 else
828 Error_Msg_N
829 ("pragma% argument has incorrect identifier", Arg1);
830 raise Error_Resync;
831 end if;
833 Pat := Get_String_Argument (Arg1);
835 -- Check pattern has exactly one asterisk
837 Nast := 0;
838 for J in Pat'Range loop
839 if Pat (J) = '*' then
840 Nast := Nast + 1;
841 end if;
842 end loop;
844 if Nast /= 1 then
845 Error_Msg_N
846 ("file name pattern must have exactly one * character",
847 Arg1);
848 return Pragma_Node;
849 end if;
851 -- Set defaults for Casing and Dot_Separator parameters
853 Cas := All_Lower_Case;
854 Dot := new String'(".");
856 -- Process second and third arguments if present
858 if Arg_Count > 1 then
859 if Chars (Arg2) = Name_Casing then
860 Process_Casing (Arg2);
862 if Arg_Count = 3 then
863 Process_Dot_Replacement (Arg3);
864 end if;
866 else
867 Process_Dot_Replacement (Arg2);
869 if Arg_Count = 3 then
870 Process_Casing (Arg3);
871 end if;
872 end if;
873 end if;
875 Set_File_Name_Pattern (Pat, Typ, Dot, Cas);
876 end if;
877 end Source_File_Name;
879 -----------------------------
880 -- Source_Reference (GNAT) --
881 -----------------------------
883 -- pragma Source_Reference
884 -- (INTEGER_LITERAL [, STRING_LITERAL] );
886 -- Processing for this pragma must be done at parse time, since error
887 -- messages needing the proper line numbers can be generated in parse
888 -- only mode with semantic checking turned off, and indeed we usually
889 -- turn off semantic checking anyway if any parse errors are found.
891 when Pragma_Source_Reference => Source_Reference : declare
892 Fname : File_Name_Type;
894 begin
895 if Arg_Count /= 1 then
896 Check_Arg_Count (2);
897 Check_No_Identifier (Arg2);
898 end if;
900 -- Check that this is first line of file. We skip this test if
901 -- we are in syntax check only mode, since we may be dealing with
902 -- multiple compilation units.
904 if Get_Physical_Line_Number (Pragma_Sloc) /= 1
905 and then Num_SRef_Pragmas (Current_Source_File) = 0
906 and then Operating_Mode /= Check_Syntax
907 then
908 Error_Msg -- CODEFIX
909 ("first % pragma must be first line of file", Pragma_Sloc);
910 raise Error_Resync;
911 end if;
913 Check_No_Identifier (Arg1);
915 if Arg_Count = 1 then
916 if Num_SRef_Pragmas (Current_Source_File) = 0 then
917 Error_Msg
918 ("file name required for first % pragma in file",
919 Pragma_Sloc);
920 raise Error_Resync;
921 else
922 Fname := No_File;
923 end if;
925 -- File name present
927 else
928 Check_Arg_Is_String_Literal (Arg2);
929 String_To_Name_Buffer (Strval (Expression (Arg2)));
930 Fname := Name_Find;
932 if Num_SRef_Pragmas (Current_Source_File) > 0 then
933 if Fname /= Full_Ref_Name (Current_Source_File) then
934 Error_Msg
935 ("file name must be same in all % pragmas", Pragma_Sloc);
936 raise Error_Resync;
937 end if;
938 end if;
939 end if;
941 if Nkind (Expression (Arg1)) /= N_Integer_Literal then
942 Error_Msg
943 ("argument for pragma% must be integer literal",
944 Sloc (Expression (Arg1)));
945 raise Error_Resync;
947 -- OK, this source reference pragma is effective, however, we
948 -- ignore it if it is not in the first unit in the multiple unit
949 -- case. This is because the only purpose in this case is to
950 -- provide source pragmas for subsequent use by gnatchop.
952 else
953 if Num_Library_Units = 1 then
954 Register_Source_Ref_Pragma
955 (Fname,
956 Strip_Directory (Fname),
957 UI_To_Int (Intval (Expression (Arg1))),
958 Get_Physical_Line_Number (Pragma_Sloc) + 1);
959 end if;
960 end if;
961 end Source_Reference;
963 -------------------------
964 -- Style_Checks (GNAT) --
965 -------------------------
967 -- pragma Style_Checks (On | Off | ALL_CHECKS | STRING_LITERAL);
969 -- This is processed by the parser since some of the style
970 -- checks take place during source scanning and parsing.
972 when Pragma_Style_Checks => Style_Checks : declare
973 A : Node_Id;
974 S : String_Id;
975 C : Char_Code;
976 OK : Boolean := True;
978 begin
979 -- Two argument case is only for semantics
981 if Arg_Count = 2 then
982 null;
984 else
985 Check_Arg_Count (1);
986 Check_No_Identifier (Arg1);
987 A := Expression (Arg1);
989 if Nkind (A) = N_String_Literal then
990 S := Strval (A);
992 declare
993 Slen : constant Natural := Natural (String_Length (S));
994 Options : String (1 .. Slen);
995 J : Positive;
996 Ptr : Positive;
998 begin
999 J := 1;
1000 loop
1001 C := Get_String_Char (S, Pos (J));
1003 if not In_Character_Range (C) then
1004 OK := False;
1005 Ptr := J;
1006 exit;
1008 else
1009 Options (J) := Get_Character (C);
1010 end if;
1012 if J = Slen then
1013 if not Ignore_Style_Checks_Pragmas then
1014 Set_Style_Check_Options (Options, OK, Ptr);
1015 end if;
1017 exit;
1019 else
1020 J := J + 1;
1021 end if;
1022 end loop;
1024 if not OK then
1025 Error_Msg
1026 (Style_Msg_Buf (1 .. Style_Msg_Len),
1027 Sloc (Expression (Arg1)) + Source_Ptr (Ptr));
1028 raise Error_Resync;
1029 end if;
1030 end;
1032 elsif Nkind (A) /= N_Identifier then
1033 OK := False;
1035 elsif Chars (A) = Name_All_Checks then
1036 if not Ignore_Style_Checks_Pragmas then
1037 if GNAT_Mode then
1038 Stylesw.Set_GNAT_Style_Check_Options;
1039 else
1040 Stylesw.Set_Default_Style_Check_Options;
1041 end if;
1042 end if;
1044 elsif Chars (A) = Name_On then
1045 if not Ignore_Style_Checks_Pragmas then
1046 Style_Check := True;
1047 end if;
1049 elsif Chars (A) = Name_Off then
1050 if not Ignore_Style_Checks_Pragmas then
1051 Style_Check := False;
1052 end if;
1054 else
1055 OK := False;
1056 end if;
1058 if not OK then
1059 Error_Msg ("incorrect argument for pragma%", Sloc (A));
1060 raise Error_Resync;
1061 end if;
1062 end if;
1063 end Style_Checks;
1065 -------------------------
1066 -- Suppress_All (GNAT) --
1067 -------------------------
1069 -- pragma Suppress_All
1071 -- This is a rather odd pragma, because other compilers allow it in
1072 -- strange places. DEC allows it at the end of units, and Rational
1073 -- allows it as a program unit pragma, when it would be more natural
1074 -- if it were a configuration pragma.
1076 -- Since the reason we provide this pragma is for compatibility with
1077 -- these other compilers, we want to accommodate these strange placement
1078 -- rules, and the easiest thing is simply to allow it anywhere in a
1079 -- unit. If this pragma appears anywhere within a unit, then the effect
1080 -- is as though a pragma Suppress (All_Checks) had appeared as the first
1081 -- line of the current file, i.e. as the first configuration pragma in
1082 -- the current unit.
1084 -- To get this effect, we set the flag Has_Pragma_Suppress_All in the
1085 -- compilation unit node for the current source file then in the last
1086 -- stage of parsing a file, if this flag is set, we materialize the
1087 -- Suppress (All_Checks) pragma, marked as not coming from Source.
1089 when Pragma_Suppress_All =>
1090 Set_Has_Pragma_Suppress_All (Cunit (Current_Source_Unit));
1092 ---------------------
1093 -- Warnings (GNAT) --
1094 ---------------------
1096 -- pragma Warnings ([TOOL_NAME,] DETAILS [, REASON]);
1098 -- DETAILS ::= On | Off
1099 -- DETAILS ::= On | Off, local_NAME
1100 -- DETAILS ::= static_string_EXPRESSION
1101 -- DETAILS ::= On | Off, static_string_EXPRESSION
1103 -- TOOL_NAME ::= GNAT | GNATProve
1105 -- REASON ::= Reason => STRING_LITERAL {& STRING_LITERAL}
1107 -- Note: If the first argument matches an allowed tool name, it is
1108 -- always considered to be a tool name, even if there is a string
1109 -- variable of that name.
1111 -- The one argument ON/OFF case is processed by the parser, since it may
1112 -- control parser warnings as well as semantic warnings, and in any case
1113 -- we want to be absolutely sure that the range in the warnings table is
1114 -- set well before any semantic analysis is performed. Note that we
1115 -- ignore this pragma if debug flag -gnatd.i is set.
1117 -- Also note that the "one argument" case may have two or three
1118 -- arguments if the first one is a tool name, and/or the last one is a
1119 -- reason argument.
1121 when Pragma_Warnings => Warnings : declare
1122 function First_Arg_Is_Matching_Tool_Name return Boolean;
1123 -- Returns True if the first argument is a tool name matching the
1124 -- current tool being run.
1126 function Last_Arg return Node_Id;
1127 -- Returns the last argument
1129 function Last_Arg_Is_Reason return Boolean;
1130 -- Returns True if the last argument is a reason argument
1132 function Get_Reason return String_Id;
1133 -- Analyzes Reason argument and returns corresponding String_Id
1134 -- value, or null if there is no Reason argument, or if the
1135 -- argument is not of the required form.
1137 -------------------------------------
1138 -- First_Arg_Is_Matching_Tool_Name --
1139 -------------------------------------
1141 function First_Arg_Is_Matching_Tool_Name return Boolean is
1142 begin
1143 return Nkind (Arg1) = N_Identifier
1145 -- Return True if the tool name is GNAT, and we're not in
1146 -- GNATprove or CodePeer or ASIS mode...
1148 and then ((Chars (Arg1) = Name_Gnat
1149 and then not
1150 (CodePeer_Mode or GNATprove_Mode or ASIS_Mode))
1152 -- or if the tool name is GNATprove, and we're in GNATprove
1153 -- mode.
1155 or else
1156 (Chars (Arg1) = Name_Gnatprove
1157 and then GNATprove_Mode));
1158 end First_Arg_Is_Matching_Tool_Name;
1160 ----------------
1161 -- Get_Reason --
1162 ----------------
1164 function Get_Reason return String_Id is
1165 Arg : constant Node_Id := Last_Arg;
1166 begin
1167 if Last_Arg_Is_Reason then
1168 Start_String;
1169 Get_Reason_String (Expression (Arg));
1170 return End_String;
1171 else
1172 return Null_String_Id;
1173 end if;
1174 end Get_Reason;
1176 --------------
1177 -- Last_Arg --
1178 --------------
1180 function Last_Arg return Node_Id is
1181 Last_Arg : Node_Id;
1183 begin
1184 if Arg_Count = 1 then
1185 Last_Arg := Arg1;
1186 elsif Arg_Count = 2 then
1187 Last_Arg := Arg2;
1188 elsif Arg_Count = 3 then
1189 Last_Arg := Arg3;
1190 elsif Arg_Count = 4 then
1191 Last_Arg := Next (Arg3);
1193 -- Illegal case, error issued in semantic analysis
1195 else
1196 Last_Arg := Empty;
1197 end if;
1199 return Last_Arg;
1200 end Last_Arg;
1202 ------------------------
1203 -- Last_Arg_Is_Reason --
1204 ------------------------
1206 function Last_Arg_Is_Reason return Boolean is
1207 Arg : constant Node_Id := Last_Arg;
1208 begin
1209 return Nkind (Arg) in N_Has_Chars
1210 and then Chars (Arg) = Name_Reason;
1211 end Last_Arg_Is_Reason;
1213 The_Arg : Node_Id; -- On/Off argument
1214 Argx : Node_Id;
1216 -- Start of processing for Warnings
1218 begin
1219 if not Debug_Flag_Dot_I
1220 and then (Arg_Count = 1
1221 or else (Arg_Count = 2
1222 and then (First_Arg_Is_Matching_Tool_Name
1223 or else
1224 Last_Arg_Is_Reason))
1225 or else (Arg_Count = 3
1226 and then First_Arg_Is_Matching_Tool_Name
1227 and then Last_Arg_Is_Reason))
1228 then
1229 if First_Arg_Is_Matching_Tool_Name then
1230 The_Arg := Arg2;
1231 else
1232 The_Arg := Arg1;
1233 end if;
1235 Check_No_Identifier (The_Arg);
1236 Argx := Expression (The_Arg);
1238 if Nkind (Argx) = N_Identifier then
1239 if Chars (Argx) = Name_On then
1240 Set_Warnings_Mode_On (Pragma_Sloc);
1241 elsif Chars (Argx) = Name_Off then
1242 Set_Warnings_Mode_Off (Pragma_Sloc, Get_Reason);
1243 end if;
1244 end if;
1245 end if;
1246 end Warnings;
1248 -----------------------------
1249 -- Wide_Character_Encoding --
1250 -----------------------------
1252 -- pragma Wide_Character_Encoding (IDENTIFIER | CHARACTER_LITERAL);
1254 -- This is processed by the parser, since the scanner is affected
1256 when Pragma_Wide_Character_Encoding => Wide_Character_Encoding : declare
1257 A : Node_Id;
1259 begin
1260 Check_Arg_Count (1);
1261 Check_No_Identifier (Arg1);
1262 A := Expression (Arg1);
1264 if Nkind (A) = N_Identifier then
1265 Get_Name_String (Chars (A));
1266 Wide_Character_Encoding_Method :=
1267 Get_WC_Encoding_Method (Name_Buffer (1 .. Name_Len));
1269 elsif Nkind (A) = N_Character_Literal then
1270 declare
1271 R : constant Char_Code :=
1272 Char_Code (UI_To_Int (Char_Literal_Value (A)));
1273 begin
1274 if In_Character_Range (R) then
1275 Wide_Character_Encoding_Method :=
1276 Get_WC_Encoding_Method (Get_Character (R));
1277 else
1278 raise Constraint_Error;
1279 end if;
1280 end;
1282 else
1283 raise Constraint_Error;
1284 end if;
1286 Upper_Half_Encoding :=
1287 Wide_Character_Encoding_Method in
1288 WC_Upper_Half_Encoding_Method;
1290 exception
1291 when Constraint_Error =>
1292 Error_Msg_N ("invalid argument for pragma%", Arg1);
1293 end Wide_Character_Encoding;
1295 -----------------------
1296 -- All Other Pragmas --
1297 -----------------------
1299 -- For all other pragmas, checking and processing is handled
1300 -- entirely in Sem_Prag, and no further checking is done by Par.
1302 when Pragma_Abort_Defer
1303 | Pragma_Abstract_State
1304 | Pragma_Async_Readers
1305 | Pragma_Async_Writers
1306 | Pragma_Assertion_Policy
1307 | Pragma_Assume
1308 | Pragma_Assume_No_Invalid_Values
1309 | Pragma_All_Calls_Remote
1310 | Pragma_Allow_Integer_Address
1311 | Pragma_Annotate
1312 | Pragma_Assert
1313 | Pragma_Assert_And_Cut
1314 | Pragma_Asynchronous
1315 | Pragma_Atomic
1316 | Pragma_Atomic_Components
1317 | Pragma_Attach_Handler
1318 | Pragma_Attribute_Definition
1319 | Pragma_Check
1320 | Pragma_Check_Float_Overflow
1321 | Pragma_Check_Name
1322 | Pragma_Check_Policy
1323 | Pragma_Compile_Time_Error
1324 | Pragma_Compile_Time_Warning
1325 | Pragma_Constant_After_Elaboration
1326 | Pragma_Contract_Cases
1327 | Pragma_Convention_Identifier
1328 | Pragma_CPP_Class
1329 | Pragma_CPP_Constructor
1330 | Pragma_CPP_Virtual
1331 | Pragma_CPP_Vtable
1332 | Pragma_CPU
1333 | Pragma_C_Pass_By_Copy
1334 | Pragma_Comment
1335 | Pragma_Common_Object
1336 | Pragma_Complete_Representation
1337 | Pragma_Complex_Representation
1338 | Pragma_Component_Alignment
1339 | Pragma_Controlled
1340 | Pragma_Convention
1341 | Pragma_Deadline_Floor
1342 | Pragma_Debug_Policy
1343 | Pragma_Depends
1344 | Pragma_Detect_Blocking
1345 | Pragma_Default_Initial_Condition
1346 | Pragma_Default_Scalar_Storage_Order
1347 | Pragma_Default_Storage_Pool
1348 | Pragma_Disable_Atomic_Synchronization
1349 | Pragma_Discard_Names
1350 | Pragma_Dispatching_Domain
1351 | Pragma_Effective_Reads
1352 | Pragma_Effective_Writes
1353 | Pragma_Eliminate
1354 | Pragma_Elaborate
1355 | Pragma_Elaborate_All
1356 | Pragma_Elaborate_Body
1357 | Pragma_Elaboration_Checks
1358 | Pragma_Enable_Atomic_Synchronization
1359 | Pragma_Export
1360 | Pragma_Export_Function
1361 | Pragma_Export_Object
1362 | Pragma_Export_Procedure
1363 | Pragma_Export_Value
1364 | Pragma_Export_Valued_Procedure
1365 | Pragma_Extend_System
1366 | Pragma_Extensions_Visible
1367 | Pragma_External
1368 | Pragma_External_Name_Casing
1369 | Pragma_Favor_Top_Level
1370 | Pragma_Fast_Math
1371 | Pragma_Finalize_Storage_Only
1372 | Pragma_Ghost
1373 | Pragma_Global
1374 | Pragma_Ident
1375 | Pragma_Implementation_Defined
1376 | Pragma_Implemented
1377 | Pragma_Implicit_Packing
1378 | Pragma_Import
1379 | Pragma_Import_Function
1380 | Pragma_Import_Object
1381 | Pragma_Import_Procedure
1382 | Pragma_Import_Valued_Procedure
1383 | Pragma_Independent
1384 | Pragma_Independent_Components
1385 | Pragma_Initial_Condition
1386 | Pragma_Initialize_Scalars
1387 | Pragma_Initializes
1388 | Pragma_Inline
1389 | Pragma_Inline_Always
1390 | Pragma_Inline_Generic
1391 | Pragma_Inspection_Point
1392 | Pragma_Interface
1393 | Pragma_Interface_Name
1394 | Pragma_Interrupt_Handler
1395 | Pragma_Interrupt_State
1396 | Pragma_Interrupt_Priority
1397 | Pragma_Invariant
1398 | Pragma_Keep_Names
1399 | Pragma_License
1400 | Pragma_Link_With
1401 | Pragma_Linker_Alias
1402 | Pragma_Linker_Constructor
1403 | Pragma_Linker_Destructor
1404 | Pragma_Linker_Options
1405 | Pragma_Linker_Section
1406 | Pragma_Lock_Free
1407 | Pragma_Locking_Policy
1408 | Pragma_Loop_Invariant
1409 | Pragma_Loop_Optimize
1410 | Pragma_Loop_Variant
1411 | Pragma_Machine_Attribute
1412 | Pragma_Main
1413 | Pragma_Main_Storage
1414 | Pragma_Max_Queue_Length
1415 | Pragma_Memory_Size
1416 | Pragma_No_Body
1417 | Pragma_No_Elaboration_Code_All
1418 | Pragma_No_Heap_Finalization
1419 | Pragma_No_Inline
1420 | Pragma_No_Return
1421 | Pragma_No_Run_Time
1422 | Pragma_No_Strict_Aliasing
1423 | Pragma_No_Tagged_Streams
1424 | Pragma_Normalize_Scalars
1425 | Pragma_Obsolescent
1426 | Pragma_Ordered
1427 | Pragma_Optimize
1428 | Pragma_Optimize_Alignment
1429 | Pragma_Overflow_Mode
1430 | Pragma_Overriding_Renamings
1431 | Pragma_Pack
1432 | Pragma_Part_Of
1433 | Pragma_Partition_Elaboration_Policy
1434 | Pragma_Passive
1435 | Pragma_Preelaborable_Initialization
1436 | Pragma_Polling
1437 | Pragma_Prefix_Exception_Messages
1438 | Pragma_Persistent_BSS
1439 | Pragma_Post
1440 | Pragma_Postcondition
1441 | Pragma_Post_Class
1442 | Pragma_Pre
1443 | Pragma_Precondition
1444 | Pragma_Predicate
1445 | Pragma_Predicate_Failure
1446 | Pragma_Preelaborate
1447 | Pragma_Pre_Class
1448 | Pragma_Priority
1449 | Pragma_Priority_Specific_Dispatching
1450 | Pragma_Profile
1451 | Pragma_Profile_Warnings
1452 | Pragma_Propagate_Exceptions
1453 | Pragma_Provide_Shift_Operators
1454 | Pragma_Psect_Object
1455 | Pragma_Pure
1456 | Pragma_Pure_Function
1457 | Pragma_Queuing_Policy
1458 | Pragma_Refined_Depends
1459 | Pragma_Refined_Global
1460 | Pragma_Refined_Post
1461 | Pragma_Refined_State
1462 | Pragma_Relative_Deadline
1463 | Pragma_Remote_Access_Type
1464 | Pragma_Remote_Call_Interface
1465 | Pragma_Remote_Types
1466 | Pragma_Restricted_Run_Time
1467 | Pragma_Rational
1468 | Pragma_Ravenscar
1469 | Pragma_Rename_Pragma
1470 | Pragma_Reviewable
1471 | Pragma_Secondary_Stack_Size
1472 | Pragma_Share_Generic
1473 | Pragma_Shared
1474 | Pragma_Shared_Passive
1475 | Pragma_Short_Circuit_And_Or
1476 | Pragma_Short_Descriptors
1477 | Pragma_Simple_Storage_Pool_Type
1478 | Pragma_SPARK_Mode
1479 | Pragma_Storage_Size
1480 | Pragma_Storage_Unit
1481 | Pragma_Static_Elaboration_Desired
1482 | Pragma_Stream_Convert
1483 | Pragma_Subtitle
1484 | Pragma_Suppress
1485 | Pragma_Suppress_Debug_Info
1486 | Pragma_Suppress_Exception_Locations
1487 | Pragma_Suppress_Initialization
1488 | Pragma_System_Name
1489 | Pragma_Task_Dispatching_Policy
1490 | Pragma_Task_Info
1491 | Pragma_Task_Name
1492 | Pragma_Task_Storage
1493 | Pragma_Test_Case
1494 | Pragma_Thread_Local_Storage
1495 | Pragma_Time_Slice
1496 | Pragma_Title
1497 | Pragma_Type_Invariant
1498 | Pragma_Type_Invariant_Class
1499 | Pragma_Unchecked_Union
1500 | Pragma_Unevaluated_Use_Of_Old
1501 | Pragma_Unimplemented_Unit
1502 | Pragma_Universal_Aliasing
1503 | Pragma_Universal_Data
1504 | Pragma_Unmodified
1505 | Pragma_Unreferenced
1506 | Pragma_Unreferenced_Objects
1507 | Pragma_Unreserve_All_Interrupts
1508 | Pragma_Unsuppress
1509 | Pragma_Unused
1510 | Pragma_Use_VADS_Size
1511 | Pragma_Volatile
1512 | Pragma_Volatile_Components
1513 | Pragma_Volatile_Full_Access
1514 | Pragma_Volatile_Function
1515 | Pragma_Warning_As_Error
1516 | Pragma_Weak_External
1517 | Pragma_Validity_Checks
1519 null;
1521 --------------------
1522 -- Unknown_Pragma --
1523 --------------------
1525 -- Should be impossible, since we excluded this case earlier on
1527 when Unknown_Pragma =>
1528 raise Program_Error;
1530 end case;
1532 return Pragma_Node;
1534 --------------------
1535 -- Error Handling --
1536 --------------------
1538 exception
1539 when Error_Resync =>
1540 return Error;
1542 end Prag;