2006-06-30 Andrew Pinski <pinskia@gmail.com>
[official-gcc.git] / gcc / ada / switch-c.adb
blob1428aa79f638c9fe2450953f22cb3a10d41043c2
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S W I T C H - C --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 2001-2006, 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 2, 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 COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
21 -- --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 -- --
25 ------------------------------------------------------------------------------
27 with GNAT.OS_Lib; use GNAT.OS_Lib;
29 with Debug; use Debug;
30 with Lib; use Lib;
31 with Osint; use Osint;
32 with Opt; use Opt;
33 with Prepcomp; use Prepcomp;
34 with Validsw; use Validsw;
35 with Sem_Warn; use Sem_Warn;
36 with Stylesw; use Stylesw;
38 with System.WCh_Con; use System.WCh_Con;
40 package body Switch.C is
42 RTS_Specified : String_Access := null;
43 -- Used to detect multiple use of --RTS= flag
45 -----------------------------
46 -- Scan_Front_End_Switches --
47 -----------------------------
49 procedure Scan_Front_End_Switches (Switch_Chars : String) is
50 Switch_Starts_With_Gnat : Boolean;
51 -- True if first four switch characters are "gnat"
53 First_Switch : Boolean := True;
54 -- False for all but first switch
56 Ptr : Integer := Switch_Chars'First;
57 Max : constant Integer := Switch_Chars'Last;
58 C : Character := ' ';
59 Dot : Boolean;
61 Store_Switch : Boolean := True;
62 First_Char : Integer := Ptr;
63 Storing : String := Switch_Chars;
64 First_Stored : Positive := Ptr + 1;
65 -- The above need comments ???
67 begin
68 -- Skip past the initial character (must be the switch character)
70 if Ptr = Max then
71 Bad_Switch (C);
72 else
73 Ptr := Ptr + 1;
74 end if;
76 -- Remove "gnat" from the switch, if present
78 Switch_Starts_With_Gnat :=
79 Ptr + 3 <= Max and then Switch_Chars (Ptr .. Ptr + 3) = "gnat";
81 if Switch_Starts_With_Gnat then
82 Ptr := Ptr + 4;
83 First_Stored := Ptr;
84 end if;
86 -- Loop to scan through switches given in switch string
88 while Ptr <= Max loop
89 Store_Switch := True;
90 First_Char := Ptr;
91 C := Switch_Chars (Ptr);
93 -- Processing for a switch
95 case Switch_Starts_With_Gnat is
97 when False =>
99 -- There are few front-end switches that
100 -- do not start with -gnat: -I, --RTS
102 if Switch_Chars (Ptr) = 'I' then
103 Store_Switch := False;
105 -- Set flag Search_Directory_Present if switch is "-I" only:
106 -- the directory will be the next argument.
108 if Ptr = Max then
109 Search_Directory_Present := True;
110 return;
111 end if;
113 Ptr := Ptr + 1;
115 -- Find out whether this is a -I- or regular -Ixxx switch
117 if Ptr = Max and then Switch_Chars (Ptr) = '-' then
118 Look_In_Primary_Dir := False;
120 else
121 Add_Src_Search_Dir (Switch_Chars (Ptr .. Max));
122 end if;
124 Ptr := Max + 1;
126 -- Processing of the --RTS switch. --RTS has been modified by
127 -- gcc and is now of the form -fRTS
129 elsif Ptr + 3 <= Max
130 and then Switch_Chars (Ptr .. Ptr + 3) = "fRTS"
131 then
132 Ptr := Ptr + 1;
134 if Ptr + 4 > Max
135 or else Switch_Chars (Ptr + 3) /= '='
136 then
137 Osint.Fail ("missing path for --RTS");
138 else
139 -- Check that this is the first time --RTS is specified
140 -- or if it is not the first time, the same path has
141 -- been specified.
143 if RTS_Specified = null then
144 RTS_Specified :=
145 new String'(Switch_Chars (Ptr + 4 .. Max));
147 elsif
148 RTS_Specified.all /= Switch_Chars (Ptr + 4 .. Max)
149 then
150 Osint.Fail
151 ("--RTS cannot be specified multiple times");
152 end if;
154 -- Valid --RTS switch
156 Opt.No_Stdinc := True;
157 Opt.RTS_Switch := True;
159 RTS_Src_Path_Name := Get_RTS_Search_Dir
160 (Switch_Chars (Ptr + 4 .. Max),
161 Include);
162 RTS_Lib_Path_Name := Get_RTS_Search_Dir
163 (Switch_Chars (Ptr + 4 .. Max),
164 Objects);
166 if RTS_Src_Path_Name /= null and then
167 RTS_Lib_Path_Name /= null
168 then
169 Ptr := Max + 1;
171 elsif RTS_Src_Path_Name = null and then
172 RTS_Lib_Path_Name = null
173 then
174 Osint.Fail ("RTS path not valid: missing " &
175 "adainclude and adalib directories");
177 elsif RTS_Src_Path_Name = null then
178 Osint.Fail ("RTS path not valid: missing " &
179 "adainclude directory");
181 elsif RTS_Lib_Path_Name = null then
182 Osint.Fail ("RTS path not valid: missing " &
183 "adalib directory");
184 end if;
185 end if;
186 else
187 Bad_Switch (C);
188 end if;
190 when True =>
192 -- Process -gnat* options
194 case C is
196 when 'a' =>
197 Ptr := Ptr + 1;
198 Assertions_Enabled := True;
199 Debug_Pragmas_Enabled := True;
201 -- Processing for A switch
203 when 'A' =>
204 Ptr := Ptr + 1;
205 Config_File := False;
207 -- Processing for b switch
209 when 'b' =>
210 Ptr := Ptr + 1;
211 Brief_Output := True;
213 -- Processing for c switch
215 when 'c' =>
216 if not First_Switch then
217 Osint.Fail
218 ("-gnatc must be first if combined with other switches");
219 end if;
221 Ptr := Ptr + 1;
222 Operating_Mode := Check_Semantics;
224 if Tree_Output then
225 ASIS_Mode := True;
226 end if;
228 -- Processing for d switch
230 when 'd' =>
231 Store_Switch := False;
232 Storing (First_Stored) := 'd';
233 Dot := False;
235 -- Note: for the debug switch, the remaining characters in this
236 -- switch field must all be debug flags, since all valid switch
237 -- characters are also valid debug characters.
239 -- Loop to scan out debug flags
241 while Ptr < Max loop
242 Ptr := Ptr + 1;
243 C := Switch_Chars (Ptr);
244 exit when C = ASCII.NUL or else C = '/' or else C = '-';
246 if C in '1' .. '9' or else
247 C in 'a' .. 'z' or else
248 C in 'A' .. 'Z'
249 then
250 if Dot then
251 Set_Dotted_Debug_Flag (C);
252 Storing (First_Stored + 1) := '.';
253 Storing (First_Stored + 2) := C;
254 Store_Compilation_Switch
255 (Storing (Storing'First .. First_Stored + 2));
256 Dot := False;
258 else
259 Set_Debug_Flag (C);
260 Storing (First_Stored + 1) := C;
261 Store_Compilation_Switch
262 (Storing (Storing'First .. First_Stored + 1));
263 end if;
265 elsif C = '.' then
266 Dot := True;
268 else
269 Bad_Switch (C);
270 end if;
271 end loop;
273 return;
275 -- Processing for D switch
277 when 'D' =>
278 Ptr := Ptr + 1;
280 -- Note: -gnatD also sets -gnatx (to turn off cross-reference
281 -- generation in the ali file) since otherwise this generation
282 -- gets confused by the "wrong" Sloc values put in the tree.
284 Debug_Generated_Code := True;
285 Xref_Active := False;
286 Set_Debug_Flag ('g');
288 -- -gnate? (extended switches)
290 when 'e' =>
291 Ptr := Ptr + 1;
293 -- The -gnate? switches are all double character switches
294 -- so we must always have a character after the e.
296 if Ptr > Max then
297 Bad_Switch (C);
298 end if;
300 case Switch_Chars (Ptr) is
302 -- -gnatec (configuration pragmas)
304 when 'c' =>
305 Store_Switch := False;
306 Ptr := Ptr + 1;
308 -- There may be an equal sign between -gnatec and
309 -- the path name of the config file.
311 if Ptr <= Max and then Switch_Chars (Ptr) = '=' then
312 Ptr := Ptr + 1;
313 end if;
315 if Ptr > Max then
316 Bad_Switch (C);
317 end if;
319 declare
320 Config_File_Name : constant String_Access :=
321 new String'
322 (Switch_Chars (Ptr .. Max));
324 begin
325 if Config_File_Names = null then
326 Config_File_Names :=
327 new String_List'(1 => Config_File_Name);
329 else
330 declare
331 New_Names : constant String_List_Access :=
332 new String_List
333 (1 ..
334 Config_File_Names'Length + 1);
336 begin
337 for Index in Config_File_Names'Range loop
338 New_Names (Index) :=
339 Config_File_Names (Index);
340 Config_File_Names (Index) := null;
341 end loop;
343 New_Names (New_Names'Last) := Config_File_Name;
344 Free (Config_File_Names);
345 Config_File_Names := New_Names;
346 end;
347 end if;
348 end;
350 return;
352 -- -gnateD switch (symbol definition)
354 when 'D' =>
355 Store_Switch := False;
356 Ptr := Ptr + 1;
358 if Ptr > Max then
359 Bad_Switch (C);
360 end if;
362 Add_Symbol_Definition (Switch_Chars (Ptr .. Max));
364 -- Store the switch
366 Storing (First_Stored .. First_Stored + 1) := "eD";
367 Storing
368 (First_Stored + 2 .. First_Stored + Max - Ptr + 2) :=
369 Switch_Chars (Ptr .. Max);
370 Store_Compilation_Switch (Storing
371 (Storing'First .. First_Stored + Max - Ptr + 2));
372 return;
374 -- -gnatef (full source path for brief error messages)
376 when 'f' =>
377 Store_Switch := False;
378 Ptr := Ptr + 1;
379 Full_Path_Name_For_Brief_Errors := True;
380 return;
382 -- -gnateI (index of unit in multi-unit source)
384 when 'I' =>
385 Ptr := Ptr + 1;
386 Scan_Pos
387 (Switch_Chars, Max, Ptr, Multiple_Unit_Index, C);
389 -- -gnatem (mapping file)
391 when 'm' =>
392 Store_Switch := False;
393 Ptr := Ptr + 1;
395 -- There may be an equal sign between -gnatem and
396 -- the path name of the mapping file.
398 if Ptr <= Max and then Switch_Chars (Ptr) = '=' then
399 Ptr := Ptr + 1;
400 end if;
402 if Ptr > Max then
403 Bad_Switch (C);
404 end if;
406 Mapping_File_Name :=
407 new String'(Switch_Chars (Ptr .. Max));
408 return;
410 -- -gnatep (preprocessing data file)
412 when 'p' =>
413 Store_Switch := False;
414 Ptr := Ptr + 1;
416 -- There may be an equal sign between -gnatep and
417 -- the path name of the mapping file.
419 if Ptr <= Max and then Switch_Chars (Ptr) = '=' then
420 Ptr := Ptr + 1;
421 end if;
423 if Ptr > Max then
424 Bad_Switch (C);
425 end if;
427 Preprocessing_Data_File :=
428 new String'(Switch_Chars (Ptr .. Max));
430 -- Store the switch.
431 -- Because we may store a longer switch (we normalize
432 -- to -gnatep=), use a local variable.
434 declare
435 To_Store : String
436 (1 .. Preprocessing_Data_File'Length + 8);
438 begin
439 To_Store (1 .. 8) := "-gnatep=";
440 To_Store (9 .. Preprocessing_Data_File'Length + 8) :=
441 Preprocessing_Data_File.all;
442 Store_Compilation_Switch (To_Store);
443 end;
445 return;
447 when 'z' =>
448 Store_Switch := False;
449 Disable_Switch_Storing;
450 Ptr := Ptr + 1;
452 -- All other -gnate? switches are unassigned
454 when others =>
455 Bad_Switch (C);
456 end case;
458 -- -gnatE (dynamic elaboration checks)
460 when 'E' =>
461 Ptr := Ptr + 1;
462 Dynamic_Elaboration_Checks := True;
464 -- -gnatf (full error messages)
466 when 'f' =>
467 Ptr := Ptr + 1;
468 All_Errors_Mode := True;
470 -- Processing for F switch
472 when 'F' =>
473 Ptr := Ptr + 1;
474 External_Name_Exp_Casing := Uppercase;
475 External_Name_Imp_Casing := Uppercase;
477 -- Processing for g switch
479 when 'g' =>
480 Ptr := Ptr + 1;
481 GNAT_Mode := True;
482 Identifier_Character_Set := 'n';
483 System_Extend_Unit := Empty;
484 Warning_Mode := Treat_As_Error;
486 -- Set Ada 2005 mode explicitly. We don't want to rely on the
487 -- implicit setting here, since for example, we want
488 -- Preelaborate_05 treated as Preelaborate
490 Ada_Version := Ada_05;
491 Ada_Version_Explicit := Ada_Version;
493 -- Set default warnings for -gnatg (same set as -gnatwa)
495 Check_Unreferenced := True;
496 Check_Unreferenced_Formals := True;
497 Check_Withs := True;
498 Constant_Condition_Warnings := True;
499 Implementation_Unit_Warnings := True;
500 Ineffective_Inline_Warnings := True;
501 Warn_On_Bad_Fixed_Value := True;
502 Warn_On_Constant := True;
503 Warn_On_Export_Import := True;
504 Warn_On_Modified_Unread := True;
505 Warn_On_No_Value_Assigned := True;
506 Warn_On_Obsolescent_Feature := True;
507 Warn_On_Redundant_Constructs := True;
508 Warn_On_Unchecked_Conversion := True;
509 Warn_On_Unrecognized_Pragma := True;
511 Set_Style_Check_Options ("3abcdefhiklmnprstux");
513 -- Processing for G switch
515 when 'G' =>
516 Ptr := Ptr + 1;
517 Print_Generated_Code := True;
519 -- Processing for h switch
521 when 'h' =>
522 Ptr := Ptr + 1;
523 Usage_Requested := True;
525 -- Processing for H switch
527 when 'H' =>
528 Ptr := Ptr + 1;
529 HLO_Active := True;
531 -- Processing for i switch
533 when 'i' =>
534 if Ptr = Max then
535 Bad_Switch (C);
536 end if;
538 Ptr := Ptr + 1;
539 C := Switch_Chars (Ptr);
541 if C in '1' .. '5'
542 or else C = '8'
543 or else C = '9'
544 or else C = 'p'
545 or else C = 'f'
546 or else C = 'n'
547 or else C = 'w'
548 then
549 Identifier_Character_Set := C;
550 Ptr := Ptr + 1;
552 else
553 Bad_Switch (C);
554 end if;
556 -- Processing for k switch
558 when 'k' =>
559 Ptr := Ptr + 1;
560 Scan_Pos
561 (Switch_Chars, Max, Ptr, Maximum_File_Name_Length, C);
563 -- Processing for l switch
565 when 'l' =>
566 Ptr := Ptr + 1;
567 Full_List := True;
569 -- Processing for L switch
571 when 'L' =>
572 Ptr := Ptr + 1;
573 Osint.Fail
574 ("-gnatL is no longer supported: consider using --RTS=sjlj");
576 -- Processing for m switch
578 when 'm' =>
579 Ptr := Ptr + 1;
581 -- There may be an equal sign between -gnatm and the value
583 if Ptr <= Max and then Switch_Chars (Ptr) = '=' then
584 Ptr := Ptr + 1;
585 end if;
587 Scan_Pos (Switch_Chars, Max, Ptr, Maximum_Errors, C);
589 -- Processing for n switch
591 when 'n' =>
592 Ptr := Ptr + 1;
593 Inline_Active := True;
595 -- Processing for N switch
597 when 'N' =>
598 Ptr := Ptr + 1;
599 Inline_Active := True;
600 Front_End_Inlining := True;
602 -- Processing for o switch
604 when 'o' =>
605 Ptr := Ptr + 1;
606 Suppress_Options (Overflow_Check) := False;
607 Opt.Enable_Overflow_Checks := True;
609 -- Processing for O switch
611 when 'O' =>
612 Store_Switch := False;
613 Ptr := Ptr + 1;
614 Output_File_Name_Present := True;
616 -- Processing for p switch
618 when 'p' =>
619 Ptr := Ptr + 1;
621 -- Set all specific options as well as All_Checks in the
622 -- Suppress_Options array, excluding Elaboration_Check, since
623 -- this is treated specially because we do not want -gnatp to
624 -- disable static elaboration processing.
626 for J in Suppress_Options'Range loop
627 if J /= Elaboration_Check then
628 Suppress_Options (J) := True;
629 end if;
630 end loop;
632 Validity_Checks_On := False;
633 Opt.Suppress_Checks := True;
634 Opt.Enable_Overflow_Checks := False;
636 -- Processing for P switch
638 when 'P' =>
639 Ptr := Ptr + 1;
640 Polling_Required := True;
642 -- Processing for q switch
644 when 'q' =>
645 Ptr := Ptr + 1;
646 Try_Semantics := True;
648 -- Processing for q switch
650 when 'Q' =>
651 Ptr := Ptr + 1;
652 Force_ALI_Tree_File := True;
653 Try_Semantics := True;
655 -- Processing for R switch
657 when 'R' =>
658 Ptr := Ptr + 1;
659 Back_Annotate_Rep_Info := True;
660 List_Representation_Info := 1;
662 while Ptr <= Max loop
663 C := Switch_Chars (Ptr);
665 if C in '1' .. '3' then
666 List_Representation_Info :=
667 Character'Pos (C) - Character'Pos ('0');
669 elsif Switch_Chars (Ptr) = 's' then
670 List_Representation_Info_To_File := True;
672 elsif Switch_Chars (Ptr) = 'm' then
673 List_Representation_Info_Mechanisms := True;
675 else
676 Bad_Switch (C);
677 end if;
679 Ptr := Ptr + 1;
680 end loop;
682 -- Processing for s switch
684 when 's' =>
685 if not First_Switch then
686 Osint.Fail
687 ("-gnats must be first if combined with other switches");
688 end if;
690 Ptr := Ptr + 1;
691 Operating_Mode := Check_Syntax;
693 -- Processing for S switch
695 when 'S' =>
696 Print_Standard := True;
697 Ptr := Ptr + 1;
699 -- Processing for t switch
701 when 't' =>
702 Ptr := Ptr + 1;
703 Tree_Output := True;
705 if Operating_Mode = Check_Semantics then
706 ASIS_Mode := True;
707 end if;
709 Back_Annotate_Rep_Info := True;
711 -- Processing for T switch
713 when 'T' =>
714 Ptr := Ptr + 1;
715 Scan_Pos (Switch_Chars, Max, Ptr, Table_Factor, C);
717 -- Processing for u switch
719 when 'u' =>
720 Ptr := Ptr + 1;
721 List_Units := True;
723 -- Processing for U switch
725 when 'U' =>
726 Ptr := Ptr + 1;
727 Unique_Error_Tag := True;
729 -- Processing for v switch
731 when 'v' =>
732 Ptr := Ptr + 1;
733 Verbose_Mode := True;
735 -- Processing for V switch
737 when 'V' =>
738 Store_Switch := False;
739 Storing (First_Stored) := 'V';
740 Ptr := Ptr + 1;
742 if Ptr > Max then
743 Bad_Switch (C);
745 else
746 declare
747 OK : Boolean;
749 begin
750 Set_Validity_Check_Options
751 (Switch_Chars (Ptr .. Max), OK, Ptr);
753 if not OK then
754 Bad_Switch (C);
755 end if;
757 for Index in First_Char + 1 .. Max loop
758 Storing (First_Stored + 1) :=
759 Switch_Chars (Index);
760 Store_Compilation_Switch
761 (Storing (Storing'First .. First_Stored + 1));
762 end loop;
763 end;
764 end if;
766 Ptr := Max + 1;
768 -- Processing for w switch
770 when 'w' =>
771 Store_Switch := False;
772 Storing (First_Stored) := 'w';
773 Ptr := Ptr + 1;
775 if Ptr > Max then
776 Bad_Switch (C);
777 end if;
779 while Ptr <= Max loop
780 C := Switch_Chars (Ptr);
782 if Set_Warning_Switch (C) then
783 null;
784 else
785 Bad_Switch (C);
786 end if;
788 if C /= 'w' then
789 Storing (First_Stored + 1) := C;
790 Store_Compilation_Switch
791 (Storing (Storing'First .. First_Stored + 1));
792 end if;
794 Ptr := Ptr + 1;
795 end loop;
797 return;
799 -- Processing for W switch
801 when 'W' =>
802 Ptr := Ptr + 1;
804 if Ptr > Max then
805 Bad_Switch (C);
806 end if;
808 for J in WC_Encoding_Method loop
809 if Switch_Chars (Ptr) = WC_Encoding_Letters (J) then
810 Wide_Character_Encoding_Method := J;
811 exit;
813 elsif J = WC_Encoding_Method'Last then
814 Bad_Switch (C);
815 end if;
816 end loop;
818 Upper_Half_Encoding :=
819 Wide_Character_Encoding_Method in
820 WC_Upper_Half_Encoding_Method;
822 Ptr := Ptr + 1;
824 -- Processing for x switch
826 when 'x' =>
827 Ptr := Ptr + 1;
828 Xref_Active := False;
830 -- Processing for X switch
832 when 'X' =>
833 Ptr := Ptr + 1;
834 Extensions_Allowed := True;
835 Ada_Version := Ada_Version_Type'Last;
836 Ada_Version_Explicit := Ada_Version;
838 -- Processing for y switch
840 when 'y' =>
841 Ptr := Ptr + 1;
843 if Ptr > Max then
844 Set_Default_Style_Check_Options;
846 else
847 Store_Switch := False;
848 Storing (First_Stored) := 'y';
850 declare
851 OK : Boolean;
852 Last_Stored : Integer;
854 begin
855 Set_Style_Check_Options
856 (Switch_Chars (Ptr .. Max), OK, Ptr);
858 if not OK then
859 declare
860 R : String (1 .. Style_Msg_Len + 20);
861 begin
862 R (1 .. 19) := "bad -gnaty switch (";
863 R (20 .. R'Last - 1) :=
864 Style_Msg_Buf (1 .. Style_Msg_Len);
865 R (R'Last) := ')';
866 Osint.Fail (R);
867 end;
868 end if;
870 Ptr := First_Char + 1;
871 while Ptr <= Max loop
872 Last_Stored := First_Stored + 1;
873 Storing (Last_Stored) := Switch_Chars (Ptr);
875 if Switch_Chars (Ptr) = 'M' then
876 loop
877 Ptr := Ptr + 1;
878 exit when Ptr > Max
879 or else Switch_Chars (Ptr) not in '0' .. '9';
880 Last_Stored := Last_Stored + 1;
881 Storing (Last_Stored) := Switch_Chars (Ptr);
882 end loop;
884 else
885 Ptr := Ptr + 1;
886 end if;
888 Store_Compilation_Switch
889 (Storing (Storing'First .. Last_Stored));
890 end loop;
891 end;
892 end if;
894 -- Processing for z switch
896 when 'z' =>
897 Ptr := Ptr + 1;
899 -- Allowed for compiler only if this is the only
900 -- -z switch, we do not allow multiple occurrences
902 if Distribution_Stub_Mode = No_Stubs then
903 case Switch_Chars (Ptr) is
904 when 'r' =>
905 Distribution_Stub_Mode := Generate_Receiver_Stub_Body;
907 when 'c' =>
908 Distribution_Stub_Mode := Generate_Caller_Stub_Body;
910 when others =>
911 Bad_Switch (C);
912 end case;
914 Ptr := Ptr + 1;
916 end if;
918 -- Processing for Z switch
920 when 'Z' =>
921 Ptr := Ptr + 1;
922 Osint.Fail
923 ("-gnatZ is no longer supported: consider using --RTS=zcx");
925 -- Processing for 83 switch
927 when '8' =>
928 if Ptr = Max then
929 Bad_Switch (C);
930 end if;
932 Ptr := Ptr + 1;
934 if Switch_Chars (Ptr) /= '3' then
935 Bad_Switch (C);
936 else
937 Ptr := Ptr + 1;
938 Ada_Version := Ada_83;
939 Ada_Version_Explicit := Ada_Version;
940 end if;
942 -- Processing for 95 switch
944 when '9' =>
945 if Ptr = Max then
946 Bad_Switch (C);
947 end if;
949 Ptr := Ptr + 1;
951 if Switch_Chars (Ptr) /= '5' then
952 Bad_Switch (C);
953 else
954 Ptr := Ptr + 1;
955 Ada_Version := Ada_95;
956 Ada_Version_Explicit := Ada_Version;
957 end if;
959 -- Processing for 05 switch
961 when '0' =>
962 if Ptr = Max then
963 Bad_Switch (C);
964 end if;
966 Ptr := Ptr + 1;
968 if Switch_Chars (Ptr) /= '5' then
969 Bad_Switch (C);
970 else
971 Ptr := Ptr + 1;
972 Ada_Version := Ada_05;
973 Ada_Version_Explicit := Ada_Version;
974 end if;
976 -- Ignore extra switch character
978 when '/' | '-' =>
979 Ptr := Ptr + 1;
981 -- Anything else is an error (illegal switch character)
983 when others =>
984 Bad_Switch (C);
985 end case;
986 end case;
988 if Store_Switch then
989 Storing (First_Stored .. First_Stored + Ptr - First_Char - 1) :=
990 Switch_Chars (First_Char .. Ptr - 1);
991 Store_Compilation_Switch
992 (Storing (Storing'First .. First_Stored + Ptr - First_Char - 1));
993 end if;
995 First_Switch := False;
996 end loop;
997 end Scan_Front_End_Switches;
999 end Switch.C;