[MAINTAINERS] Update my email address and move to DCO.
[official-gcc.git] / gcc / ada / par-prag.adb
blob4d10a6e060aac43a697402b3d676b1f7786acaab
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-2024, 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 : Nat);
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
77 (Arg : Node_Id; All_OK_Too : Boolean := False);
78 -- Check the expression of the specified argument to make sure that it
79 -- is an identifier which is either ON or OFF, and if not, then issue
80 -- an error message and raise Error_Resync. If All_OK_Too is True,
81 -- then an ALL identifer is also acceptable.
83 procedure Check_No_Identifier (Arg : Node_Id);
84 -- Checks that the given argument does not have an identifier. If
85 -- an identifier is present, then an error message is issued, and
86 -- Error_Resync is raised.
88 procedure Check_Optional_Identifier (Arg : Node_Id; Id : Name_Id);
89 -- Checks if the given argument has an identifier, and if so, requires
90 -- it to match the given identifier name. If there is a non-matching
91 -- identifier, then an error message is given and Error_Resync raised.
93 procedure Check_Required_Identifier (Arg : Node_Id; Id : Name_Id);
94 -- Same as Check_Optional_Identifier, except that the name is required
95 -- to be present and to match the given Id value.
97 procedure Process_Restrictions_Or_Restriction_Warnings;
98 -- Common processing for Restrictions and Restriction_Warnings pragmas.
99 -- For the most part, restrictions need not be processed at parse time,
100 -- since they only affect semantic processing. This routine handles the
101 -- exceptions as follows
103 -- No_Obsolescent_Features must be processed at parse time, since there
104 -- are some obsolescent features (e.g. character replacements) which are
105 -- handled at parse time.
107 -- No_Dependence must be processed at parse time, since otherwise it gets
108 -- handled too late.
110 -- No_Unrecognized_Aspects must be processed at parse time, since
111 -- unrecognized aspects are ignored by the parser.
113 -- Note that we don't need to do full error checking for badly formed cases
114 -- of restrictions, since these will be caught during semantic analysis.
116 ---------------------------
117 -- Add_List_Pragma_Entry --
118 ---------------------------
120 procedure Add_List_Pragma_Entry (PT : List_Pragma_Type; Loc : Source_Ptr) is
121 begin
122 if List_Pragmas.Last < List_Pragmas.First
123 or else List_Pragmas.Table (List_Pragmas.Last) /= (PT, Loc)
124 then
125 List_Pragmas.Append ((PT, Loc));
126 end if;
127 end Add_List_Pragma_Entry;
129 ----------
130 -- Arg1 --
131 ----------
133 function Arg1 return Node_Id is
134 begin
135 return First (Pragma_Argument_Associations (Pragma_Node));
136 end Arg1;
138 ----------
139 -- Arg2 --
140 ----------
142 function Arg2 return Node_Id is
143 begin
144 return Next (Arg1);
145 end Arg2;
147 ----------
148 -- Arg3 --
149 ----------
151 function Arg3 return Node_Id is
152 begin
153 return Next (Arg2);
154 end Arg3;
156 ---------------------
157 -- Check_Arg_Count --
158 ---------------------
160 procedure Check_Arg_Count (Required : Nat) is
161 begin
162 if Arg_Count /= Required then
163 Error_Msg_N ("wrong number of arguments for pragma%", Pragma_Node);
164 raise Error_Resync;
165 end if;
166 end Check_Arg_Count;
168 ----------------------------
169 -- Check_Arg_Is_On_Or_Off --
170 ----------------------------
172 procedure Check_Arg_Is_On_Or_Off
173 (Arg : Node_Id; All_OK_Too : Boolean := False)
175 Argx : constant Node_Id := Expression (Arg);
176 Error : Boolean := Nkind (Expression (Arg)) /= N_Identifier;
177 begin
178 if not Error then
179 Error := Chars (Argx) not in Name_On | Name_Off
180 and then not (All_OK_Too and Chars (Argx) = Name_All);
181 end if;
182 if Error then
183 Error_Msg_Name_2 := Name_On;
184 Error_Msg_Name_3 := Name_Off;
186 if All_OK_Too then
187 Error_Msg_Name_4 := Name_All;
188 Error_Msg_N ("argument for pragma% must be% or% or%", Argx);
189 else
190 Error_Msg_N ("argument for pragma% must be% or%", Argx);
191 end if;
192 raise Error_Resync;
193 end if;
194 end Check_Arg_Is_On_Or_Off;
196 ---------------------------------
197 -- Check_Arg_Is_String_Literal --
198 ---------------------------------
200 procedure Check_Arg_Is_String_Literal (Arg : Node_Id) is
201 begin
202 if Nkind (Expression (Arg)) /= N_String_Literal then
203 Error_Msg_N
204 ("argument for pragma% must be string literal",
205 Expression (Arg));
206 raise Error_Resync;
207 end if;
208 end Check_Arg_Is_String_Literal;
210 -------------------------
211 -- Check_No_Identifier --
212 -------------------------
214 procedure Check_No_Identifier (Arg : Node_Id) is
215 begin
216 if Chars (Arg) /= No_Name then
217 Error_Msg_N ("pragma% does not permit named arguments", Arg);
218 raise Error_Resync;
219 end if;
220 end Check_No_Identifier;
222 -------------------------------
223 -- Check_Optional_Identifier --
224 -------------------------------
226 procedure Check_Optional_Identifier (Arg : Node_Id; Id : Name_Id) is
227 begin
228 if Present (Arg) and then Chars (Arg) /= No_Name then
229 if Chars (Arg) /= Id then
230 Error_Msg_Name_2 := Id;
231 Error_Msg_N ("pragma% argument expects identifier%", Arg);
232 end if;
233 end if;
234 end Check_Optional_Identifier;
236 -------------------------------
237 -- Check_Required_Identifier --
238 -------------------------------
240 procedure Check_Required_Identifier (Arg : Node_Id; Id : Name_Id) is
241 begin
242 if Chars (Arg) /= Id then
243 Error_Msg_Name_2 := Id;
244 Error_Msg_N ("pragma% argument must have identifier%", Arg);
245 end if;
246 end Check_Required_Identifier;
248 --------------------------------------------------
249 -- Process_Restrictions_Or_Restriction_Warnings --
250 --------------------------------------------------
252 procedure Process_Restrictions_Or_Restriction_Warnings is
253 Arg : Node_Id;
254 Id : Name_Id;
255 Expr : Node_Id;
257 begin
258 Arg := Arg1;
259 while Present (Arg) loop
260 Id := Chars (Arg);
261 Expr := Expression (Arg);
263 if Id = No_Name and then Nkind (Expr) = N_Identifier then
264 case Chars (Expr) is
265 when Name_No_Obsolescent_Features =>
266 Set_Restriction (No_Obsolescent_Features, Pragma_Node);
267 Restriction_Warnings (No_Obsolescent_Features) :=
268 Prag_Id = Pragma_Restriction_Warnings;
270 when Name_SPARK_05 =>
271 Error_Msg_Name_1 := Chars (Expr);
272 Error_Msg_N
273 ("??% restriction is obsolete and ignored, consider " &
274 "using 'S'P'A'R'K_'Mode and gnatprove instead", Arg);
276 when Name_No_Unrecognized_Aspects =>
277 Set_Restriction
278 (No_Unrecognized_Aspects,
279 Pragma_Node,
280 Prag_Id = Pragma_Restriction_Warnings);
282 when others =>
283 null;
284 end case;
286 elsif Id = Name_No_Dependence then
287 Set_Restriction_No_Dependence
288 (Unit => Expr,
289 Warn => Prag_Id = Pragma_Restriction_Warnings
290 or else Treat_Restrictions_As_Warnings);
291 end if;
293 Next (Arg);
294 end loop;
295 end Process_Restrictions_Or_Restriction_Warnings;
297 -- Start of processing for Prag
299 begin
300 Error_Msg_Name_1 := Prag_Name;
302 -- Ignore unrecognized pragma. We let Sem post the warning for this, since
303 -- it is a semantic error, not a syntactic one (we have already checked
304 -- the syntax for the unrecognized pragma as required by (RM 2.8(11)).
306 if Prag_Id = Unknown_Pragma then
307 return Pragma_Node;
308 end if;
310 -- Ignore pragma if Ignore_Pragma applies. Also ignore pragma
311 -- Default_Scalar_Storage_Order if the -gnatI switch was given.
313 if Should_Ignore_Pragma_Par (Prag_Name)
314 or else (Prag_Id = Pragma_Default_Scalar_Storage_Order
315 and then Ignore_Rep_Clauses)
316 then
317 return Pragma_Node;
318 end if;
320 -- Count number of arguments. This loop also checks if any of the arguments
321 -- are Error, indicating a syntax error as they were parsed. If so, we
322 -- simply return, because we get into trouble with cascaded errors if we
323 -- try to perform our error checks on junk arguments.
325 Arg_Count := 0;
327 if Present (Pragma_Argument_Associations (Pragma_Node)) then
328 Arg_Node := Arg1;
329 while Arg_Node /= Empty loop
330 Arg_Count := Arg_Count + 1;
332 if Expression (Arg_Node) = Error then
333 return Error;
334 end if;
336 Next (Arg_Node);
337 end loop;
338 end if;
340 -- Remaining processing is pragma dependent
342 case Prag_Id is
344 -- Ada version pragmas must be processed at parse time, because we want
345 -- to set the Ada version properly at parse time to recognize the
346 -- appropriate Ada version syntax. However, pragma Ada_2005 and higher
347 -- have an optional argument; it is only the zero argument form that
348 -- must be processed at parse time.
350 ------------
351 -- Ada_83 --
352 ------------
354 when Pragma_Ada_83 =>
355 if not Latest_Ada_Only then
356 Ada_Version := Ada_83;
357 Ada_Version_Explicit := Ada_83;
358 Ada_Version_Pragma := Pragma_Node;
359 end if;
361 ------------
362 -- Ada_95 --
363 ------------
365 when Pragma_Ada_95 =>
366 if not Latest_Ada_Only then
367 Ada_Version := Ada_95;
368 Ada_Version_Explicit := Ada_95;
369 Ada_Version_Pragma := Pragma_Node;
370 end if;
372 ---------------------
373 -- Ada_05/Ada_2005 --
374 ---------------------
376 when Pragma_Ada_05
377 | Pragma_Ada_2005
379 if Arg_Count = 0 and not Latest_Ada_Only then
380 Ada_Version := Ada_2005;
381 Ada_Version_Explicit := Ada_2005;
382 Ada_Version_Pragma := Pragma_Node;
383 end if;
385 ---------------------
386 -- Ada_12/Ada_2012 --
387 ---------------------
389 when Pragma_Ada_12
390 | Pragma_Ada_2012
392 if Arg_Count = 0 then
393 Ada_Version := Ada_2012;
394 Ada_Version_Explicit := Ada_2012;
395 Ada_Version_Pragma := Pragma_Node;
396 end if;
398 --------------
399 -- Ada_2022 --
400 --------------
402 when Pragma_Ada_2022 =>
403 if Arg_Count = 0 then
404 Ada_Version := Ada_2022;
405 Ada_Version_Explicit := Ada_2022;
406 Ada_Version_Pragma := Pragma_Node;
407 end if;
409 -----------
410 -- Debug --
411 -----------
413 -- pragma Debug ([boolean_EXPRESSION,] PROCEDURE_CALL_STATEMENT);
415 when Pragma_Debug =>
416 Check_No_Identifier (Arg1);
418 if Arg_Count = 2 then
419 Check_No_Identifier (Arg2);
420 else
421 Check_Arg_Count (1);
422 end if;
424 -------------------------------
425 -- Extensions_Allowed (GNAT) --
426 -------------------------------
428 -- pragma Extensions_Allowed (Off | On | All)
430 -- The processing for pragma Extensions_Allowed must be done at
431 -- parse time, since extensions mode may affect what is accepted.
433 when Pragma_Extensions_Allowed =>
434 Check_Arg_Count (1);
435 Check_No_Identifier (Arg1);
436 Check_Arg_Is_On_Or_Off (Arg1, All_OK_Too => True);
438 if Chars (Expression (Arg1)) = Name_On then
439 Ada_Version := Ada_With_Core_Extensions;
440 elsif Chars (Expression (Arg1)) = Name_All then
441 Ada_Version := Ada_With_All_Extensions;
442 else
443 Ada_Version := Ada_Version_Explicit;
444 end if;
446 -------------------
447 -- Ignore_Pragma --
448 -------------------
450 -- Processing for this pragma must be done at parse time, since we want
451 -- be able to ignore pragmas that are otherwise processed at parse time.
453 when Pragma_Ignore_Pragma => Ignore_Pragma : declare
454 A : Node_Id;
456 begin
457 Check_Arg_Count (1);
458 Check_No_Identifier (Arg1);
459 A := Expression (Arg1);
461 if Nkind (A) /= N_Identifier then
462 Error_Msg_N ("incorrect argument for pragma %", A);
463 else
464 Set_Name_Table_Boolean3 (Chars (A), True);
465 end if;
466 end Ignore_Pragma;
468 ----------------
469 -- List (2.8) --
470 ----------------
472 -- pragma List (Off | On)
474 -- The processing for pragma List must be done at parse time, since a
475 -- listing can be generated in parse only mode.
477 when Pragma_List =>
478 Check_Arg_Count (1);
479 Check_No_Identifier (Arg1);
480 Check_Arg_Is_On_Or_Off (Arg1);
482 -- We unconditionally make a List_On entry for the pragma, so that
483 -- in the List (Off) case, the pragma will print even in a region
484 -- of code with listing turned off (this is required).
486 Add_List_Pragma_Entry (List_On, Sloc (Pragma_Node));
488 -- Now generate the list off entry for pragma List (Off)
490 if Chars (Expression (Arg1)) = Name_Off then
491 Add_List_Pragma_Entry (List_Off, Semi);
492 end if;
494 ----------------
495 -- Page (2.8) --
496 ----------------
498 -- pragma Page;
500 -- Processing for this pragma must be done at parse time, since a
501 -- listing can be generated in parse only mode with semantics off.
503 when Pragma_Page =>
504 Check_Arg_Count (0);
505 Add_List_Pragma_Entry (Page, Semi);
507 ------------------
508 -- Restrictions --
509 ------------------
511 -- pragma Restrictions (RESTRICTION {, RESTRICTION});
513 -- RESTRICTION ::=
514 -- restriction_IDENTIFIER
515 -- | restriction_parameter_IDENTIFIER => EXPRESSION
517 -- We process the case of No_Obsolescent_Features, since this has
518 -- a syntactic effect that we need to detect at parse time (the use
519 -- of replacement characters such as colon for pound sign).
521 when Pragma_Restrictions =>
522 Process_Restrictions_Or_Restriction_Warnings;
524 --------------------------
525 -- Restriction_Warnings --
526 --------------------------
528 -- pragma Restriction_Warnings (RESTRICTION {, RESTRICTION});
530 -- RESTRICTION ::=
531 -- restriction_IDENTIFIER
532 -- | restriction_parameter_IDENTIFIER => EXPRESSION
534 -- See above comment for pragma Restrictions
536 when Pragma_Restriction_Warnings =>
537 Process_Restrictions_Or_Restriction_Warnings;
539 ----------------------------------------------------------
540 -- Source_File_Name and Source_File_Name_Project (GNAT) --
541 ----------------------------------------------------------
543 -- These two pragmas have the same syntax and semantics.
544 -- There are five forms of these pragmas:
546 -- pragma Source_File_Name[_Project] (
547 -- [UNIT_NAME =>] unit_NAME,
548 -- BODY_FILE_NAME => STRING_LITERAL
549 -- [, [INDEX =>] INTEGER_LITERAL]);
551 -- pragma Source_File_Name[_Project] (
552 -- [UNIT_NAME =>] unit_NAME,
553 -- SPEC_FILE_NAME => STRING_LITERAL
554 -- [, [INDEX =>] INTEGER_LITERAL]);
556 -- pragma Source_File_Name[_Project] (
557 -- BODY_FILE_NAME => STRING_LITERAL
558 -- [, DOT_REPLACEMENT => STRING_LITERAL]
559 -- [, CASING => CASING_SPEC]);
561 -- pragma Source_File_Name[_Project] (
562 -- SPEC_FILE_NAME => STRING_LITERAL
563 -- [, DOT_REPLACEMENT => STRING_LITERAL]
564 -- [, CASING => CASING_SPEC]);
566 -- pragma Source_File_Name[_Project] (
567 -- SUBUNIT_FILE_NAME => STRING_LITERAL
568 -- [, DOT_REPLACEMENT => STRING_LITERAL]
569 -- [, CASING => CASING_SPEC]);
571 -- CASING_SPEC ::= Uppercase | Lowercase | Mixedcase
573 -- Pragma Source_File_Name_Project (SFNP) is equivalent to pragma
574 -- Source_File_Name (SFN), however their usage is exclusive:
575 -- SFN can only be used when no project file is used, while
576 -- SFNP can only be used when a project file is used.
578 -- The Project Manager produces a configuration pragmas file that
579 -- is communicated to the compiler with -gnatec switch. This file
580 -- contains only SFNP pragmas (at least two for the default naming
581 -- scheme. As this configuration pragmas file is always the first
582 -- processed by the compiler, it prevents the use of pragmas SFN in
583 -- other config files when a project file is in use.
585 -- Note: we process this during parsing, since we need to have the
586 -- source file names set well before the semantic analysis starts,
587 -- since we load the spec and with'ed packages before analysis.
589 when Pragma_Source_File_Name
590 | Pragma_Source_File_Name_Project
592 Source_File_Name : declare
593 Unam : Unit_Name_Type;
594 Expr1 : Node_Id;
595 Pat : String_Ptr;
596 Typ : Character;
597 Dot : String_Ptr;
598 Cas : Casing_Type;
599 Nast : Nat;
600 Expr : Node_Id;
601 Index : Nat;
603 function Get_Fname (Arg : Node_Id) return File_Name_Type;
604 -- Process file name from unit name form of pragma
606 function Get_String_Argument (Arg : Node_Id) return String_Ptr;
607 -- Process string literal value from argument
609 procedure Process_Casing (Arg : Node_Id);
610 -- Process Casing argument of pattern form of pragma
612 procedure Process_Dot_Replacement (Arg : Node_Id);
613 -- Process Dot_Replacement argument of pattern form of pragma
615 ---------------
616 -- Get_Fname --
617 ---------------
619 function Get_Fname (Arg : Node_Id) return File_Name_Type is
620 begin
621 String_To_Name_Buffer (Strval (Expression (Arg)));
623 for J in 1 .. Name_Len loop
624 if Is_Directory_Separator (Name_Buffer (J)) then
625 Error_Msg
626 ("directory separator character not allowed",
627 Sloc (Expression (Arg)) + Source_Ptr (J));
628 end if;
629 end loop;
631 return Name_Find;
632 end Get_Fname;
634 -------------------------
635 -- Get_String_Argument --
636 -------------------------
638 function Get_String_Argument (Arg : Node_Id) return String_Ptr is
639 Str : String_Id;
641 begin
642 if Nkind (Expression (Arg)) /= N_String_Literal
643 and then
644 Nkind (Expression (Arg)) /= N_Operator_Symbol
645 then
646 Error_Msg_N
647 ("argument for pragma% must be string literal", Arg);
648 raise Error_Resync;
649 end if;
651 Str := Strval (Expression (Arg));
653 -- Check string has no wide chars
655 for J in 1 .. String_Length (Str) loop
656 if Get_String_Char (Str, J) > 255 then
657 Error_Msg
658 ("wide character not allowed in pattern for pragma%",
659 Sloc (Expression (Arg2)) + Text_Ptr (J) - 1);
660 end if;
661 end loop;
663 -- Acquire string
665 String_To_Name_Buffer (Str);
666 return new String'(Name_Buffer (1 .. Name_Len));
667 end Get_String_Argument;
669 --------------------
670 -- Process_Casing --
671 --------------------
673 procedure Process_Casing (Arg : Node_Id) is
674 Expr : constant Node_Id := Expression (Arg);
676 begin
677 Check_Required_Identifier (Arg, Name_Casing);
679 if Nkind (Expr) = N_Identifier then
680 if Chars (Expr) = Name_Lowercase then
681 Cas := All_Lower_Case;
682 return;
683 elsif Chars (Expr) = Name_Uppercase then
684 Cas := All_Upper_Case;
685 return;
686 elsif Chars (Expr) = Name_Mixedcase then
687 Cas := Mixed_Case;
688 return;
689 end if;
690 end if;
692 Error_Msg_N
693 ("Casing argument for pragma% must be " &
694 "one of Mixedcase, Lowercase, Uppercase",
695 Arg);
696 end Process_Casing;
698 -----------------------------
699 -- Process_Dot_Replacement --
700 -----------------------------
702 procedure Process_Dot_Replacement (Arg : Node_Id) is
703 begin
704 Check_Required_Identifier (Arg, Name_Dot_Replacement);
705 Dot := Get_String_Argument (Arg);
706 end Process_Dot_Replacement;
708 -- Start of processing for Source_File_Name and
709 -- Source_File_Name_Project pragmas.
711 begin
712 if Prag_Id = Pragma_Source_File_Name then
713 if Project_File_In_Use = In_Use then
714 Error_Msg_N
715 ("pragma Source_File_Name cannot be used " &
716 "with a project file", Pragma_Node);
718 else
719 Project_File_In_Use := Not_In_Use;
720 end if;
722 else
723 if Project_File_In_Use = Not_In_Use then
724 Error_Msg_N
725 ("pragma Source_File_Name_Project should only be used " &
726 "with a project file", Pragma_Node);
727 else
728 Project_File_In_Use := In_Use;
729 end if;
730 end if;
732 -- We permit from 1 to 3 arguments
734 if Arg_Count not in 1 .. 3 then
735 Check_Arg_Count (1);
736 end if;
738 Expr1 := Expression (Arg1);
740 -- If first argument is identifier or selected component, then
741 -- we have the specific file case of the Source_File_Name pragma,
742 -- and the first argument is a unit name.
744 if Nkind (Expr1) = N_Identifier
745 or else
746 (Nkind (Expr1) = N_Selected_Component
747 and then
748 Nkind (Selector_Name (Expr1)) = N_Identifier)
749 then
750 if Nkind (Expr1) = N_Identifier
751 and then Chars (Expr1) = Name_System
752 then
753 Error_Msg_N
754 ("pragma Source_File_Name may not be used for System",
755 Arg1);
756 return Error;
757 end if;
759 -- Process index argument if present
761 if Arg_Count = 3 then
762 Expr := Expression (Arg3);
764 if Nkind (Expr) /= N_Integer_Literal
765 or else not UI_Is_In_Int_Range (Intval (Expr))
766 or else Intval (Expr) > 999
767 or else Intval (Expr) <= 0
768 then
769 Error_Msg_N
770 ("pragma% index must be integer literal" &
771 " in range 1 .. 999", Expr);
772 raise Error_Resync;
773 else
774 Index := UI_To_Int (Intval (Expr));
775 end if;
777 -- No index argument present
779 else
780 Check_Arg_Count (2);
781 Index := 0;
782 end if;
784 Check_Optional_Identifier (Arg1, Name_Unit_Name);
785 Unam := Get_Unit_Name (Expr1);
787 Check_Arg_Is_String_Literal (Arg2);
789 if Chars (Arg2) = Name_Spec_File_Name then
790 Set_File_Name
791 (Get_Spec_Name (Unam), Get_Fname (Arg2), Index);
793 elsif Chars (Arg2) = Name_Body_File_Name then
794 Set_File_Name
795 (Unam, Get_Fname (Arg2), Index);
797 else
798 Error_Msg_N
799 ("pragma% argument has incorrect identifier", Arg2);
800 return Pragma_Node;
801 end if;
803 -- If the first argument is not an identifier, then we must have
804 -- the pattern form of the pragma, and the first argument must be
805 -- the pattern string with an appropriate name.
807 else
808 if Chars (Arg1) = Name_Spec_File_Name then
809 Typ := 's';
811 elsif Chars (Arg1) = Name_Body_File_Name then
812 Typ := 'b';
814 elsif Chars (Arg1) = Name_Subunit_File_Name then
815 Typ := 'u';
817 elsif Chars (Arg1) = Name_Unit_Name then
818 Error_Msg_N
819 ("Unit_Name parameter for pragma% must be an identifier",
820 Arg1);
821 raise Error_Resync;
823 else
824 Error_Msg_N
825 ("pragma% argument has incorrect identifier", Arg1);
826 raise Error_Resync;
827 end if;
829 Pat := Get_String_Argument (Arg1);
831 -- Check pattern has exactly one asterisk
833 Nast := 0;
834 for J in Pat'Range loop
835 if Pat (J) = '*' then
836 Nast := Nast + 1;
837 end if;
838 end loop;
840 if Nast /= 1 then
841 Error_Msg_N
842 ("file name pattern must have exactly one * character",
843 Arg1);
844 return Pragma_Node;
845 end if;
847 -- Set defaults for Casing and Dot_Separator parameters
849 Cas := All_Lower_Case;
850 Dot := new String'(".");
852 -- Process second and third arguments if present
854 if Arg_Count > 1 then
855 if Chars (Arg2) = Name_Casing then
856 Process_Casing (Arg2);
858 if Arg_Count = 3 then
859 Process_Dot_Replacement (Arg3);
860 end if;
862 else
863 Process_Dot_Replacement (Arg2);
865 if Arg_Count = 3 then
866 Process_Casing (Arg3);
867 end if;
868 end if;
869 end if;
871 Set_File_Name_Pattern (Pat, Typ, Dot, Cas);
872 end if;
873 end Source_File_Name;
875 -----------------------------
876 -- Source_Reference (GNAT) --
877 -----------------------------
879 -- pragma Source_Reference
880 -- (INTEGER_LITERAL [, STRING_LITERAL] );
882 -- Processing for this pragma must be done at parse time, since error
883 -- messages needing the proper line numbers can be generated in parse
884 -- only mode with semantic checking turned off, and indeed we usually
885 -- turn off semantic checking anyway if any parse errors are found.
887 when Pragma_Source_Reference => Source_Reference : declare
888 Fname : File_Name_Type;
890 begin
891 if Arg_Count /= 1 then
892 Check_Arg_Count (2);
893 Check_No_Identifier (Arg2);
894 end if;
896 -- Check that this is first line of file. We skip this test if
897 -- we are in syntax check only mode, since we may be dealing with
898 -- multiple compilation units.
900 if Get_Physical_Line_Number (Pragma_Sloc) /= 1
901 and then Num_SRef_Pragmas (Current_Source_File) = 0
902 and then Operating_Mode /= Check_Syntax
903 then
904 Error_Msg_N -- CODEFIX
905 ("first % pragma must be first line of file", Pragma_Node);
906 raise Error_Resync;
907 end if;
909 Check_No_Identifier (Arg1);
911 if Arg_Count = 1 then
912 if Num_SRef_Pragmas (Current_Source_File) = 0 then
913 Error_Msg_N
914 ("file name required for first % pragma in file",
915 Pragma_Node);
916 raise Error_Resync;
917 else
918 Fname := No_File;
919 end if;
921 -- File name present
923 else
924 Check_Arg_Is_String_Literal (Arg2);
925 String_To_Name_Buffer (Strval (Expression (Arg2)));
926 Fname := Name_Find;
928 if Num_SRef_Pragmas (Current_Source_File) > 0 then
929 if Fname /= Full_Ref_Name (Current_Source_File) then
930 Error_Msg_N
931 ("file name must be same in all % pragmas", Pragma_Node);
932 raise Error_Resync;
933 end if;
934 end if;
935 end if;
937 if Nkind (Expression (Arg1)) /= N_Integer_Literal then
938 Error_Msg_N
939 ("argument for pragma% must be integer literal",
940 Expression (Arg1));
941 raise Error_Resync;
943 -- OK, this source reference pragma is effective, however, we
944 -- ignore it if it is not in the first unit in the multiple unit
945 -- case. This is because the only purpose in this case is to
946 -- provide source pragmas for subsequent use by gnatchop.
948 else
949 if Num_Library_Units = 1 then
950 Register_Source_Ref_Pragma
951 (Fname,
952 Strip_Directory (Fname),
953 UI_To_Int (Intval (Expression (Arg1))),
954 Get_Physical_Line_Number (Pragma_Sloc) + 1);
955 end if;
956 end if;
957 end Source_Reference;
959 -------------------------
960 -- Style_Checks (GNAT) --
961 -------------------------
963 -- pragma Style_Checks (On | Off | ALL_CHECKS | STRING_LITERAL);
965 -- This is processed by the parser since some of the style
966 -- checks take place during source scanning and parsing.
968 when Pragma_Style_Checks => Style_Checks : declare
969 A : Node_Id;
970 S : String_Id;
971 C : Char_Code;
972 OK : Boolean := True;
974 begin
975 -- Two argument case is only for semantics
977 if Arg_Count = 2 then
978 null;
980 else
981 Check_Arg_Count (1);
982 Check_No_Identifier (Arg1);
983 A := Expression (Arg1);
985 if Nkind (A) = N_String_Literal then
986 S := Strval (A);
988 declare
989 Slen : constant Natural := Natural (String_Length (S));
990 Options : String (1 .. Slen);
991 J : Positive;
992 Ptr : Positive;
994 begin
995 J := 1;
996 loop
997 C := Get_String_Char (S, Pos (J));
999 if not In_Character_Range (C) then
1000 OK := False;
1001 Ptr := J;
1002 exit;
1004 else
1005 Options (J) := Get_Character (C);
1006 end if;
1008 if J = Slen then
1009 if not Ignore_Style_Checks_Pragmas then
1010 Set_Style_Check_Options (Options, OK, Ptr);
1011 end if;
1013 exit;
1015 else
1016 J := J + 1;
1017 end if;
1018 end loop;
1020 if not OK then
1021 Error_Msg
1022 (Style_Msg_Buf (1 .. Style_Msg_Len),
1023 Sloc (Expression (Arg1)) + Source_Ptr (Ptr));
1024 raise Error_Resync;
1025 end if;
1026 end;
1028 elsif Nkind (A) /= N_Identifier then
1029 OK := False;
1031 elsif Chars (A) = Name_All_Checks then
1032 if not Ignore_Style_Checks_Pragmas then
1033 if GNAT_Mode then
1034 Stylesw.Set_GNAT_Style_Check_Options;
1035 else
1036 Stylesw.Set_Default_Style_Check_Options;
1037 end if;
1038 end if;
1040 elsif Chars (A) = Name_On then
1041 if not Ignore_Style_Checks_Pragmas then
1042 Style_Check := True;
1043 end if;
1045 elsif Chars (A) = Name_Off then
1046 if not Ignore_Style_Checks_Pragmas then
1047 Style_Check := False;
1048 end if;
1050 else
1051 OK := False;
1052 end if;
1054 if not OK then
1055 Error_Msg_N ("incorrect argument for pragma%", A);
1056 raise Error_Resync;
1057 end if;
1058 end if;
1059 end Style_Checks;
1061 -------------------------
1062 -- Suppress_All (GNAT) --
1063 -------------------------
1065 -- pragma Suppress_All
1067 -- This is a rather odd pragma, because other compilers allow it in
1068 -- strange places. DEC allows it at the end of units, and Rational
1069 -- allows it as a program unit pragma, when it would be more natural
1070 -- if it were a configuration pragma.
1072 -- Since the reason we provide this pragma is for compatibility with
1073 -- these other compilers, we want to accommodate these strange placement
1074 -- rules, and the easiest thing is simply to allow it anywhere in a
1075 -- unit. If this pragma appears anywhere within a unit, then the effect
1076 -- is as though a pragma Suppress (All_Checks) had appeared as the first
1077 -- line of the current file, i.e. as the first configuration pragma in
1078 -- the current unit.
1080 -- To get this effect, we set the flag Has_Pragma_Suppress_All in the
1081 -- compilation unit node for the current source file then in the last
1082 -- stage of parsing a file, if this flag is set, we materialize the
1083 -- Suppress (All_Checks) pragma, marked as not coming from Source.
1085 when Pragma_Suppress_All =>
1086 Set_Has_Pragma_Suppress_All (Cunit (Current_Source_Unit));
1088 -----------------------------------
1089 -- User_Aspect_Definition (GNAT) --
1090 -----------------------------------
1092 -- pragma User_Aspect_Definition
1093 -- (Identifier, {, Identifier [(Identifier {, Identifier})]});
1095 when Pragma_User_Aspect_Definition =>
1096 if Arg_Count < 1 then
1097 Check_Arg_Count (1);
1098 end if;
1099 declare
1100 OK : Boolean := True;
1101 Expr : Node_Id;
1103 function All_Identifiers (L : List_Id) return Boolean;
1104 -- Return True if every list element has Nkind = N_Identifier.
1106 ---------------------
1107 -- All_Identifiers --
1108 ---------------------
1109 function All_Identifiers (L : List_Id) return Boolean is
1110 N : Node_Id := First (L);
1111 begin
1112 while Present (N) loop
1113 if Nkind (N) /= N_Identifier then
1114 return False;
1115 end if;
1116 Next (N);
1117 end loop;
1118 return True;
1119 end All_Identifiers;
1121 begin
1122 Arg_Node := Arg1;
1123 while Present (Arg_Node) and OK loop
1124 Check_No_Identifier (Arg_Node);
1125 Expr := Expression (Arg_Node);
1126 case Nkind (Expr) is
1127 when N_Identifier =>
1128 OK := True;
1129 when N_Indexed_Component =>
1130 OK := Arg_Node /= Arg1 -- first arg must be identifier
1131 and then Nkind (Prefix (Expr)) = N_Identifier
1132 and then All_Identifiers (Expressions (Expr));
1133 when others =>
1134 OK := False;
1135 end case;
1136 Next (Arg_Node);
1137 end loop;
1138 if not OK then
1139 Error_Msg_N ("incorrect argument for pragma%", Arg_Node);
1140 raise Error_Resync;
1141 end if;
1142 end;
1144 ----------------------
1145 -- Warning_As_Error --
1146 ----------------------
1148 -- pragma Warning_As_Error (static_string_EXPRESSION);
1150 -- Further processing is done in Sem_Prag
1152 when Pragma_Warning_As_Error =>
1153 Check_Arg_Count (1);
1154 Check_Arg_Is_String_Literal (Arg1);
1155 Warnings_As_Errors_Count := Warnings_As_Errors_Count + 1;
1156 Warnings_As_Errors (Warnings_As_Errors_Count) :=
1157 new String'(Acquire_Warning_Match_String (Get_Pragma_Arg (Arg1)));
1159 ---------------------
1160 -- Warnings (GNAT) --
1161 ---------------------
1163 -- pragma Warnings ([TOOL_NAME,] DETAILS [, REASON]);
1165 -- DETAILS ::= On | Off
1166 -- DETAILS ::= On | Off, local_NAME
1167 -- DETAILS ::= static_string_EXPRESSION
1168 -- DETAILS ::= On | Off, static_string_EXPRESSION
1170 -- TOOL_NAME ::= GNAT | GNATprove
1172 -- REASON ::= Reason => STRING_LITERAL {& STRING_LITERAL}
1174 -- Note: If the first argument matches an allowed tool name, it is
1175 -- always considered to be a tool name, even if there is a string
1176 -- variable of that name.
1178 -- The one argument ON/OFF case is processed by the parser, since it may
1179 -- control parser warnings as well as semantic warnings, and in any case
1180 -- we want to be absolutely sure that the range in the warnings table is
1181 -- set well before any semantic analysis is performed. Note that we
1182 -- ignore this pragma if debug flag -gnatd.i is set.
1184 -- Also note that the "one argument" case may have two or three
1185 -- arguments if the first one is a tool name, and/or the last one is a
1186 -- reason argument.
1188 when Pragma_Warnings => Warnings : declare
1189 function First_Arg_Is_Matching_Tool_Name return Boolean;
1190 -- Returns True if the first argument is a tool name matching the
1191 -- current tool being run.
1193 function Last_Arg return Node_Id;
1194 -- Returns the last argument
1196 function Last_Arg_Is_Reason return Boolean;
1197 -- Returns True if the last argument is a reason argument
1199 function Get_Reason return String_Id;
1200 -- Analyzes Reason argument and returns corresponding String_Id
1201 -- value, or null if there is no Reason argument, or if the
1202 -- argument is not of the required form.
1204 -------------------------------------
1205 -- First_Arg_Is_Matching_Tool_Name --
1206 -------------------------------------
1208 function First_Arg_Is_Matching_Tool_Name return Boolean is
1209 Expr : constant Node_Id := Get_Pragma_Arg (Arg1);
1210 begin
1211 return Nkind (Expr) = N_Identifier
1213 -- Return True if the tool name is GNAT, and we're not in
1214 -- GNATprove or CodePeer mode...
1216 and then ((Chars (Expr) = Name_Gnat
1217 and then not
1218 (CodePeer_Mode or GNATprove_Mode))
1220 -- or if the tool name is GNATprove, and we're in GNATprove
1221 -- mode.
1223 or else
1224 (Chars (Expr) = Name_Gnatprove
1225 and then GNATprove_Mode));
1226 end First_Arg_Is_Matching_Tool_Name;
1228 ----------------
1229 -- Get_Reason --
1230 ----------------
1232 function Get_Reason return String_Id is
1233 Arg : constant Node_Id := Last_Arg;
1234 begin
1235 if Last_Arg_Is_Reason then
1236 Start_String;
1237 Get_Reason_String (Expression (Arg));
1238 return End_String;
1239 else
1240 return Null_String_Id;
1241 end if;
1242 end Get_Reason;
1244 --------------
1245 -- Last_Arg --
1246 --------------
1248 function Last_Arg return Node_Id is
1249 Last_Arg : Node_Id;
1251 begin
1252 if Arg_Count = 1 then
1253 Last_Arg := Arg1;
1254 elsif Arg_Count = 2 then
1255 Last_Arg := Arg2;
1256 elsif Arg_Count = 3 then
1257 Last_Arg := Arg3;
1258 elsif Arg_Count = 4 then
1259 Last_Arg := Next (Arg3);
1261 -- Illegal case, error issued in semantic analysis
1263 else
1264 Last_Arg := Empty;
1265 end if;
1267 return Last_Arg;
1268 end Last_Arg;
1270 ------------------------
1271 -- Last_Arg_Is_Reason --
1272 ------------------------
1274 function Last_Arg_Is_Reason return Boolean is
1275 Arg : constant Node_Id := Last_Arg;
1276 begin
1277 return Nkind (Arg) in N_Has_Chars
1278 and then Chars (Arg) = Name_Reason;
1279 end Last_Arg_Is_Reason;
1281 The_Arg : Node_Id; -- On/Off argument
1282 Argx : Node_Id;
1284 -- Start of processing for Warnings
1286 begin
1287 if not Debug_Flag_Dot_I
1288 and then (Arg_Count = 1
1289 or else (Arg_Count = 2
1290 and then (First_Arg_Is_Matching_Tool_Name
1291 or else
1292 Last_Arg_Is_Reason))
1293 or else (Arg_Count = 3
1294 and then First_Arg_Is_Matching_Tool_Name
1295 and then Last_Arg_Is_Reason))
1296 then
1297 if First_Arg_Is_Matching_Tool_Name then
1298 The_Arg := Arg2;
1299 else
1300 The_Arg := Arg1;
1301 end if;
1303 Check_No_Identifier (The_Arg);
1304 Argx := Expression (The_Arg);
1306 if Nkind (Argx) = N_Identifier then
1307 if Chars (Argx) = Name_On then
1308 Set_Warnings_Mode_On (Pragma_Sloc);
1309 elsif Chars (Argx) = Name_Off then
1310 Set_Warnings_Mode_Off (Pragma_Sloc, Get_Reason);
1311 end if;
1312 end if;
1313 end if;
1314 end Warnings;
1316 -----------------------------
1317 -- Wide_Character_Encoding --
1318 -----------------------------
1320 -- pragma Wide_Character_Encoding (IDENTIFIER | CHARACTER_LITERAL);
1322 -- This is processed by the parser, since the scanner is affected
1324 when Pragma_Wide_Character_Encoding => Wide_Character_Encoding : declare
1325 A : Node_Id;
1327 begin
1328 Check_Arg_Count (1);
1329 Check_No_Identifier (Arg1);
1330 A := Expression (Arg1);
1332 if Nkind (A) = N_Identifier then
1333 Get_Name_String (Chars (A));
1334 Wide_Character_Encoding_Method :=
1335 Get_WC_Encoding_Method (Name_Buffer (1 .. Name_Len));
1337 elsif Nkind (A) = N_Character_Literal then
1338 declare
1339 R : constant Char_Code := UI_To_CC (Char_Literal_Value (A));
1340 begin
1341 if In_Character_Range (R) then
1342 Wide_Character_Encoding_Method :=
1343 Get_WC_Encoding_Method (Get_Character (R));
1344 else
1345 raise Constraint_Error;
1346 end if;
1347 end;
1349 else
1350 raise Constraint_Error;
1351 end if;
1353 Upper_Half_Encoding :=
1354 Wide_Character_Encoding_Method in
1355 WC_Upper_Half_Encoding_Method;
1357 exception
1358 when Constraint_Error =>
1359 Error_Msg_N ("invalid argument for pragma%", Arg1);
1360 end Wide_Character_Encoding;
1362 -----------------------
1363 -- All Other Pragmas --
1364 -----------------------
1366 -- For all other pragmas, checking and processing is handled entirely in
1367 -- Sem_Prag, and no further checking is done by Par.
1369 when Pragma_Abort_Defer
1370 | Pragma_Abstract_State
1371 | Pragma_Aggregate_Individually_Assign
1372 | Pragma_All_Calls_Remote
1373 | Pragma_Allow_Integer_Address
1374 | Pragma_Always_Terminates
1375 | Pragma_Annotate
1376 | Pragma_Assert
1377 | Pragma_Assert_And_Cut
1378 | Pragma_Assertion_Policy
1379 | Pragma_Assume
1380 | Pragma_Assume_No_Invalid_Values
1381 | Pragma_Async_Readers
1382 | Pragma_Async_Writers
1383 | Pragma_Asynchronous
1384 | Pragma_Atomic
1385 | Pragma_Atomic_Components
1386 | Pragma_Attach_Handler
1387 | Pragma_Attribute_Definition
1388 | Pragma_CPP_Class
1389 | Pragma_CPP_Constructor
1390 | Pragma_CPP_Virtual
1391 | Pragma_CPP_Vtable
1392 | Pragma_CPU
1393 | Pragma_CUDA_Device
1394 | Pragma_CUDA_Execute
1395 | Pragma_CUDA_Global
1396 | Pragma_C_Pass_By_Copy
1397 | Pragma_Check
1398 | Pragma_Check_Float_Overflow
1399 | Pragma_Check_Name
1400 | Pragma_Check_Policy
1401 | Pragma_Comment
1402 | Pragma_Common_Object
1403 | Pragma_Compile_Time_Error
1404 | Pragma_Compile_Time_Warning
1405 | Pragma_Complete_Representation
1406 | Pragma_Complex_Representation
1407 | Pragma_Component_Alignment
1408 | Pragma_Constant_After_Elaboration
1409 | Pragma_Contract_Cases
1410 | Pragma_Controlled
1411 | Pragma_Convention
1412 | Pragma_Convention_Identifier
1413 | Pragma_Deadline_Floor
1414 | Pragma_Debug_Policy
1415 | Pragma_Default_Initial_Condition
1416 | Pragma_Default_Scalar_Storage_Order
1417 | Pragma_Default_Storage_Pool
1418 | Pragma_Depends
1419 | Pragma_Detect_Blocking
1420 | Pragma_Disable_Atomic_Synchronization
1421 | Pragma_Discard_Names
1422 | Pragma_Dispatching_Domain
1423 | Pragma_Effective_Reads
1424 | Pragma_Effective_Writes
1425 | Pragma_Elaborate
1426 | Pragma_Elaborate_All
1427 | Pragma_Elaborate_Body
1428 | Pragma_Elaboration_Checks
1429 | Pragma_Eliminate
1430 | Pragma_Enable_Atomic_Synchronization
1431 | Pragma_Exceptional_Cases
1432 | Pragma_Export
1433 | Pragma_Export_Function
1434 | Pragma_Export_Object
1435 | Pragma_Export_Procedure
1436 | Pragma_Export_Valued_Procedure
1437 | Pragma_Extend_System
1438 | Pragma_Extensions_Visible
1439 | Pragma_External
1440 | Pragma_External_Name_Casing
1441 | Pragma_Fast_Math
1442 | Pragma_Favor_Top_Level
1443 | Pragma_Finalize_Storage_Only
1444 | Pragma_Ghost
1445 | Pragma_Global
1446 | Pragma_GNAT_Annotate
1447 | Pragma_Ident
1448 | Pragma_Implementation_Defined
1449 | Pragma_Implemented
1450 | Pragma_Implicit_Packing
1451 | Pragma_Import
1452 | Pragma_Import_Function
1453 | Pragma_Import_Object
1454 | Pragma_Import_Procedure
1455 | Pragma_Import_Valued_Procedure
1456 | Pragma_Independent
1457 | Pragma_Independent_Components
1458 | Pragma_Initial_Condition
1459 | Pragma_Initialize_Scalars
1460 | Pragma_Initializes
1461 | Pragma_Inline
1462 | Pragma_Inline_Always
1463 | Pragma_Inline_Generic
1464 | Pragma_Inspection_Point
1465 | Pragma_Interface
1466 | Pragma_Interface_Name
1467 | Pragma_Interrupt_Handler
1468 | Pragma_Interrupt_Priority
1469 | Pragma_Interrupt_State
1470 | Pragma_Invariant
1471 | Pragma_Keep_Names
1472 | Pragma_License
1473 | Pragma_Link_With
1474 | Pragma_Linker_Alias
1475 | Pragma_Linker_Constructor
1476 | Pragma_Linker_Destructor
1477 | Pragma_Linker_Options
1478 | Pragma_Linker_Section
1479 | Pragma_Lock_Free
1480 | Pragma_Locking_Policy
1481 | Pragma_Loop_Invariant
1482 | Pragma_Loop_Optimize
1483 | Pragma_Loop_Variant
1484 | Pragma_Machine_Attribute
1485 | Pragma_Main
1486 | Pragma_Main_Storage
1487 | Pragma_Max_Entry_Queue_Depth
1488 | Pragma_Max_Entry_Queue_Length
1489 | Pragma_Max_Queue_Length
1490 | Pragma_Memory_Size
1491 | Pragma_No_Body
1492 | Pragma_No_Caching
1493 | Pragma_No_Component_Reordering
1494 | Pragma_No_Elaboration_Code_All
1495 | Pragma_No_Heap_Finalization
1496 | Pragma_No_Inline
1497 | Pragma_No_Return
1498 | Pragma_No_Run_Time
1499 | Pragma_No_Strict_Aliasing
1500 | Pragma_No_Tagged_Streams
1501 | Pragma_Normalize_Scalars
1502 | Pragma_Obsolescent
1503 | Pragma_Optimize
1504 | Pragma_Optimize_Alignment
1505 | Pragma_Ordered
1506 | Pragma_Overflow_Mode
1507 | Pragma_Overriding_Renamings
1508 | Pragma_Pack
1509 | Pragma_Part_Of
1510 | Pragma_Partition_Elaboration_Policy
1511 | Pragma_Passive
1512 | Pragma_Persistent_BSS
1513 | Pragma_Post
1514 | Pragma_Post_Class
1515 | Pragma_Postcondition
1516 | Pragma_Pre
1517 | Pragma_Pre_Class
1518 | Pragma_Precondition
1519 | Pragma_Predicate
1520 | Pragma_Predicate_Failure
1521 | Pragma_Preelaborable_Initialization
1522 | Pragma_Preelaborate
1523 | Pragma_Prefix_Exception_Messages
1524 | Pragma_Priority
1525 | Pragma_Priority_Specific_Dispatching
1526 | Pragma_Profile
1527 | Pragma_Profile_Warnings
1528 | Pragma_Propagate_Exceptions
1529 | Pragma_Provide_Shift_Operators
1530 | Pragma_Psect_Object
1531 | Pragma_Pure
1532 | Pragma_Pure_Function
1533 | Pragma_Queuing_Policy
1534 | Pragma_Rational
1535 | Pragma_Ravenscar
1536 | Pragma_Refined_Depends
1537 | Pragma_Refined_Global
1538 | Pragma_Refined_Post
1539 | Pragma_Refined_State
1540 | Pragma_Relative_Deadline
1541 | Pragma_Remote_Access_Type
1542 | Pragma_Remote_Call_Interface
1543 | Pragma_Remote_Types
1544 | Pragma_Rename_Pragma
1545 | Pragma_Restricted_Run_Time
1546 | Pragma_Reviewable
1547 | Pragma_Side_Effects
1548 | Pragma_SPARK_Mode
1549 | Pragma_Secondary_Stack_Size
1550 | Pragma_Share_Generic
1551 | Pragma_Shared
1552 | Pragma_Shared_Passive
1553 | Pragma_Short_Circuit_And_Or
1554 | Pragma_Short_Descriptors
1555 | Pragma_Simple_Storage_Pool_Type
1556 | Pragma_Static_Elaboration_Desired
1557 | Pragma_Storage_Size
1558 | Pragma_Storage_Unit
1559 | Pragma_Stream_Convert
1560 | Pragma_Subtitle
1561 | Pragma_Subprogram_Variant
1562 | Pragma_Suppress
1563 | Pragma_Suppress_Debug_Info
1564 | Pragma_Suppress_Exception_Locations
1565 | Pragma_Suppress_Initialization
1566 | Pragma_System_Name
1567 | Pragma_Task_Dispatching_Policy
1568 | Pragma_Task_Info
1569 | Pragma_Task_Name
1570 | Pragma_Task_Storage
1571 | Pragma_Test_Case
1572 | Pragma_Thread_Local_Storage
1573 | Pragma_Time_Slice
1574 | Pragma_Title
1575 | Pragma_Type_Invariant
1576 | Pragma_Type_Invariant_Class
1577 | Pragma_Unchecked_Union
1578 | Pragma_Unevaluated_Use_Of_Old
1579 | Pragma_Unimplemented_Unit
1580 | Pragma_Universal_Aliasing
1581 | Pragma_Unmodified
1582 | Pragma_Unreferenced
1583 | Pragma_Unreferenced_Objects
1584 | Pragma_Unreserve_All_Interrupts
1585 | Pragma_Unsuppress
1586 | Pragma_Unused
1587 | Pragma_Use_VADS_Size
1588 | Pragma_Validity_Checks
1589 | Pragma_Volatile
1590 | Pragma_Volatile_Components
1591 | Pragma_Volatile_Full_Access
1592 | Pragma_Volatile_Function
1593 | Pragma_Weak_External
1595 null;
1597 --------------------
1598 -- Unknown_Pragma --
1599 --------------------
1601 -- Should be impossible, since we excluded this case earlier on
1603 when Unknown_Pragma =>
1604 raise Program_Error;
1606 end case;
1608 return Pragma_Node;
1610 --------------------
1611 -- Error Handling --
1612 --------------------
1614 exception
1615 when Error_Resync =>
1616 return Error;
1618 end Prag;