Debian Codegraph @

gcc/ada/par-prag.adb

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