OSDN Git Service

2010-10-26 Tobias Burnus <burnus@net-b.de>
[pf3gnuchains/gcc-fork.git] / gcc / ada / switch-m.adb
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                             S W I T C H - M                              --
6 --                                                                          --
7 --                                 B o d y                                  --
8 --                                                                          --
9 --          Copyright (C) 2001-2010, 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 with Debug;    use Debug;
27 with Makeutl;  use Makeutl;
28 with Osint;    use Osint;
29 with Opt;      use Opt;
30 with Prj;      use Prj;
31 with Prj.Env;  use Prj.Env;
32 with Table;
33
34 with System.Multiprocessors; use System.Multiprocessors;
35
36 package body Switch.M is
37
38    package Normalized_Switches is new Table.Table
39      (Table_Component_Type => String_Access,
40       Table_Index_Type     => Integer,
41       Table_Low_Bound      => 1,
42       Table_Initial        => 20,
43       Table_Increment      => 100,
44       Table_Name           => "Switch.M.Normalized_Switches");
45    --  This table is used to keep the normalized switches, so that they may be
46    --  reused for subsequent invocations of Normalize_Compiler_Switches with
47    --  similar switches.
48
49    Initial_Number_Of_Switches : constant := 10;
50
51    Global_Switches : Argument_List_Access := null;
52    --  Used by function Normalize_Compiler_Switches
53
54    ---------------------------------
55    -- Normalize_Compiler_Switches --
56    ---------------------------------
57
58    procedure Normalize_Compiler_Switches
59      (Switch_Chars : String;
60       Switches     : in out Argument_List_Access;
61       Last         : out Natural)
62    is
63       Switch_Starts_With_Gnat : Boolean;
64
65       Ptr : Integer := Switch_Chars'First;
66       Max : constant Integer := Switch_Chars'Last;
67       C   : Character := ' ';
68
69       Storing      : String := Switch_Chars;
70       First_Stored : Positive := Ptr + 1;
71       Last_Stored  : Positive := First_Stored;
72
73       procedure Add_Switch_Component (S : String);
74       --  Add a new String_Access component in Switches. If a string equal
75       --  to S is already stored in the table Normalized_Switches, use it.
76       --  Otherwise add a new component to the table.
77
78       --------------------------
79       -- Add_Switch_Component --
80       --------------------------
81
82       procedure Add_Switch_Component (S : String) is
83       begin
84          --  If Switches is null, allocate a new array
85
86          if Switches = null then
87             Switches := new Argument_List (1 .. Initial_Number_Of_Switches);
88
89          --  Otherwise, if Switches is full, extend it
90
91          elsif Last = Switches'Last then
92             declare
93                New_Switches : constant Argument_List_Access :=
94                                 new Argument_List
95                                       (1 .. Switches'Length + Switches'Length);
96             begin
97                New_Switches (1 .. Switches'Length) := Switches.all;
98                Last := Switches'Length;
99                Switches := New_Switches;
100             end;
101          end if;
102
103          --  If this is the first switch, Last designates the first component
104
105          if Last = 0 then
106             Last := Switches'First;
107          else
108             Last := Last + 1;
109          end if;
110
111          --  Look into the table Normalized_Switches for a similar string.
112          --  If one is found, put it at the added component, and return.
113
114          for Index in 1 .. Normalized_Switches.Last loop
115             if S = Normalized_Switches.Table (Index).all then
116                Switches (Last) := Normalized_Switches.Table (Index);
117                return;
118             end if;
119          end loop;
120
121          --  No string equal to S was found in the table Normalized_Switches.
122          --  Add a new component in the table.
123
124          Switches (Last) := new String'(S);
125          Normalized_Switches.Append (Switches (Last));
126       end Add_Switch_Component;
127
128    --  Start of processing for Normalize_Compiler_Switches
129
130    begin
131       Last := 0;
132
133       if Ptr = Max or else Switch_Chars (Ptr) /= '-' then
134          return;
135       end if;
136
137       Ptr := Ptr + 1;
138
139       Switch_Starts_With_Gnat :=
140          Ptr + 3 <= Max and then Switch_Chars (Ptr .. Ptr + 3) = "gnat";
141
142       if Switch_Starts_With_Gnat then
143          Ptr := Ptr + 4;
144          First_Stored := Ptr;
145       end if;
146
147       while Ptr <= Max loop
148          C := Switch_Chars (Ptr);
149
150          --  Processing for a switch
151
152          case Switch_Starts_With_Gnat is
153
154             when False =>
155
156                --  All switches that don't start with -gnat stay as is,
157                --  except -pg, -Wall, -k8, -w
158
159                if Switch_Chars = "-pg" or else Switch_Chars = "-p" then
160
161                   --  The gcc driver converts -pg to -p, so that is what
162                   --  is stored in the ALI file.
163
164                   Add_Switch_Component ("-p");
165
166                elsif Switch_Chars = "-Wall" then
167
168                   --  The gcc driver adds -gnatwa when -Wall is used
169
170                   Add_Switch_Component ("-gnatwa");
171                   Add_Switch_Component ("-Wall");
172
173                elsif Switch_Chars = "-k8" then
174
175                   --  The gcc driver transforms -k8 into -gnatk8
176
177                   Add_Switch_Component ("-gnatk8");
178
179                elsif Switch_Chars = "-w" then
180
181                   --  The gcc driver adds -gnatws when -w is used
182
183                   Add_Switch_Component ("-gnatws");
184                   Add_Switch_Component ("-w");
185
186                elsif Switch_Chars'Length > 6
187                  and then
188                    Switch_Chars (Switch_Chars'First .. Switch_Chars'First + 5)
189                                                              = "--RTS="
190                then
191                   Add_Switch_Component (Switch_Chars);
192
193                   --  When --RTS=mtp is used, the gcc driver adds -mrtp
194
195                   if Switch_Chars = "--RTS=mtp" then
196                      Add_Switch_Component ("-mrtp");
197                   end if;
198
199                --  Take only into account switches that are transmitted to
200                --  gnat1 by the gcc driver and stored by gnat1 in the ALI file.
201
202                else
203                   case C is
204                      when 'O' | 'W' | 'w' | 'f' | 'd' | 'g' | 'm' =>
205                         Add_Switch_Component (Switch_Chars);
206
207                      when others =>
208                         null;
209                   end case;
210                end if;
211
212                return;
213
214             when True =>
215
216                case C is
217
218                   --  One-letter switches
219
220                   when 'a' | 'A' | 'b' | 'B' | 'c' | 'C' | 'E' | 'f' |
221                        'F' | 'g' | 'h' | 'H' | 'I' | 'L' | 'n' | 'N' |
222                        'o' | 'p' | 'P' | 'q' | 'Q' | 'r' | 's' | 'S' |
223                        't' | 'u' | 'U' | 'v' | 'x' | 'X' | 'Z' =>
224                      Storing (First_Stored) := C;
225                      Add_Switch_Component
226                        (Storing (Storing'First .. First_Stored));
227                      Ptr := Ptr + 1;
228
229                   --  One-letter switches followed by a positive number
230
231                   when 'D' | 'G' | 'j' | 'k' | 'm' | 'T' =>
232                      Storing (First_Stored) := C;
233                      Last_Stored := First_Stored;
234
235                      if Ptr <= Max and then Switch_Chars (Ptr) = '=' then
236                         Ptr := Ptr + 1;
237                      end if;
238
239                      loop
240                         Ptr := Ptr + 1;
241                         exit when Ptr > Max
242                           or else Switch_Chars (Ptr) not in '0' .. '9';
243                         Last_Stored := Last_Stored + 1;
244                         Storing (Last_Stored) := Switch_Chars (Ptr);
245                      end loop;
246
247                      Add_Switch_Component
248                        (Storing (Storing'First .. Last_Stored));
249
250                   when 'd' =>
251                      Storing (First_Stored) := 'd';
252
253                      while Ptr < Max loop
254                         Ptr := Ptr + 1;
255                         C := Switch_Chars (Ptr);
256                         exit when C = ASCII.NUL or else C = '/'
257                           or else C = '-';
258
259                         if C in '1' .. '9' or else
260                            C in 'a' .. 'z' or else
261                            C in 'A' .. 'Z'
262                         then
263                            Storing (First_Stored + 1) := C;
264                            Add_Switch_Component
265                              (Storing (Storing'First .. First_Stored + 1));
266
267                         else
268                            Last := 0;
269                            return;
270                         end if;
271                      end loop;
272
273                      return;
274
275                   when 'e' =>
276
277                      --  Some of the gnate... switches are not stored
278
279                      Storing (First_Stored) := 'e';
280                      Ptr := Ptr + 1;
281
282                      if Ptr > Max then
283                         Last := 0;
284                         return;
285
286                      else
287                         case Switch_Chars (Ptr) is
288
289                            when 'D' =>
290                               Storing (First_Stored + 1 ..
291                                          First_Stored + Max - Ptr + 1) :=
292                                   Switch_Chars (Ptr .. Max);
293                               Add_Switch_Component
294                                 (Storing (Storing'First ..
295                                    First_Stored + Max - Ptr + 1));
296                               Ptr := Max + 1;
297
298                            when 'G' =>
299                               Ptr := Ptr + 1;
300                               Add_Switch_Component ("-gnateG");
301
302                            when 'I' =>
303                               Ptr := Ptr + 1;
304
305                               declare
306                                  First : constant Positive := Ptr - 1;
307                               begin
308                                  if Ptr <= Max and then
309                                    Switch_Chars (Ptr) = '='
310                                  then
311                                     Ptr := Ptr + 1;
312                                  end if;
313
314                                  while Ptr <= Max and then
315                                        Switch_Chars (Ptr) in '0' .. '9'
316                                  loop
317                                     Ptr := Ptr + 1;
318                                  end loop;
319
320                                  Storing (First_Stored + 1 ..
321                                             First_Stored + Ptr - First) :=
322                                      Switch_Chars (First .. Ptr - 1);
323                                  Add_Switch_Component
324                                    (Storing (Storing'First ..
325                                       First_Stored + Ptr - First));
326                               end;
327
328                            when 'p' =>
329                               Ptr := Ptr + 1;
330
331                               if Ptr = Max then
332                                  Last := 0;
333                                  return;
334                               end if;
335
336                               if Switch_Chars (Ptr) = '=' then
337                                  Ptr := Ptr + 1;
338                               end if;
339
340                                  --  To normalize, always put a '=' after
341                                  --  -gnatep. Because that could lengthen the
342                                  --  switch string, declare a local variable.
343
344                               declare
345                                  To_Store : String (1 .. Max - Ptr + 9);
346                               begin
347                                  To_Store (1 .. 8) := "-gnatep=";
348                                  To_Store (9 .. Max - Ptr + 9) :=
349                                    Switch_Chars (Ptr .. Max);
350                                  Add_Switch_Component (To_Store);
351                               end;
352
353                               return;
354
355                            when 'S' =>
356                               Ptr := Ptr + 1;
357                               Add_Switch_Component ("-gnateS");
358
359                            when others =>
360                               Last := 0;
361                               return;
362                         end case;
363                      end if;
364
365                   when 'i' =>
366                      Storing (First_Stored) := 'i';
367
368                      Ptr := Ptr + 1;
369
370                      if Ptr > Max then
371                         Last := 0;
372                         return;
373                      end if;
374
375                      C := Switch_Chars (Ptr);
376
377                      if C in '1' .. '5'
378                        or else C = '8'
379                        or else C = 'p'
380                        or else C = 'f'
381                        or else C = 'n'
382                        or else C = 'w'
383                      then
384                         Storing (First_Stored + 1) := C;
385                         Add_Switch_Component
386                           (Storing (Storing'First .. First_Stored + 1));
387                         Ptr := Ptr + 1;
388
389                      else
390                         Last := 0;
391                         return;
392                      end if;
393
394                   --  -gnatl may be -gnatl=<file name>
395
396                   when 'l' =>
397                      Ptr := Ptr + 1;
398
399                      if Ptr > Max or else Switch_Chars (Ptr) /= '=' then
400                         Add_Switch_Component ("-gnatl");
401
402                      else
403                         Add_Switch_Component
404                           ("-gnatl" & Switch_Chars (Ptr .. Max));
405                         return;
406                      end if;
407
408                   --  -gnatR may be followed by '0', '1', '2' or '3',
409                   --  then by 's'
410
411                   when 'R' =>
412                      Last_Stored := First_Stored;
413                      Storing (Last_Stored) := 'R';
414                      Ptr := Ptr + 1;
415
416                      if Ptr <= Max
417                        and then Switch_Chars (Ptr) in '0' .. '9'
418                      then
419                         C := Switch_Chars (Ptr);
420
421                         if C in '4' .. '9' then
422                            Last := 0;
423                            return;
424
425                         else
426                            Last_Stored := Last_Stored + 1;
427                            Storing (Last_Stored) := C;
428                            Ptr := Ptr + 1;
429
430                            if Ptr <= Max
431                              and then Switch_Chars (Ptr) = 's'
432                            then
433                               Last_Stored := Last_Stored + 1;
434                               Storing (Last_Stored) := 's';
435                               Ptr := Ptr + 1;
436                            end if;
437                         end if;
438                      end if;
439
440                      Add_Switch_Component
441                        (Storing (Storing'First .. Last_Stored));
442
443                   --  -gnatWx, x = 'h'. 'u', 's', 'e', '8' or 'b'
444
445                   when 'W' =>
446                      Storing (First_Stored) := 'W';
447                      Ptr := Ptr + 1;
448
449                      if Ptr <= Max then
450                         case Switch_Chars (Ptr) is
451                            when 'h' | 'u' | 's' | 'e' | '8' | 'b' =>
452                               Storing (First_Stored + 1) := Switch_Chars (Ptr);
453                               Add_Switch_Component
454                                 (Storing (Storing'First .. First_Stored + 1));
455                               Ptr := Ptr + 1;
456
457                            when others =>
458                               Last := 0;
459                               return;
460                         end case;
461                      end if;
462
463                   --  Multiple switches
464
465                   when 'V' | 'w' | 'y' =>
466                      Storing (First_Stored) := C;
467                      Ptr := Ptr + 1;
468
469                      if Ptr > Max then
470                         if C = 'y' then
471                            Add_Switch_Component
472                              (Storing (Storing'First .. First_Stored));
473
474                         else
475                            Last := 0;
476                            return;
477                         end if;
478                      end if;
479
480                      --  Loop through remaining switch characters in string
481
482                      while Ptr <= Max loop
483                         C := Switch_Chars (Ptr);
484                         Ptr := Ptr + 1;
485
486                         --  -gnatyMxxx
487
488                         if C = 'M' and then Storing (First_Stored) = 'y' then
489                            Last_Stored := First_Stored + 1;
490                            Storing (Last_Stored) := 'M';
491                            while Ptr <= Max loop
492                               C := Switch_Chars (Ptr);
493                               exit when C not in '0' .. '9';
494                               Last_Stored := Last_Stored + 1;
495                               Storing (Last_Stored) := C;
496                               Ptr := Ptr + 1;
497                            end loop;
498
499                            --  If there is no digit after -gnatyM,
500                            --  the switch is invalid.
501
502                            if Last_Stored = First_Stored + 1 then
503                               Last := 0;
504                               return;
505
506                            else
507                               Add_Switch_Component
508                                 (Storing (Storing'First .. Last_Stored));
509                            end if;
510
511                         --  --gnatx.x
512
513                         elsif C = '.' and then Ptr <= Max then
514                            Storing (First_Stored + 1) := '.';
515                            Storing (First_Stored + 2) := Switch_Chars (Ptr);
516                            Ptr := Ptr + 1;
517                            Add_Switch_Component
518                              (Storing (Storing'First .. First_Stored + 2));
519
520                         --  All other switches are -gnatxx
521
522                         else
523                            Storing (First_Stored + 1) := C;
524                            Add_Switch_Component
525                              (Storing (Storing'First .. First_Stored + 1));
526                         end if;
527                      end loop;
528
529                   --  -gnat95 -gnat05
530
531                   when '0' | '9' =>
532                      Last_Stored := First_Stored;
533                      Storing (Last_Stored) := C;
534                      Ptr := Ptr + 1;
535
536                      if Ptr /= Max or else Switch_Chars (Ptr) /= '5' then
537
538                         --  Invalid switch
539
540                         Last := 0;
541                         return;
542
543                      else
544                         Last_Stored := Last_Stored + 1;
545                         Storing (Last_Stored) := '5';
546                         Add_Switch_Component
547                           (Storing (Storing'First .. Last_Stored));
548                         Ptr := Ptr + 1;
549                      end if;
550
551                   --  -gnat83
552
553                   when '8' =>
554                      Last_Stored := First_Stored;
555                      Storing (Last_Stored) := '8';
556                      Ptr := Ptr + 1;
557
558                      if Ptr /= Max or else Switch_Chars (Ptr) /= '3' then
559
560                         --  Invalid switch
561
562                         Last := 0;
563                         return;
564
565                      else
566                         Last_Stored := Last_Stored + 1;
567                         Storing (Last_Stored) := '3';
568                         Add_Switch_Component
569                           (Storing (Storing'First .. Last_Stored));
570                         Ptr := Ptr + 1;
571                      end if;
572
573                   --  Not a valid switch
574
575                   when others =>
576                      Last := 0;
577                      return;
578
579                end case;
580
581          end case;
582       end loop;
583    end Normalize_Compiler_Switches;
584
585    function Normalize_Compiler_Switches
586      (Switch_Chars : String) return Argument_List
587    is
588       Last : Natural;
589
590    begin
591       Normalize_Compiler_Switches (Switch_Chars, Global_Switches, Last);
592
593       if Last = 0 then
594          return (1 .. 0 => null);
595       else
596          return Global_Switches (Global_Switches'First .. Last);
597       end if;
598    end Normalize_Compiler_Switches;
599
600    ------------------------
601    -- Scan_Make_Switches --
602    ------------------------
603
604    procedure Scan_Make_Switches
605      (Project_Node_Tree : Prj.Tree.Project_Node_Tree_Ref;
606       Switch_Chars      : String;
607       Success           : out Boolean)
608    is
609       Ptr : Integer          := Switch_Chars'First;
610       Max : constant Integer := Switch_Chars'Last;
611       C   : Character        := ' ';
612
613    begin
614       --  Assume a good switch
615
616       Success := True;
617
618       --  Skip past the initial character (must be the switch character)
619
620       if Ptr = Max then
621          Bad_Switch (Switch_Chars);
622
623       else
624          Ptr := Ptr + 1;
625       end if;
626
627       --  A little check, "gnat" at the start of a switch is for the compiler
628
629       if Switch_Chars'Length >= Ptr + 3
630         and then Switch_Chars (Ptr .. Ptr + 3) = "gnat"
631       then
632          Success := False;
633          return;
634       end if;
635
636       C := Switch_Chars (Ptr);
637
638       --  Multiple character switches
639
640       if Switch_Chars'Length > 2 then
641          if Switch_Chars = "--create-missing-dirs" then
642             Setup_Projects := True;
643
644          elsif Switch_Chars'Length > Subdirs_Option'Length
645            and then
646              Switch_Chars
647                (Switch_Chars'First ..
648                 Switch_Chars'First + Subdirs_Option'Length - 1) =
649                                                             Subdirs_Option
650          then
651             Subdirs :=
652               new String'
653                 (Switch_Chars
654                   (Switch_Chars'First + Subdirs_Option'Length ..
655                    Switch_Chars'Last));
656
657          elsif Switch_Chars = Makeutl.Unchecked_Shared_Lib_Imports then
658             Opt.Unchecked_Shared_Lib_Imports := True;
659
660          elsif Switch_Chars = Makeutl.Single_Compile_Per_Obj_Dir_Switch then
661             Opt.One_Compilation_Per_Obj_Dir := True;
662
663          elsif Switch_Chars (Ptr) = '-' then
664             Bad_Switch (Switch_Chars);
665
666          elsif Switch_Chars'Length > 3
667            and then Switch_Chars (Ptr .. Ptr + 1) = "aP"
668          then
669             Add_Directories
670               (Project_Node_Tree.Project_Path,
671                Switch_Chars (Ptr + 2 .. Switch_Chars'Last));
672
673          elsif C = 'v' and then Switch_Chars'Length = 3 then
674             Ptr := Ptr + 1;
675             Verbose_Mode := True;
676
677             case Switch_Chars (Ptr) is
678                when 'l' =>
679                   Verbosity_Level := Opt.Low;
680
681                when 'm' =>
682                   Verbosity_Level := Opt.Medium;
683
684                when 'h' =>
685                   Verbosity_Level := Opt.High;
686
687                when others =>
688                   Success := False;
689             end case;
690
691          elsif C = 'd' then
692
693             --  Note: for the debug switch, the remaining characters in this
694             --  switch field must all be debug flags, since all valid switch
695             --  characters are also valid debug characters. This switch is not
696             --  documented on purpose because it is only used by the
697             --  implementors.
698
699             --  Loop to scan out debug flags
700
701             while Ptr < Max loop
702                Ptr := Ptr + 1;
703                C := Switch_Chars (Ptr);
704
705                if C in 'a' .. 'z' or else C in 'A' .. 'Z' then
706                   Set_Debug_Flag (C);
707                else
708                   Bad_Switch (Switch_Chars);
709                end if;
710             end loop;
711
712          elsif C = 'e' then
713             Ptr := Ptr + 1;
714
715             case Switch_Chars (Ptr) is
716
717                --  Processing for eI switch
718
719                when 'I' =>
720                   Ptr := Ptr + 1;
721                   Scan_Pos (Switch_Chars, Max, Ptr, Main_Index, C);
722
723                   if Ptr <= Max then
724                      Bad_Switch (Switch_Chars);
725                   end if;
726
727                --  Processing for eL switch
728
729                when 'L' =>
730                   if Ptr /= Max then
731                      Bad_Switch (Switch_Chars);
732
733                   else
734                      Follow_Links_For_Files := True;
735                      Follow_Links_For_Dirs  := True;
736                   end if;
737
738                --  Processing for eS switch
739
740                when 'S' =>
741                   if Ptr /= Max then
742                      Bad_Switch (Switch_Chars);
743
744                   else
745                      Commands_To_Stdout := True;
746                   end if;
747
748                when others =>
749                   Bad_Switch (Switch_Chars);
750             end case;
751
752          elsif C = 'j' then
753             Ptr := Ptr + 1;
754
755             declare
756                Max_Proc : Nat;
757
758             begin
759                Scan_Nat (Switch_Chars, Max, Ptr, Max_Proc, C);
760
761                if Ptr <= Max then
762                   Bad_Switch (Switch_Chars);
763
764                else
765                   if Max_Proc = 0 then
766                      Max_Proc := Nat (Number_Of_CPUs);
767
768                      if Max_Proc = 0 then
769                         Max_Proc := 1;
770                      end if;
771                   end if;
772
773                   Maximum_Processes := Positive (Max_Proc);
774                end if;
775             end;
776
777          elsif C = 'w' and then Switch_Chars'Length = 3 then
778             Ptr := Ptr + 1;
779
780             if Switch_Chars = "-we" then
781                Warning_Mode := Treat_As_Error;
782
783             elsif Switch_Chars = "-wn" then
784                Warning_Mode := Normal;
785
786             elsif Switch_Chars = "-ws" then
787                Warning_Mode  := Suppress;
788
789             else
790                Success := False;
791             end if;
792
793          else
794             Success := False;
795          end if;
796
797       --  Single-character switches
798
799       else
800          Check_Switch : begin
801
802             case C is
803
804                when 'a' =>
805                   Check_Readonly_Files := True;
806
807                --  Processing for b switch
808
809                when 'b' =>
810                   Bind_Only  := True;
811                   Make_Steps := True;
812
813                --  Processing for B switch
814
815                when 'B' =>
816                   Build_Bind_And_Link_Full_Project := True;
817
818                --  Processing for c switch
819
820                when 'c' =>
821                   Compile_Only := True;
822                   Make_Steps   := True;
823
824                --  Processing for C switch
825
826                when 'C' =>
827                   Opt.Create_Mapping_File := True;
828
829                --  Processing for D switch
830
831                when 'D' =>
832                   if Object_Directory_Present then
833                      Osint.Fail ("duplicate -D switch");
834
835                   else
836                      Object_Directory_Present := True;
837                   end if;
838
839                --  Processing for f switch
840
841                when 'f' =>
842                   Force_Compilations := True;
843
844                --  Processing for F switch
845
846                when 'F' =>
847                   Full_Path_Name_For_Brief_Errors := True;
848
849                --  Processing for h switch
850
851                when 'h' =>
852                   Usage_Requested := True;
853
854                --  Processing for i switch
855
856                when 'i' =>
857                   In_Place_Mode := True;
858
859                --  Processing for j switch
860
861                when 'j' =>
862                   --  -j not followed by a number is an error
863
864                   Bad_Switch (Switch_Chars);
865
866                --  Processing for k switch
867
868                when 'k' =>
869                   Keep_Going := True;
870
871                --  Processing for l switch
872
873                when 'l' =>
874                   Link_Only  := True;
875                   Make_Steps := True;
876
877                --  Processing for M switch
878
879                when 'M' =>
880                   List_Dependencies := True;
881
882                --  Processing for n switch
883
884                when 'n' =>
885                   Do_Not_Execute := True;
886
887                --  Processing for o switch
888
889                when 'o' =>
890                   if Output_File_Name_Present then
891                      Osint.Fail ("duplicate -o switch");
892                   else
893                      Output_File_Name_Present := True;
894                   end if;
895
896                --  Processing for p switch
897
898                when 'p' =>
899                   Setup_Projects := True;
900
901                --  Processing for q switch
902
903                when 'q' =>
904                   Quiet_Output := True;
905
906                --  Processing for R switch
907
908                when 'R' =>
909                   Run_Path_Option := False;
910
911                --  Processing for s switch
912
913                when 's' =>
914                   Ptr := Ptr + 1;
915                   Check_Switches := True;
916
917                --  Processing for v switch
918
919                when 'v' =>
920                   Verbose_Mode := True;
921                   Verbosity_Level := Opt.High;
922
923                   --  Processing for x switch
924
925                when 'x' =>
926                   External_Unit_Compilation_Allowed := True;
927                   Use_Include_Path_File := True;
928
929                   --  Processing for z switch
930
931                when 'z' =>
932                   No_Main_Subprogram := True;
933
934                   --  Any other small letter is an illegal switch
935
936                when others =>
937                   if C in 'a' .. 'z' then
938                      Bad_Switch (Switch_Chars);
939
940                   else
941                      Success := False;
942                   end if;
943
944             end case;
945          end Check_Switch;
946       end if;
947    end Scan_Make_Switches;
948
949 end Switch.M;