match: Fix comment for `X != 0 ? X + ~0 : 0` transformation
[official-gcc.git] / gcc / ada / par-prag.adb
blob1a2a7b6b77bea7a23959fd1f91653df4a5a8053d
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_Extensions_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_Extensions_OK_Too is
81 -- True, then an ALL_EXTENSIONS 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_Extensions_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_Extensions_OK_Too
181 and then Chars (Argx) = Name_All_Extensions);
182 end if;
183 if Error then
184 Error_Msg_Name_2 := Name_On;
185 Error_Msg_Name_3 := Name_Off;
187 if All_Extensions_OK_Too then
188 Error_Msg_Name_4 := Name_All_Extensions;
189 Error_Msg_N ("argument for pragma% must be% or% or%", Argx);
190 else
191 Error_Msg_N ("argument for pragma% must be% or%", Argx);
192 end if;
193 raise Error_Resync;
194 end if;
195 end Check_Arg_Is_On_Or_Off;
197 ---------------------------------
198 -- Check_Arg_Is_String_Literal --
199 ---------------------------------
201 procedure Check_Arg_Is_String_Literal (Arg : Node_Id) is
202 begin
203 if Nkind (Expression (Arg)) /= N_String_Literal then
204 Error_Msg_N
205 ("argument for pragma% must be string literal",
206 Expression (Arg));
207 raise Error_Resync;
208 end if;
209 end Check_Arg_Is_String_Literal;
211 -------------------------
212 -- Check_No_Identifier --
213 -------------------------
215 procedure Check_No_Identifier (Arg : Node_Id) is
216 begin
217 if Chars (Arg) /= No_Name then
218 Error_Msg_N ("pragma% does not permit named arguments", Arg);
219 raise Error_Resync;
220 end if;
221 end Check_No_Identifier;
223 -------------------------------
224 -- Check_Optional_Identifier --
225 -------------------------------
227 procedure Check_Optional_Identifier (Arg : Node_Id; Id : Name_Id) is
228 begin
229 if Present (Arg) and then Chars (Arg) /= No_Name then
230 if Chars (Arg) /= Id then
231 Error_Msg_Name_2 := Id;
232 Error_Msg_N ("pragma% argument expects identifier%", Arg);
233 end if;
234 end if;
235 end Check_Optional_Identifier;
237 -------------------------------
238 -- Check_Required_Identifier --
239 -------------------------------
241 procedure Check_Required_Identifier (Arg : Node_Id; Id : Name_Id) is
242 begin
243 if Chars (Arg) /= Id then
244 Error_Msg_Name_2 := Id;
245 Error_Msg_N ("pragma% argument must have identifier%", Arg);
246 end if;
247 end Check_Required_Identifier;
249 --------------------------------------------------
250 -- Process_Restrictions_Or_Restriction_Warnings --
251 --------------------------------------------------
253 procedure Process_Restrictions_Or_Restriction_Warnings is
254 Arg : Node_Id;
255 Id : Name_Id;
256 Expr : Node_Id;
258 begin
259 Arg := Arg1;
260 while Present (Arg) loop
261 Id := Chars (Arg);
262 Expr := Expression (Arg);
264 if Id = No_Name and then Nkind (Expr) = N_Identifier then
265 case Chars (Expr) is
266 when Name_No_Obsolescent_Features =>
267 Set_Restriction (No_Obsolescent_Features, Pragma_Node);
268 Restriction_Warnings (No_Obsolescent_Features) :=
269 Prag_Id = Pragma_Restriction_Warnings;
271 when Name_SPARK_05 =>
272 Error_Msg_Name_1 := Chars (Expr);
273 Error_Msg_N
274 ("??% restriction is obsolete and ignored, consider " &
275 "using 'S'P'A'R'K_'Mode and gnatprove instead", Arg);
277 when Name_No_Unrecognized_Aspects =>
278 Set_Restriction
279 (No_Unrecognized_Aspects,
280 Pragma_Node,
281 Prag_Id = Pragma_Restriction_Warnings);
283 when others =>
284 null;
285 end case;
287 elsif Id = Name_No_Dependence then
288 Set_Restriction_No_Dependence
289 (Unit => Expr,
290 Warn => Prag_Id = Pragma_Restriction_Warnings
291 or else Treat_Restrictions_As_Warnings);
292 end if;
294 Next (Arg);
295 end loop;
296 end Process_Restrictions_Or_Restriction_Warnings;
298 -- Start of processing for Prag
300 begin
301 Error_Msg_Name_1 := Prag_Name;
303 -- Ignore unrecognized pragma. We let Sem post the warning for this, since
304 -- it is a semantic error, not a syntactic one (we have already checked
305 -- the syntax for the unrecognized pragma as required by (RM 2.8(11)).
307 if Prag_Id = Unknown_Pragma then
308 return Pragma_Node;
309 end if;
311 -- Ignore pragma if Ignore_Pragma applies. Also ignore pragma
312 -- Default_Scalar_Storage_Order if the -gnatI switch was given.
314 if Should_Ignore_Pragma_Par (Prag_Name)
315 or else (Prag_Id = Pragma_Default_Scalar_Storage_Order
316 and then Ignore_Rep_Clauses)
317 then
318 return Pragma_Node;
319 end if;
321 -- Count number of arguments. This loop also checks if any of the arguments
322 -- are Error, indicating a syntax error as they were parsed. If so, we
323 -- simply return, because we get into trouble with cascaded errors if we
324 -- try to perform our error checks on junk arguments.
326 Arg_Count := 0;
328 if Present (Pragma_Argument_Associations (Pragma_Node)) then
329 Arg_Node := Arg1;
330 while Arg_Node /= Empty loop
331 Arg_Count := Arg_Count + 1;
333 if Expression (Arg_Node) = Error then
334 return Error;
335 end if;
337 Next (Arg_Node);
338 end loop;
339 end if;
341 -- Remaining processing is pragma dependent
343 case Prag_Id is
345 -- Ada version pragmas must be processed at parse time, because we want
346 -- to set the Ada version properly at parse time to recognize the
347 -- appropriate Ada version syntax. However, pragma Ada_2005 and higher
348 -- have an optional argument; it is only the zero argument form that
349 -- must be processed at parse time.
351 ------------
352 -- Ada_83 --
353 ------------
355 when Pragma_Ada_83 =>
356 if not Latest_Ada_Only then
357 Ada_Version := Ada_83;
358 Ada_Version_Explicit := Ada_83;
359 Ada_Version_Pragma := Pragma_Node;
360 end if;
362 ------------
363 -- Ada_95 --
364 ------------
366 when Pragma_Ada_95 =>
367 if not Latest_Ada_Only then
368 Ada_Version := Ada_95;
369 Ada_Version_Explicit := Ada_95;
370 Ada_Version_Pragma := Pragma_Node;
371 end if;
373 ---------------------
374 -- Ada_05/Ada_2005 --
375 ---------------------
377 when Pragma_Ada_05
378 | Pragma_Ada_2005
380 if Arg_Count = 0 and not Latest_Ada_Only then
381 Ada_Version := Ada_2005;
382 Ada_Version_Explicit := Ada_2005;
383 Ada_Version_Pragma := Pragma_Node;
384 end if;
386 ---------------------
387 -- Ada_12/Ada_2012 --
388 ---------------------
390 when Pragma_Ada_12
391 | Pragma_Ada_2012
393 if Arg_Count = 0 then
394 Ada_Version := Ada_2012;
395 Ada_Version_Explicit := Ada_2012;
396 Ada_Version_Pragma := Pragma_Node;
397 end if;
399 --------------
400 -- Ada_2022 --
401 --------------
403 when Pragma_Ada_2022 =>
404 if Arg_Count = 0 then
405 Ada_Version := Ada_2022;
406 Ada_Version_Explicit := Ada_2022;
407 Ada_Version_Pragma := Pragma_Node;
408 end if;
410 -----------
411 -- Debug --
412 -----------
414 -- pragma Debug ([boolean_EXPRESSION,] PROCEDURE_CALL_STATEMENT);
416 when Pragma_Debug =>
417 Check_No_Identifier (Arg1);
419 if Arg_Count = 2 then
420 Check_No_Identifier (Arg2);
421 else
422 Check_Arg_Count (1);
423 end if;
425 -------------------------------
426 -- Extensions_Allowed (GNAT) --
427 -------------------------------
429 -- pragma Extensions_Allowed (Off | On | All)
431 -- The processing for pragma Extensions_Allowed must be done at
432 -- parse time, since extensions mode may affect what is accepted.
434 when Pragma_Extensions_Allowed =>
435 Check_Arg_Count (1);
436 Check_No_Identifier (Arg1);
437 Check_Arg_Is_On_Or_Off (Arg1, All_Extensions_OK_Too => True);
439 if Chars (Expression (Arg1)) = Name_On then
440 Ada_Version := Ada_With_Core_Extensions;
441 elsif Chars (Expression (Arg1)) = Name_All_Extensions then
442 Ada_Version := Ada_With_All_Extensions;
443 else
444 Ada_Version := Ada_Version_Explicit;
445 end if;
447 -------------------
448 -- Ignore_Pragma --
449 -------------------
451 -- Processing for this pragma must be done at parse time, since we want
452 -- be able to ignore pragmas that are otherwise processed at parse time.
454 when Pragma_Ignore_Pragma => Ignore_Pragma : declare
455 A : Node_Id;
457 begin
458 Check_Arg_Count (1);
459 Check_No_Identifier (Arg1);
460 A := Expression (Arg1);
462 if Nkind (A) /= N_Identifier then
463 Error_Msg_N ("incorrect argument for pragma %", A);
464 else
465 Set_Name_Table_Boolean3 (Chars (A), True);
466 end if;
467 end Ignore_Pragma;
469 ----------------
470 -- List (2.8) --
471 ----------------
473 -- pragma List (Off | On)
475 -- The processing for pragma List must be done at parse time, since a
476 -- listing can be generated in parse only mode.
478 when Pragma_List =>
479 Check_Arg_Count (1);
480 Check_No_Identifier (Arg1);
481 Check_Arg_Is_On_Or_Off (Arg1);
483 -- We unconditionally make a List_On entry for the pragma, so that
484 -- in the List (Off) case, the pragma will print even in a region
485 -- of code with listing turned off (this is required).
487 Add_List_Pragma_Entry (List_On, Sloc (Pragma_Node));
489 -- Now generate the list off entry for pragma List (Off)
491 if Chars (Expression (Arg1)) = Name_Off then
492 Add_List_Pragma_Entry (List_Off, Semi);
493 end if;
495 ----------------
496 -- Page (2.8) --
497 ----------------
499 -- pragma Page;
501 -- Processing for this pragma must be done at parse time, since a
502 -- listing can be generated in parse only mode with semantics off.
504 when Pragma_Page =>
505 Check_Arg_Count (0);
506 Add_List_Pragma_Entry (Page, Semi);
508 ------------------
509 -- Restrictions --
510 ------------------
512 -- pragma Restrictions (RESTRICTION {, RESTRICTION});
514 -- RESTRICTION ::=
515 -- restriction_IDENTIFIER
516 -- | restriction_parameter_IDENTIFIER => EXPRESSION
518 -- We process the case of No_Obsolescent_Features, since this has
519 -- a syntactic effect that we need to detect at parse time (the use
520 -- of replacement characters such as colon for pound sign).
522 when Pragma_Restrictions =>
523 Process_Restrictions_Or_Restriction_Warnings;
525 --------------------------
526 -- Restriction_Warnings --
527 --------------------------
529 -- pragma Restriction_Warnings (RESTRICTION {, RESTRICTION});
531 -- RESTRICTION ::=
532 -- restriction_IDENTIFIER
533 -- | restriction_parameter_IDENTIFIER => EXPRESSION
535 -- See above comment for pragma Restrictions
537 when Pragma_Restriction_Warnings =>
538 Process_Restrictions_Or_Restriction_Warnings;
540 ----------------------------------------------------------
541 -- Source_File_Name and Source_File_Name_Project (GNAT) --
542 ----------------------------------------------------------
544 -- These two pragmas have the same syntax and semantics.
545 -- There are five forms of these pragmas:
547 -- pragma Source_File_Name[_Project] (
548 -- [UNIT_NAME =>] unit_NAME,
549 -- BODY_FILE_NAME => STRING_LITERAL
550 -- [, [INDEX =>] INTEGER_LITERAL]);
552 -- pragma Source_File_Name[_Project] (
553 -- [UNIT_NAME =>] unit_NAME,
554 -- SPEC_FILE_NAME => STRING_LITERAL
555 -- [, [INDEX =>] INTEGER_LITERAL]);
557 -- pragma Source_File_Name[_Project] (
558 -- BODY_FILE_NAME => STRING_LITERAL
559 -- [, DOT_REPLACEMENT => STRING_LITERAL]
560 -- [, CASING => CASING_SPEC]);
562 -- pragma Source_File_Name[_Project] (
563 -- SPEC_FILE_NAME => STRING_LITERAL
564 -- [, DOT_REPLACEMENT => STRING_LITERAL]
565 -- [, CASING => CASING_SPEC]);
567 -- pragma Source_File_Name[_Project] (
568 -- SUBUNIT_FILE_NAME => STRING_LITERAL
569 -- [, DOT_REPLACEMENT => STRING_LITERAL]
570 -- [, CASING => CASING_SPEC]);
572 -- CASING_SPEC ::= Uppercase | Lowercase | Mixedcase
574 -- Pragma Source_File_Name_Project (SFNP) is equivalent to pragma
575 -- Source_File_Name (SFN), however their usage is exclusive:
576 -- SFN can only be used when no project file is used, while
577 -- SFNP can only be used when a project file is used.
579 -- The Project Manager produces a configuration pragmas file that
580 -- is communicated to the compiler with -gnatec switch. This file
581 -- contains only SFNP pragmas (at least two for the default naming
582 -- scheme. As this configuration pragmas file is always the first
583 -- processed by the compiler, it prevents the use of pragmas SFN in
584 -- other config files when a project file is in use.
586 -- Note: we process this during parsing, since we need to have the
587 -- source file names set well before the semantic analysis starts,
588 -- since we load the spec and with'ed packages before analysis.
590 when Pragma_Source_File_Name
591 | Pragma_Source_File_Name_Project
593 if Debug_Flag_Underscore_MM then
594 -- -gnatd_M is causes the compiler to ignore source file name
595 -- pragmas. It's used for reduced reproducer generation.
596 return Pragma_Node;
597 end if;
599 Source_File_Name : declare
600 Unam : Unit_Name_Type;
601 Expr1 : Node_Id;
602 Pat : String_Ptr;
603 Typ : Character;
604 Dot : String_Ptr;
605 Cas : Casing_Type;
606 Nast : Nat;
607 Expr : Node_Id;
608 Index : Nat;
610 function Get_Fname (Arg : Node_Id) return File_Name_Type;
611 -- Process file name from unit name form of pragma
613 function Get_String_Argument (Arg : Node_Id) return String_Ptr;
614 -- Process string literal value from argument
616 procedure Process_Casing (Arg : Node_Id);
617 -- Process Casing argument of pattern form of pragma
619 procedure Process_Dot_Replacement (Arg : Node_Id);
620 -- Process Dot_Replacement argument of pattern form of pragma
622 ---------------
623 -- Get_Fname --
624 ---------------
626 function Get_Fname (Arg : Node_Id) return File_Name_Type is
627 begin
628 String_To_Name_Buffer (Strval (Expression (Arg)));
630 for J in 1 .. Name_Len loop
631 if Is_Directory_Separator (Name_Buffer (J)) then
632 Error_Msg
633 ("directory separator character not allowed",
634 Sloc (Expression (Arg)) + Source_Ptr (J));
635 end if;
636 end loop;
638 return Name_Find;
639 end Get_Fname;
641 -------------------------
642 -- Get_String_Argument --
643 -------------------------
645 function Get_String_Argument (Arg : Node_Id) return String_Ptr is
646 Str : String_Id;
648 begin
649 if Nkind (Expression (Arg)) /= N_String_Literal
650 and then
651 Nkind (Expression (Arg)) /= N_Operator_Symbol
652 then
653 Error_Msg_N
654 ("argument for pragma% must be string literal", Arg);
655 raise Error_Resync;
656 end if;
658 Str := Strval (Expression (Arg));
660 -- Check string has no wide chars
662 for J in 1 .. String_Length (Str) loop
663 if Get_String_Char (Str, J) > 255 then
664 Error_Msg
665 ("wide character not allowed in pattern for pragma%",
666 Sloc (Expression (Arg2)) + Text_Ptr (J) - 1);
667 end if;
668 end loop;
670 -- Acquire string
672 String_To_Name_Buffer (Str);
673 return new String'(Name_Buffer (1 .. Name_Len));
674 end Get_String_Argument;
676 --------------------
677 -- Process_Casing --
678 --------------------
680 procedure Process_Casing (Arg : Node_Id) is
681 Expr : constant Node_Id := Expression (Arg);
683 begin
684 Check_Required_Identifier (Arg, Name_Casing);
686 if Nkind (Expr) = N_Identifier then
687 if Chars (Expr) = Name_Lowercase then
688 Cas := All_Lower_Case;
689 return;
690 elsif Chars (Expr) = Name_Uppercase then
691 Cas := All_Upper_Case;
692 return;
693 elsif Chars (Expr) = Name_Mixedcase then
694 Cas := Mixed_Case;
695 return;
696 end if;
697 end if;
699 Error_Msg_N
700 ("Casing argument for pragma% must be " &
701 "one of Mixedcase, Lowercase, Uppercase",
702 Arg);
703 end Process_Casing;
705 -----------------------------
706 -- Process_Dot_Replacement --
707 -----------------------------
709 procedure Process_Dot_Replacement (Arg : Node_Id) is
710 begin
711 Check_Required_Identifier (Arg, Name_Dot_Replacement);
712 Dot := Get_String_Argument (Arg);
713 end Process_Dot_Replacement;
715 -- Start of processing for Source_File_Name and
716 -- Source_File_Name_Project pragmas.
718 begin
719 if Prag_Id = Pragma_Source_File_Name then
720 if Project_File_In_Use = In_Use then
721 Error_Msg_N
722 ("pragma Source_File_Name cannot be used " &
723 "with a project file", Pragma_Node);
725 else
726 Project_File_In_Use := Not_In_Use;
727 end if;
729 else
730 if Project_File_In_Use = Not_In_Use then
731 Error_Msg_N
732 ("pragma Source_File_Name_Project should only be used " &
733 "with a project file", Pragma_Node);
734 else
735 Project_File_In_Use := In_Use;
736 end if;
737 end if;
739 -- We permit from 1 to 3 arguments
741 if Arg_Count not in 1 .. 3 then
742 Check_Arg_Count (1);
743 end if;
745 Expr1 := Expression (Arg1);
747 -- If first argument is identifier or selected component, then
748 -- we have the specific file case of the Source_File_Name pragma,
749 -- and the first argument is a unit name.
751 if Nkind (Expr1) = N_Identifier
752 or else
753 (Nkind (Expr1) = N_Selected_Component
754 and then
755 Nkind (Selector_Name (Expr1)) = N_Identifier)
756 then
757 if Nkind (Expr1) = N_Identifier
758 and then Chars (Expr1) = Name_System
759 then
760 Error_Msg_N
761 ("pragma Source_File_Name may not be used for System",
762 Arg1);
763 return Error;
764 end if;
766 -- Process index argument if present
768 if Arg_Count = 3 then
769 Expr := Expression (Arg3);
771 if Nkind (Expr) /= N_Integer_Literal
772 or else not UI_Is_In_Int_Range (Intval (Expr))
773 or else Intval (Expr) > 999
774 or else Intval (Expr) <= 0
775 then
776 Error_Msg_N
777 ("pragma% index must be integer literal" &
778 " in range 1 .. 999", Expr);
779 raise Error_Resync;
780 else
781 Index := UI_To_Int (Intval (Expr));
782 end if;
784 -- No index argument present
786 else
787 Check_Arg_Count (2);
788 Index := 0;
789 end if;
791 Check_Optional_Identifier (Arg1, Name_Unit_Name);
792 Unam := Get_Unit_Name (Expr1);
794 Check_Arg_Is_String_Literal (Arg2);
796 if Chars (Arg2) = Name_Spec_File_Name then
797 Set_File_Name
798 (Get_Spec_Name (Unam), Get_Fname (Arg2), Index);
800 elsif Chars (Arg2) = Name_Body_File_Name then
801 Set_File_Name
802 (Unam, Get_Fname (Arg2), Index);
804 else
805 Error_Msg_N
806 ("pragma% argument has incorrect identifier", Arg2);
807 return Pragma_Node;
808 end if;
810 -- If the first argument is not an identifier, then we must have
811 -- the pattern form of the pragma, and the first argument must be
812 -- the pattern string with an appropriate name.
814 else
815 if Chars (Arg1) = Name_Spec_File_Name then
816 Typ := 's';
818 elsif Chars (Arg1) = Name_Body_File_Name then
819 Typ := 'b';
821 elsif Chars (Arg1) = Name_Subunit_File_Name then
822 Typ := 'u';
824 elsif Chars (Arg1) = Name_Unit_Name then
825 Error_Msg_N
826 ("Unit_Name parameter for pragma% must be an identifier",
827 Arg1);
828 raise Error_Resync;
830 else
831 Error_Msg_N
832 ("pragma% argument has incorrect identifier", Arg1);
833 raise Error_Resync;
834 end if;
836 Pat := Get_String_Argument (Arg1);
838 -- Check pattern has exactly one asterisk
840 Nast := 0;
841 for J in Pat'Range loop
842 if Pat (J) = '*' then
843 Nast := Nast + 1;
844 end if;
845 end loop;
847 if Nast /= 1 then
848 Error_Msg_N
849 ("file name pattern must have exactly one * character",
850 Arg1);
851 return Pragma_Node;
852 end if;
854 -- Set defaults for Casing and Dot_Separator parameters
856 Cas := All_Lower_Case;
857 Dot := new String'(".");
859 -- Process second and third arguments if present
861 if Arg_Count > 1 then
862 if Chars (Arg2) = Name_Casing then
863 Process_Casing (Arg2);
865 if Arg_Count = 3 then
866 Process_Dot_Replacement (Arg3);
867 end if;
869 else
870 Process_Dot_Replacement (Arg2);
872 if Arg_Count = 3 then
873 Process_Casing (Arg3);
874 end if;
875 end if;
876 end if;
878 Set_File_Name_Pattern (Pat, Typ, Dot, Cas);
879 end if;
880 end Source_File_Name;
882 -----------------------------
883 -- Source_Reference (GNAT) --
884 -----------------------------
886 -- pragma Source_Reference
887 -- (INTEGER_LITERAL [, STRING_LITERAL] );
889 -- Processing for this pragma must be done at parse time, since error
890 -- messages needing the proper line numbers can be generated in parse
891 -- only mode with semantic checking turned off, and indeed we usually
892 -- turn off semantic checking anyway if any parse errors are found.
894 when Pragma_Source_Reference => Source_Reference : declare
895 Fname : File_Name_Type;
897 begin
898 if Arg_Count /= 1 then
899 Check_Arg_Count (2);
900 Check_No_Identifier (Arg2);
901 end if;
903 -- Check that this is first line of file. We skip this test if
904 -- we are in syntax check only mode, since we may be dealing with
905 -- multiple compilation units.
907 if Get_Physical_Line_Number (Pragma_Sloc) /= 1
908 and then Num_SRef_Pragmas (Current_Source_File) = 0
909 and then Operating_Mode /= Check_Syntax
910 then
911 Error_Msg_N -- CODEFIX
912 ("first % pragma must be first line of file", Pragma_Node);
913 raise Error_Resync;
914 end if;
916 Check_No_Identifier (Arg1);
918 if Arg_Count = 1 then
919 if Num_SRef_Pragmas (Current_Source_File) = 0 then
920 Error_Msg_N
921 ("file name required for first % pragma in file",
922 Pragma_Node);
923 raise Error_Resync;
924 else
925 Fname := No_File;
926 end if;
928 -- File name present
930 else
931 Check_Arg_Is_String_Literal (Arg2);
932 String_To_Name_Buffer (Strval (Expression (Arg2)));
933 Fname := Name_Find;
935 if Num_SRef_Pragmas (Current_Source_File) > 0 then
936 if Fname /= Full_Ref_Name (Current_Source_File) then
937 Error_Msg_N
938 ("file name must be same in all % pragmas", Pragma_Node);
939 raise Error_Resync;
940 end if;
941 end if;
942 end if;
944 if Nkind (Expression (Arg1)) /= N_Integer_Literal then
945 Error_Msg_N
946 ("argument for pragma% must be integer literal",
947 Expression (Arg1));
948 raise Error_Resync;
950 -- OK, this source reference pragma is effective, however, we
951 -- ignore it if it is not in the first unit in the multiple unit
952 -- case. This is because the only purpose in this case is to
953 -- provide source pragmas for subsequent use by gnatchop.
955 else
956 if Num_Library_Units = 1 then
957 Register_Source_Ref_Pragma
958 (Fname,
959 Strip_Directory (Fname),
960 UI_To_Int (Intval (Expression (Arg1))),
961 Get_Physical_Line_Number (Pragma_Sloc) + 1);
962 end if;
963 end if;
964 end Source_Reference;
966 -------------------------
967 -- Style_Checks (GNAT) --
968 -------------------------
970 -- pragma Style_Checks (On | Off | ALL_CHECKS | STRING_LITERAL);
972 -- This is processed by the parser since some of the style
973 -- checks take place during source scanning and parsing.
975 when Pragma_Style_Checks => Style_Checks : declare
976 A : Node_Id;
977 S : String_Id;
978 C : Char_Code;
979 OK : Boolean := True;
981 begin
982 -- Two argument case is only for semantics
984 if Arg_Count = 2 then
985 null;
987 else
988 Check_Arg_Count (1);
989 Check_No_Identifier (Arg1);
990 A := Expression (Arg1);
992 if Nkind (A) = N_String_Literal then
993 S := Strval (A);
995 declare
996 Slen : constant Natural := Natural (String_Length (S));
997 Options : String (1 .. Slen);
998 J : Positive;
999 Ptr : Positive;
1001 begin
1002 J := 1;
1003 loop
1004 C := Get_String_Char (S, Pos (J));
1006 if not In_Character_Range (C) then
1007 OK := False;
1008 Ptr := J;
1009 exit;
1011 else
1012 Options (J) := Get_Character (C);
1013 end if;
1015 if J = Slen then
1016 if not Ignore_Style_Checks_Pragmas then
1017 Set_Style_Check_Options (Options, OK, Ptr);
1018 end if;
1020 exit;
1022 else
1023 J := J + 1;
1024 end if;
1025 end loop;
1027 if not OK then
1028 Error_Msg
1029 (Style_Msg_Buf (1 .. Style_Msg_Len),
1030 Sloc (Expression (Arg1)) + Source_Ptr (Ptr));
1031 raise Error_Resync;
1032 end if;
1033 end;
1035 elsif Nkind (A) /= N_Identifier then
1036 OK := False;
1038 elsif Chars (A) = Name_All_Checks then
1039 if not Ignore_Style_Checks_Pragmas then
1040 if GNAT_Mode then
1041 Stylesw.Set_GNAT_Style_Check_Options;
1042 else
1043 Stylesw.Set_Default_Style_Check_Options;
1044 end if;
1045 end if;
1047 elsif Chars (A) = Name_On then
1048 if not Ignore_Style_Checks_Pragmas then
1049 Style_Check := True;
1050 end if;
1052 elsif Chars (A) = Name_Off then
1053 if not Ignore_Style_Checks_Pragmas then
1054 Style_Check := False;
1055 end if;
1057 else
1058 OK := False;
1059 end if;
1061 if not OK then
1062 Error_Msg_N ("incorrect argument for pragma%", A);
1063 raise Error_Resync;
1064 end if;
1065 end if;
1066 end Style_Checks;
1068 -------------------------
1069 -- Suppress_All (GNAT) --
1070 -------------------------
1072 -- pragma Suppress_All
1074 -- This is a rather odd pragma, because other compilers allow it in
1075 -- strange places. DEC allows it at the end of units, and Rational
1076 -- allows it as a program unit pragma, when it would be more natural
1077 -- if it were a configuration pragma.
1079 -- Since the reason we provide this pragma is for compatibility with
1080 -- these other compilers, we want to accommodate these strange placement
1081 -- rules, and the easiest thing is simply to allow it anywhere in a
1082 -- unit. If this pragma appears anywhere within a unit, then the effect
1083 -- is as though a pragma Suppress (All_Checks) had appeared as the first
1084 -- line of the current file, i.e. as the first configuration pragma in
1085 -- the current unit.
1087 -- To get this effect, we set the flag Has_Pragma_Suppress_All in the
1088 -- compilation unit node for the current source file then in the last
1089 -- stage of parsing a file, if this flag is set, we materialize the
1090 -- Suppress (All_Checks) pragma, marked as not coming from Source.
1092 when Pragma_Suppress_All =>
1093 Set_Has_Pragma_Suppress_All (Cunit (Current_Source_Unit));
1095 -----------------------------------
1096 -- User_Aspect_Definition (GNAT) --
1097 -----------------------------------
1099 -- pragma User_Aspect_Definition
1100 -- (Identifier, {, Identifier [(Identifier {, Identifier})]});
1102 when Pragma_User_Aspect_Definition =>
1103 if Arg_Count < 1 then
1104 Check_Arg_Count (1);
1105 end if;
1106 declare
1107 OK : Boolean := True;
1108 Expr : Node_Id;
1110 function All_Identifiers (L : List_Id) return Boolean;
1111 -- Return True if every list element has Nkind = N_Identifier.
1113 ---------------------
1114 -- All_Identifiers --
1115 ---------------------
1116 function All_Identifiers (L : List_Id) return Boolean is
1117 N : Node_Id := First (L);
1118 begin
1119 while Present (N) loop
1120 if Nkind (N) /= N_Identifier then
1121 return False;
1122 end if;
1123 Next (N);
1124 end loop;
1125 return True;
1126 end All_Identifiers;
1128 begin
1129 Arg_Node := Arg1;
1130 while Present (Arg_Node) and OK loop
1131 Check_No_Identifier (Arg_Node);
1132 Expr := Expression (Arg_Node);
1133 case Nkind (Expr) is
1134 when N_Identifier =>
1135 OK := True;
1136 when N_Indexed_Component =>
1137 OK := Arg_Node /= Arg1 -- first arg must be identifier
1138 and then Nkind (Prefix (Expr)) = N_Identifier
1139 and then All_Identifiers (Expressions (Expr));
1140 when others =>
1141 OK := False;
1142 end case;
1143 Next (Arg_Node);
1144 end loop;
1145 if not OK then
1146 Error_Msg_N ("incorrect argument for pragma%", Arg_Node);
1147 raise Error_Resync;
1148 end if;
1149 end;
1151 ----------------------
1152 -- Warning_As_Error --
1153 ----------------------
1155 -- pragma Warning_As_Error (static_string_EXPRESSION);
1157 -- Further processing is done in Sem_Prag
1159 when Pragma_Warning_As_Error =>
1160 Check_Arg_Count (1);
1161 Check_Arg_Is_String_Literal (Arg1);
1162 Warnings_As_Errors_Count := Warnings_As_Errors_Count + 1;
1163 Warnings_As_Errors (Warnings_As_Errors_Count) :=
1164 new String'(Acquire_Warning_Match_String (Get_Pragma_Arg (Arg1)));
1166 ---------------------
1167 -- Warnings (GNAT) --
1168 ---------------------
1170 -- pragma Warnings ([TOOL_NAME,] DETAILS [, REASON]);
1172 -- DETAILS ::= On | Off
1173 -- DETAILS ::= On | Off, local_NAME
1174 -- DETAILS ::= static_string_EXPRESSION
1175 -- DETAILS ::= On | Off, static_string_EXPRESSION
1177 -- TOOL_NAME ::= GNAT | GNATprove
1179 -- REASON ::= Reason => STRING_LITERAL {& STRING_LITERAL}
1181 -- Note: If the first argument matches an allowed tool name, it is
1182 -- always considered to be a tool name, even if there is a string
1183 -- variable of that name.
1185 -- The one argument ON/OFF case is processed by the parser, since it may
1186 -- control parser warnings as well as semantic warnings, and in any case
1187 -- we want to be absolutely sure that the range in the warnings table is
1188 -- set well before any semantic analysis is performed. Note that we
1189 -- ignore this pragma if debug flag -gnatd.i is set.
1191 -- Also note that the "one argument" case may have two or three
1192 -- arguments if the first one is a tool name, and/or the last one is a
1193 -- reason argument.
1195 when Pragma_Warnings => Warnings : declare
1196 function First_Arg_Is_Matching_Tool_Name return Boolean;
1197 -- Returns True if the first argument is a tool name matching the
1198 -- current tool being run.
1200 function Last_Arg return Node_Id;
1201 -- Returns the last argument
1203 function Last_Arg_Is_Reason return Boolean;
1204 -- Returns True if the last argument is a reason argument
1206 function Get_Reason return String_Id;
1207 -- Analyzes Reason argument and returns corresponding String_Id
1208 -- value, or null if there is no Reason argument, or if the
1209 -- argument is not of the required form.
1211 -------------------------------------
1212 -- First_Arg_Is_Matching_Tool_Name --
1213 -------------------------------------
1215 function First_Arg_Is_Matching_Tool_Name return Boolean is
1216 Expr : constant Node_Id := Get_Pragma_Arg (Arg1);
1217 begin
1218 return Nkind (Expr) = N_Identifier
1220 -- Return True if the tool name is GNAT, and we're not in
1221 -- GNATprove or CodePeer mode...
1223 and then ((Chars (Expr) = Name_Gnat
1224 and then not
1225 (CodePeer_Mode or GNATprove_Mode))
1227 -- or if the tool name is GNATprove, and we're in GNATprove
1228 -- mode.
1230 or else
1231 (Chars (Expr) = Name_Gnatprove
1232 and then GNATprove_Mode));
1233 end First_Arg_Is_Matching_Tool_Name;
1235 ----------------
1236 -- Get_Reason --
1237 ----------------
1239 function Get_Reason return String_Id is
1240 Arg : constant Node_Id := Last_Arg;
1241 begin
1242 if Last_Arg_Is_Reason then
1243 Start_String;
1244 Get_Reason_String (Expression (Arg));
1245 return End_String;
1246 else
1247 return Null_String_Id;
1248 end if;
1249 end Get_Reason;
1251 --------------
1252 -- Last_Arg --
1253 --------------
1255 function Last_Arg return Node_Id is
1256 Last_Arg : Node_Id;
1258 begin
1259 if Arg_Count = 1 then
1260 Last_Arg := Arg1;
1261 elsif Arg_Count = 2 then
1262 Last_Arg := Arg2;
1263 elsif Arg_Count = 3 then
1264 Last_Arg := Arg3;
1265 elsif Arg_Count = 4 then
1266 Last_Arg := Next (Arg3);
1268 -- Illegal case, error issued in semantic analysis
1270 else
1271 Last_Arg := Empty;
1272 end if;
1274 return Last_Arg;
1275 end Last_Arg;
1277 ------------------------
1278 -- Last_Arg_Is_Reason --
1279 ------------------------
1281 function Last_Arg_Is_Reason return Boolean is
1282 Arg : constant Node_Id := Last_Arg;
1283 begin
1284 return Nkind (Arg) in N_Has_Chars
1285 and then Chars (Arg) = Name_Reason;
1286 end Last_Arg_Is_Reason;
1288 The_Arg : Node_Id; -- On/Off argument
1289 Argx : Node_Id;
1291 -- Start of processing for Warnings
1293 begin
1294 if not Debug_Flag_Dot_I
1295 and then (Arg_Count = 1
1296 or else (Arg_Count = 2
1297 and then (First_Arg_Is_Matching_Tool_Name
1298 or else
1299 Last_Arg_Is_Reason))
1300 or else (Arg_Count = 3
1301 and then First_Arg_Is_Matching_Tool_Name
1302 and then Last_Arg_Is_Reason))
1303 then
1304 if First_Arg_Is_Matching_Tool_Name then
1305 The_Arg := Arg2;
1306 else
1307 The_Arg := Arg1;
1308 end if;
1310 Check_No_Identifier (The_Arg);
1311 Argx := Expression (The_Arg);
1313 if Nkind (Argx) = N_Identifier then
1314 if Chars (Argx) = Name_On then
1315 Set_Warnings_Mode_On (Pragma_Sloc);
1316 elsif Chars (Argx) = Name_Off then
1317 Set_Warnings_Mode_Off (Pragma_Sloc, Get_Reason);
1318 end if;
1319 end if;
1320 end if;
1321 end Warnings;
1323 -----------------------------
1324 -- Wide_Character_Encoding --
1325 -----------------------------
1327 -- pragma Wide_Character_Encoding (IDENTIFIER | CHARACTER_LITERAL);
1329 -- This is processed by the parser, since the scanner is affected
1331 when Pragma_Wide_Character_Encoding => Wide_Character_Encoding : declare
1332 A : Node_Id;
1334 begin
1335 Check_Arg_Count (1);
1336 Check_No_Identifier (Arg1);
1337 A := Expression (Arg1);
1339 if Nkind (A) = N_Identifier then
1340 Get_Name_String (Chars (A));
1341 Wide_Character_Encoding_Method :=
1342 Get_WC_Encoding_Method (Name_Buffer (1 .. Name_Len));
1344 elsif Nkind (A) = N_Character_Literal then
1345 declare
1346 R : constant Char_Code := UI_To_CC (Char_Literal_Value (A));
1347 begin
1348 if In_Character_Range (R) then
1349 Wide_Character_Encoding_Method :=
1350 Get_WC_Encoding_Method (Get_Character (R));
1351 else
1352 raise Constraint_Error;
1353 end if;
1354 end;
1356 else
1357 raise Constraint_Error;
1358 end if;
1360 Upper_Half_Encoding :=
1361 Wide_Character_Encoding_Method in
1362 WC_Upper_Half_Encoding_Method;
1364 exception
1365 when Constraint_Error =>
1366 Error_Msg_N ("invalid argument for pragma%", Arg1);
1367 end Wide_Character_Encoding;
1369 -----------------------
1370 -- All Other Pragmas --
1371 -----------------------
1373 -- For all other pragmas, checking and processing is handled entirely in
1374 -- Sem_Prag, and no further checking is done by Par.
1376 when Pragma_Abort_Defer
1377 | Pragma_Abstract_State
1378 | Pragma_Aggregate_Individually_Assign
1379 | Pragma_All_Calls_Remote
1380 | Pragma_Allow_Integer_Address
1381 | Pragma_Always_Terminates
1382 | Pragma_Annotate
1383 | Pragma_Assert
1384 | Pragma_Assert_And_Cut
1385 | Pragma_Assertion_Policy
1386 | Pragma_Assume
1387 | Pragma_Assume_No_Invalid_Values
1388 | Pragma_Async_Readers
1389 | Pragma_Async_Writers
1390 | Pragma_Asynchronous
1391 | Pragma_Atomic
1392 | Pragma_Atomic_Components
1393 | Pragma_Attach_Handler
1394 | Pragma_Attribute_Definition
1395 | Pragma_CPP_Class
1396 | Pragma_CPP_Constructor
1397 | Pragma_CPP_Virtual
1398 | Pragma_CPP_Vtable
1399 | Pragma_CPU
1400 | Pragma_CUDA_Device
1401 | Pragma_CUDA_Execute
1402 | Pragma_CUDA_Global
1403 | Pragma_C_Pass_By_Copy
1404 | Pragma_Check
1405 | Pragma_Check_Float_Overflow
1406 | Pragma_Check_Name
1407 | Pragma_Check_Policy
1408 | Pragma_Comment
1409 | Pragma_Common_Object
1410 | Pragma_Compile_Time_Error
1411 | Pragma_Compile_Time_Warning
1412 | Pragma_Complete_Representation
1413 | Pragma_Complex_Representation
1414 | Pragma_Component_Alignment
1415 | Pragma_Constant_After_Elaboration
1416 | Pragma_Contract_Cases
1417 | Pragma_Controlled
1418 | Pragma_Convention
1419 | Pragma_Convention_Identifier
1420 | Pragma_Deadline_Floor
1421 | Pragma_Debug_Policy
1422 | Pragma_Default_Initial_Condition
1423 | Pragma_Default_Scalar_Storage_Order
1424 | Pragma_Default_Storage_Pool
1425 | Pragma_Depends
1426 | Pragma_Detect_Blocking
1427 | Pragma_Disable_Atomic_Synchronization
1428 | Pragma_Discard_Names
1429 | Pragma_Dispatching_Domain
1430 | Pragma_Effective_Reads
1431 | Pragma_Effective_Writes
1432 | Pragma_Elaborate
1433 | Pragma_Elaborate_All
1434 | Pragma_Elaborate_Body
1435 | Pragma_Elaboration_Checks
1436 | Pragma_Eliminate
1437 | Pragma_Enable_Atomic_Synchronization
1438 | Pragma_Exceptional_Cases
1439 | Pragma_Export
1440 | Pragma_Export_Function
1441 | Pragma_Export_Object
1442 | Pragma_Export_Procedure
1443 | Pragma_Export_Valued_Procedure
1444 | Pragma_Extend_System
1445 | Pragma_Extended_Access
1446 | Pragma_Extensions_Visible
1447 | Pragma_External
1448 | Pragma_External_Name_Casing
1449 | Pragma_Fast_Math
1450 | Pragma_Favor_Top_Level
1451 | Pragma_Finalize_Storage_Only
1452 | Pragma_First_Controlling_Parameter
1453 | Pragma_Ghost
1454 | Pragma_Global
1455 | Pragma_GNAT_Annotate
1456 | Pragma_Ident
1457 | Pragma_Implementation_Defined
1458 | Pragma_Implemented
1459 | Pragma_Implicit_Packing
1460 | Pragma_Import
1461 | Pragma_Import_Function
1462 | Pragma_Import_Object
1463 | Pragma_Import_Procedure
1464 | Pragma_Import_Valued_Procedure
1465 | Pragma_Independent
1466 | Pragma_Independent_Components
1467 | Pragma_Initial_Condition
1468 | Pragma_Initialize_Scalars
1469 | Pragma_Initializes
1470 | Pragma_Inline
1471 | Pragma_Inline_Always
1472 | Pragma_Inline_Generic
1473 | Pragma_Inspection_Point
1474 | Pragma_Interface
1475 | Pragma_Interface_Name
1476 | Pragma_Interrupt_Handler
1477 | Pragma_Interrupt_Priority
1478 | Pragma_Interrupt_State
1479 | Pragma_Invariant
1480 | Pragma_Keep_Names
1481 | Pragma_License
1482 | Pragma_Link_With
1483 | Pragma_Linker_Alias
1484 | Pragma_Linker_Constructor
1485 | Pragma_Linker_Destructor
1486 | Pragma_Linker_Options
1487 | Pragma_Linker_Section
1488 | Pragma_Lock_Free
1489 | Pragma_Locking_Policy
1490 | Pragma_Loop_Invariant
1491 | Pragma_Loop_Optimize
1492 | Pragma_Loop_Variant
1493 | Pragma_Machine_Attribute
1494 | Pragma_Main
1495 | Pragma_Main_Storage
1496 | Pragma_Max_Entry_Queue_Length
1497 | Pragma_Max_Queue_Length
1498 | Pragma_Memory_Size
1499 | Pragma_No_Body
1500 | Pragma_No_Caching
1501 | Pragma_No_Component_Reordering
1502 | Pragma_No_Elaboration_Code_All
1503 | Pragma_No_Heap_Finalization
1504 | Pragma_No_Inline
1505 | Pragma_No_Raise
1506 | Pragma_No_Return
1507 | Pragma_No_Run_Time
1508 | Pragma_Interrupts_System_By_Default
1509 | Pragma_No_Strict_Aliasing
1510 | Pragma_No_Tagged_Streams
1511 | Pragma_Normalize_Scalars
1512 | Pragma_Obsolescent
1513 | Pragma_Optimize
1514 | Pragma_Optimize_Alignment
1515 | Pragma_Ordered
1516 | Pragma_Overflow_Mode
1517 | Pragma_Overriding_Renamings
1518 | Pragma_Pack
1519 | Pragma_Part_Of
1520 | Pragma_Partition_Elaboration_Policy
1521 | Pragma_Passive
1522 | Pragma_Persistent_BSS
1523 | Pragma_Post
1524 | Pragma_Post_Class
1525 | Pragma_Postcondition
1526 | Pragma_Pre
1527 | Pragma_Pre_Class
1528 | Pragma_Precondition
1529 | Pragma_Predicate
1530 | Pragma_Predicate_Failure
1531 | Pragma_Preelaborable_Initialization
1532 | Pragma_Preelaborate
1533 | Pragma_Prefix_Exception_Messages
1534 | Pragma_Priority
1535 | Pragma_Priority_Specific_Dispatching
1536 | Pragma_Profile
1537 | Pragma_Profile_Warnings
1538 | Pragma_Propagate_Exceptions
1539 | Pragma_Provide_Shift_Operators
1540 | Pragma_Psect_Object
1541 | Pragma_Pure
1542 | Pragma_Pure_Function
1543 | Pragma_Queuing_Policy
1544 | Pragma_Rational
1545 | Pragma_Ravenscar
1546 | Pragma_Refined_Depends
1547 | Pragma_Refined_Global
1548 | Pragma_Refined_Post
1549 | Pragma_Refined_State
1550 | Pragma_Relative_Deadline
1551 | Pragma_Remote_Access_Type
1552 | Pragma_Remote_Call_Interface
1553 | Pragma_Remote_Types
1554 | Pragma_Rename_Pragma
1555 | Pragma_Restricted_Run_Time
1556 | Pragma_Reviewable
1557 | Pragma_Side_Effects
1558 | Pragma_SPARK_Mode
1559 | Pragma_Secondary_Stack_Size
1560 | Pragma_Share_Generic
1561 | Pragma_Shared
1562 | Pragma_Shared_Passive
1563 | Pragma_Short_Circuit_And_Or
1564 | Pragma_Short_Descriptors
1565 | Pragma_Simple_Storage_Pool_Type
1566 | Pragma_Simulate_Internal_Error
1567 | Pragma_Static_Elaboration_Desired
1568 | Pragma_Storage_Size
1569 | Pragma_Storage_Unit
1570 | Pragma_Stream_Convert
1571 | Pragma_Subtitle
1572 | Pragma_Subprogram_Variant
1573 | Pragma_Suppress
1574 | Pragma_Suppress_Debug_Info
1575 | Pragma_Suppress_Exception_Locations
1576 | Pragma_Suppress_Initialization
1577 | Pragma_System_Name
1578 | Pragma_Task_Dispatching_Policy
1579 | Pragma_Task_Info
1580 | Pragma_Task_Name
1581 | Pragma_Task_Storage
1582 | Pragma_Test_Case
1583 | Pragma_Thread_Local_Storage
1584 | Pragma_Time_Slice
1585 | Pragma_Title
1586 | Pragma_Type_Invariant
1587 | Pragma_Type_Invariant_Class
1588 | Pragma_Unchecked_Union
1589 | Pragma_Unevaluated_Use_Of_Old
1590 | Pragma_Unimplemented_Unit
1591 | Pragma_Universal_Aliasing
1592 | Pragma_Unmodified
1593 | Pragma_Unreferenced
1594 | Pragma_Unreferenced_Objects
1595 | Pragma_Unreserve_All_Interrupts
1596 | Pragma_Unsuppress
1597 | Pragma_Unused
1598 | Pragma_Use_VADS_Size
1599 | Pragma_Validity_Checks
1600 | Pragma_Volatile
1601 | Pragma_Volatile_Components
1602 | Pragma_Volatile_Full_Access
1603 | Pragma_Volatile_Function
1604 | Pragma_Weak_External
1606 null;
1608 --------------------
1609 -- Unknown_Pragma --
1610 --------------------
1612 -- Should be impossible, since we excluded this case earlier on
1614 when Unknown_Pragma =>
1615 raise Program_Error;
1617 end case;
1619 return Pragma_Node;
1621 --------------------
1622 -- Error Handling --
1623 --------------------
1625 exception
1626 when Error_Resync =>
1627 return Error;
1629 end Prag;