OSDN Git Service

2010-12-09 Steven G. Kargl <kargl@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / ada / prepcomp.adb
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                             P R E P C O M P                              --
6 --                                                                          --
7 --                                 B o d y                                  --
8 --                                                                          --
9 --          Copyright (C) 2003-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 Ada.Unchecked_Deallocation;
27
28 with Errout;   use Errout;
29 with Lib.Writ; use Lib.Writ;
30 with Opt;      use Opt;
31 with Osint;    use Osint;
32 with Prep;     use Prep;
33 with Scans;    use Scans;
34 with Scn;      use Scn;
35 with Sinput.L; use Sinput.L;
36 with Stringt;  use Stringt;
37 with Table;
38 with Types;    use Types;
39
40 package body Prepcomp is
41
42    No_Preprocessing : Boolean := True;
43    --  Set to False if there is at least one source that needs to be
44    --  preprocessed.
45
46    Source_Index_Of_Preproc_Data_File : Source_File_Index := No_Source_File;
47
48    --  The following variable should be a constant, but this is not possible
49    --  because its type GNAT.Dynamic_Tables.Instance has a component P of
50    --  unitialized private type GNAT.Dynamic_Tables.Table_Private and there
51    --  are no exported values for this private type. Warnings are Off because
52    --  it is never assigned a value.
53
54    pragma Warnings (Off);
55    No_Mapping : Prep.Symbol_Table.Instance;
56    pragma Warnings (On);
57
58    type String_Ptr is access String;
59    type String_Array is array (Positive range <>) of String_Ptr;
60    type String_Array_Ptr is access String_Array;
61
62    procedure Free is
63       new Ada.Unchecked_Deallocation (String_Array, String_Array_Ptr);
64
65    Symbol_Definitions : String_Array_Ptr := new String_Array (1 .. 4);
66    --  An extensible array to temporarily stores symbol definitions specified
67    --  on the command line with -gnateD switches.
68
69    Last_Definition : Natural := 0;
70    --  Index of last symbol definition in array Symbol_Definitions
71
72    type Preproc_Data is record
73       Mapping      : Symbol_Table.Instance;
74       File_Name    : File_Name_Type := No_File;
75       Deffile      : String_Id      := No_String;
76       Undef_False  : Boolean        := False;
77       Always_Blank : Boolean        := False;
78       Comments     : Boolean        := False;
79       List_Symbols : Boolean        := False;
80       Processed    : Boolean        := False;
81    end record;
82    --  Structure to keep the preprocessing data for a file name or for the
83    --  default (when Name_Id = No_Name).
84
85    No_Preproc_Data : constant Preproc_Data :=
86      (Mapping      => No_Mapping,
87       File_Name    => No_File,
88       Deffile      => No_String,
89       Undef_False  => False,
90       Always_Blank => False,
91       Comments     => False,
92       List_Symbols => False,
93       Processed    => False);
94
95    Default_Data : Preproc_Data := No_Preproc_Data;
96    --  The preprocessing data to be used when no specific preprocessing data
97    --  is specified for a source.
98
99    Default_Data_Defined : Boolean := False;
100    --  True if source for which no specific preprocessing is specified need to
101    --  be preprocess with the Default_Data.
102
103    Current_Data : Preproc_Data := No_Preproc_Data;
104
105    package Preproc_Data_Table is new Table.Table
106      (Table_Component_Type => Preproc_Data,
107       Table_Index_Type     => Int,
108       Table_Low_Bound      => 1,
109       Table_Initial        => 5,
110       Table_Increment      => 100,
111       Table_Name           => "Prepcomp.Preproc_Data_Table");
112    --  Table to store the specific preprocessing data
113
114    Command_Line_Symbols : Symbol_Table.Instance;
115    --  A table to store symbol definitions specified on the command line with
116    --  -gnateD switches.
117
118    package Dependencies is new Table.Table
119      (Table_Component_Type => Source_File_Index,
120       Table_Index_Type     => Int,
121       Table_Low_Bound      => 1,
122       Table_Initial        => 10,
123       Table_Increment      => 100,
124       Table_Name           => "Prepcomp.Dependencies");
125    --  Table to store the dependencies on preprocessing files
126
127    procedure Add_Command_Line_Symbols;
128    --  Add the command line symbol definitions, if any, to Prep.Mapping table
129
130    procedure Skip_To_End_Of_Line;
131    --  Ignore errors and scan up to the next end of line or the end of file
132
133    ------------------------------
134    -- Add_Command_Line_Symbols --
135    ------------------------------
136
137    procedure Add_Command_Line_Symbols is
138       Symbol_Id : Prep.Symbol_Id;
139
140    begin
141       for J in 1 .. Symbol_Table.Last (Command_Line_Symbols) loop
142          Symbol_Id := Prep.Index_Of (Command_Line_Symbols.Table (J).Symbol);
143
144          if Symbol_Id = No_Symbol then
145             Symbol_Table.Increment_Last (Prep.Mapping);
146             Symbol_Id := Symbol_Table.Last (Prep.Mapping);
147          end if;
148
149          Prep.Mapping.Table (Symbol_Id) := Command_Line_Symbols.Table (J);
150       end loop;
151    end Add_Command_Line_Symbols;
152
153    ----------------------
154    -- Add_Dependencies --
155    ----------------------
156
157    procedure Add_Dependencies is
158    begin
159       for Index in 1 .. Dependencies.Last loop
160          Add_Preprocessing_Dependency (Dependencies.Table (Index));
161       end loop;
162    end Add_Dependencies;
163
164    ---------------------------
165    -- Add_Symbol_Definition --
166    ---------------------------
167
168    procedure Add_Symbol_Definition (Def : String) is
169    begin
170       --  If Symbol_Definitions is not large enough, double it
171
172       if Last_Definition = Symbol_Definitions'Last then
173          declare
174             New_Symbol_Definitions : constant String_Array_Ptr :=
175               new String_Array (1 .. 2 * Last_Definition);
176
177          begin
178             New_Symbol_Definitions (Symbol_Definitions'Range) :=
179               Symbol_Definitions.all;
180             Free (Symbol_Definitions);
181             Symbol_Definitions := New_Symbol_Definitions;
182          end;
183       end if;
184
185       Last_Definition := Last_Definition + 1;
186       Symbol_Definitions (Last_Definition) := new String'(Def);
187    end Add_Symbol_Definition;
188
189    -------------------
190    -- Check_Symbols --
191    -------------------
192
193    procedure Check_Symbols is
194    begin
195       --  If there is at least one switch -gnateD specified
196
197       if Symbol_Table.Last (Command_Line_Symbols) >= 1 then
198          Current_Data := No_Preproc_Data;
199          No_Preprocessing := False;
200          Current_Data.Processed := True;
201
202          --  Start with an empty, initialized mapping table; use Prep.Mapping,
203          --  because Prep.Index_Of uses Prep.Mapping.
204
205          Prep.Mapping := No_Mapping;
206          Symbol_Table.Init (Prep.Mapping);
207
208          --  Add the command line symbols
209
210          Add_Command_Line_Symbols;
211
212          --  Put the resulting Prep.Mapping in Current_Data, and immediately
213          --  set Prep.Mapping to nil.
214
215          Current_Data.Mapping := Prep.Mapping;
216          Prep.Mapping := No_Mapping;
217
218          --  Set the default data
219
220          Default_Data := Current_Data;
221          Default_Data_Defined := True;
222       end if;
223    end Check_Symbols;
224
225    ------------------------------
226    -- Parse_Preprocessing_Data --
227    ------------------------------
228
229    procedure Parse_Preprocessing_Data_File (N : File_Name_Type) is
230       OK            : Boolean := False;
231       Dash_Location : Source_Ptr;
232       Symbol_Data   : Prep.Symbol_Data;
233       Symbol_Id     : Prep.Symbol_Id;
234       T             : constant Nat := Total_Errors_Detected;
235
236    begin
237       --  Load the preprocessing data file
238
239       Source_Index_Of_Preproc_Data_File := Load_Preprocessing_Data_File (N);
240
241       --  Fail if preprocessing data file cannot be found
242
243       if Source_Index_Of_Preproc_Data_File = No_Source_File then
244          Get_Name_String (N);
245          Fail ("preprocessing data file """
246                & Name_Buffer (1 .. Name_Len)
247                & """ not found");
248       end if;
249
250       --  Initialize scanner and set its behavior for processing a data file
251
252       Scn.Scanner.Initialize_Scanner (Source_Index_Of_Preproc_Data_File);
253       Scn.Scanner.Set_End_Of_Line_As_Token (True);
254       Scn.Scanner.Reset_Special_Characters;
255
256       For_Each_Line : loop
257          <<Scan_Line>>
258          Scan;
259
260          exit For_Each_Line when Token = Tok_EOF;
261
262          if Token = Tok_End_Of_Line then
263             goto Scan_Line;
264          end if;
265
266          --  Line is not empty
267
268          OK := False;
269          No_Preprocessing := False;
270          Current_Data := No_Preproc_Data;
271
272          case Token is
273             when Tok_Asterisk =>
274
275                --  Default data
276
277                if Default_Data_Defined then
278                   Error_Msg
279                     ("multiple default preprocessing data", Token_Ptr);
280
281                else
282                   OK := True;
283                   Default_Data_Defined := True;
284                end if;
285
286             when Tok_String_Literal =>
287
288                --  Specific data
289
290                String_To_Name_Buffer (String_Literal_Id);
291                Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
292                Current_Data.File_Name := Name_Find;
293                OK := True;
294
295                for Index in 1 .. Preproc_Data_Table.Last loop
296                   if Current_Data.File_Name =
297                        Preproc_Data_Table.Table (Index).File_Name
298                   then
299                      Error_Msg_File_1 := Current_Data.File_Name;
300                      Error_Msg
301                        ("multiple preprocessing data for{", Token_Ptr);
302                      OK := False;
303                      exit;
304                   end if;
305                end loop;
306
307             when others =>
308                Error_Msg ("`'*` or literal string expected", Token_Ptr);
309          end case;
310
311          --  If there is a problem, skip the line
312
313          if not OK then
314             Skip_To_End_Of_Line;
315             goto Scan_Line;
316          end if;
317
318          --  Scan past the * or the literal string
319
320          Scan;
321
322          --  A literal string in second position is a definition file
323
324          if Token = Tok_String_Literal then
325             Current_Data.Deffile := String_Literal_Id;
326             Current_Data.Processed := False;
327             Scan;
328
329          else
330             --  If there is no definition file, set Processed to True now
331
332             Current_Data.Processed := True;
333          end if;
334
335          --  Start with an empty, initialized mapping table; use Prep.Mapping,
336          --  because Prep.Index_Of uses Prep.Mapping.
337
338          Prep.Mapping := No_Mapping;
339          Symbol_Table.Init (Prep.Mapping);
340
341          --  Check the switches that may follow
342
343          while Token /= Tok_End_Of_Line and then Token /= Tok_EOF loop
344             if Token /= Tok_Minus then
345                Error_Msg -- CODEFIX
346                  ("`'-` expected", Token_Ptr);
347                Skip_To_End_Of_Line;
348                goto Scan_Line;
349             end if;
350
351             --  Keep the location of the '-' for possible error reporting
352
353             Dash_Location := Token_Ptr;
354
355             --  Scan past the '-'
356
357             Scan;
358             OK := False;
359             Change_Reserved_Keyword_To_Symbol;
360
361             --  An identifier (or a reserved word converted to an
362             --  identifier) is expected and there must be no blank space
363             --  between the '-' and the identifier.
364
365             if Token = Tok_Identifier
366               and then Token_Ptr = Dash_Location + 1
367             then
368                Get_Name_String (Token_Name);
369
370                --  Check the character in the source, because the case is
371                --  significant.
372
373                case Sinput.Source (Token_Ptr) is
374                   when 'u' =>
375
376                      --  Undefined symbol are False
377
378                      if Name_Len = 1 then
379                         Current_Data.Undef_False := True;
380                         OK := True;
381                      end if;
382
383                   when 'b' =>
384
385                      --  Blank lines
386
387                      if Name_Len = 1 then
388                         Current_Data.Always_Blank := True;
389                         OK := True;
390                      end if;
391
392                   when 'c' =>
393
394                      --  Comment removed lines
395
396                      if Name_Len = 1 then
397                         Current_Data.Comments := True;
398                         OK := True;
399                      end if;
400
401                   when 's' =>
402
403                      --  List symbols
404
405                      if Name_Len = 1 then
406                         Current_Data.List_Symbols := True;
407                         OK := True;
408                      end if;
409
410                   when 'D' =>
411
412                      --  Symbol definition
413
414                      OK := Name_Len > 1;
415
416                      if OK then
417
418                         --  A symbol must be an Ada identifier; it cannot start
419                         --  with an underline or a digit.
420
421                         if Name_Buffer (2) = '_'
422                           or else Name_Buffer (2) in '0' .. '9'
423                         then
424                            Error_Msg ("symbol expected", Token_Ptr + 1);
425                            Skip_To_End_Of_Line;
426                            goto Scan_Line;
427                         end if;
428
429                         --  Get the name id of the symbol
430
431                         Symbol_Data.On_The_Command_Line := True;
432                         Name_Buffer (1 .. Name_Len - 1) :=
433                           Name_Buffer (2 .. Name_Len);
434                         Name_Len := Name_Len - 1;
435                         Symbol_Data.Symbol := Name_Find;
436
437                         if Name_Buffer (1 .. Name_Len) = "if"
438                           or else Name_Buffer (1 .. Name_Len) = "else"
439                           or else Name_Buffer (1 .. Name_Len) = "elsif"
440                           or else Name_Buffer (1 .. Name_Len) = "end"
441                           or else Name_Buffer (1 .. Name_Len) = "not"
442                           or else Name_Buffer (1 .. Name_Len) = "and"
443                           or else Name_Buffer (1 .. Name_Len) = "then"
444                         then
445                            Error_Msg ("symbol expected", Token_Ptr + 1);
446                            Skip_To_End_Of_Line;
447                            goto Scan_Line;
448                         end if;
449
450                         --  Get the name id of the original symbol, with
451                         --  possibly capital letters.
452
453                         Name_Len := Integer (Scan_Ptr - Token_Ptr - 1);
454
455                         for J in 1 .. Name_Len loop
456                            Name_Buffer (J) :=
457                              Sinput.Source (Token_Ptr + Text_Ptr (J));
458                         end loop;
459
460                         Symbol_Data.Original := Name_Find;
461
462                         --  Scan past D<symbol>
463
464                         Scan;
465
466                         if Token /= Tok_Equal then
467                            Error_Msg -- CODEFIX
468                              ("`=` expected", Token_Ptr);
469                            Skip_To_End_Of_Line;
470                            goto Scan_Line;
471                         end if;
472
473                         --  Scan past '='
474
475                         Scan;
476
477                         --  Here any reserved word is OK
478
479                         Change_Reserved_Keyword_To_Symbol
480                           (All_Keywords => True);
481
482                         --  Value can be an identifier (or a reserved word)
483                         --  or a literal string.
484
485                         case Token is
486                            when Tok_String_Literal =>
487                               Symbol_Data.Is_A_String := True;
488                               Symbol_Data.Value := String_Literal_Id;
489
490                            when Tok_Identifier =>
491                               Symbol_Data.Is_A_String := False;
492                               Start_String;
493
494                               for J in Token_Ptr .. Scan_Ptr - 1 loop
495                                  Store_String_Char (Sinput.Source (J));
496                               end loop;
497
498                               Symbol_Data.Value := End_String;
499
500                            when others =>
501                               Error_Msg
502                                 ("literal string or identifier expected",
503                                  Token_Ptr);
504                               Skip_To_End_Of_Line;
505                               goto Scan_Line;
506                         end case;
507
508                         --  If symbol already exists, replace old definition
509                         --  by new one.
510
511                         Symbol_Id := Prep.Index_Of (Symbol_Data.Symbol);
512
513                         --  Otherwise, add a new entry in the table
514
515                         if Symbol_Id = No_Symbol then
516                            Symbol_Table.Increment_Last (Prep.Mapping);
517                            Symbol_Id := Symbol_Table.Last (Mapping);
518                         end if;
519
520                         Prep.Mapping.Table (Symbol_Id) := Symbol_Data;
521                      end if;
522
523                   when others =>
524                      null;
525                end case;
526
527                Scan;
528             end if;
529
530             if not OK then
531                Error_Msg ("invalid switch", Dash_Location);
532                Skip_To_End_Of_Line;
533                goto Scan_Line;
534             end if;
535          end loop;
536
537          --  Add the command line symbols, if any, possibly replacing symbols
538          --  just defined.
539
540          Add_Command_Line_Symbols;
541
542          --  Put the resulting Prep.Mapping in Current_Data, and immediately
543          --  set Prep.Mapping to nil.
544
545          Current_Data.Mapping := Prep.Mapping;
546          Prep.Mapping := No_Mapping;
547
548          --  Record Current_Data
549
550          if Current_Data.File_Name = No_File then
551             Default_Data := Current_Data;
552
553          else
554             Preproc_Data_Table.Increment_Last;
555             Preproc_Data_Table.Table (Preproc_Data_Table.Last) := Current_Data;
556          end if;
557
558          Current_Data := No_Preproc_Data;
559       end loop For_Each_Line;
560
561       Scn.Scanner.Set_End_Of_Line_As_Token (False);
562
563       --  Fail if there were errors in the preprocessing data file
564
565       if Total_Errors_Detected > T then
566          Errout.Finalize (Last_Call => True);
567          Errout.Output_Messages;
568          Fail ("errors found in preprocessing data file """
569                & Get_Name_String (N) & """");
570       end if;
571
572       --  Record the dependency on the preprocessor data file
573
574       Dependencies.Increment_Last;
575       Dependencies.Table (Dependencies.Last) :=
576         Source_Index_Of_Preproc_Data_File;
577    end Parse_Preprocessing_Data_File;
578
579    ---------------------------
580    -- Prepare_To_Preprocess --
581    ---------------------------
582
583    procedure Prepare_To_Preprocess
584      (Source               : File_Name_Type;
585       Preprocessing_Needed : out Boolean)
586    is
587       Default : Boolean := False;
588       Index   : Int := 0;
589
590    begin
591       --  By default, preprocessing is not needed
592
593       Preprocessing_Needed := False;
594
595       if No_Preprocessing then
596          return;
597       end if;
598
599       --  First, look for preprocessing data specific to the current source
600
601       for J in 1 .. Preproc_Data_Table.Last loop
602          if Preproc_Data_Table.Table (J).File_Name = Source then
603             Index := J;
604             Current_Data := Preproc_Data_Table.Table (J);
605             exit;
606          end if;
607       end loop;
608
609       --  If no specific preprocessing data, then take the default
610
611       if Index = 0 then
612          if Default_Data_Defined then
613             Current_Data := Default_Data;
614             Default := True;
615
616          else
617             --  If no default, then nothing to do
618
619             return;
620          end if;
621       end if;
622
623       --  Set the preprocessing flags according to the preprocessing data
624
625       if Current_Data.Comments and then not Current_Data.Always_Blank then
626          Comment_Deleted_Lines := True;
627          Blank_Deleted_Lines   := False;
628
629       else
630          Comment_Deleted_Lines := False;
631          Blank_Deleted_Lines   := True;
632       end if;
633
634       Undefined_Symbols_Are_False := Current_Data.Undef_False;
635       List_Preprocessing_Symbols  := Current_Data.List_Symbols;
636
637       --  If not already done it, process the definition file
638
639       if Current_Data.Processed then
640
641          --  Set Prep.Mapping
642
643          Prep.Mapping := Current_Data.Mapping;
644
645       else
646          --  First put the mapping in Prep.Mapping, because Prep.Parse_Def_File
647          --  works on Prep.Mapping.
648
649          Prep.Mapping := Current_Data.Mapping;
650
651          String_To_Name_Buffer (Current_Data.Deffile);
652
653          declare
654             N           : constant File_Name_Type    := Name_Find;
655             Deffile     : constant Source_File_Index :=
656                             Load_Definition_File (N);
657             Add_Deffile : Boolean                    := True;
658             T           : constant Nat               := Total_Errors_Detected;
659
660          begin
661             if Deffile = No_Source_File then
662                Fail ("definition file """
663                      & Get_Name_String (N)
664                      & """ not found");
665             end if;
666
667             --  Initialize the preprocessor and set the characteristics of the
668             --  scanner for a definition file.
669
670             Prep.Setup_Hooks
671               (Error_Msg         => Errout.Error_Msg'Access,
672                Scan              => Scn.Scanner.Scan'Access,
673                Set_Ignore_Errors => Errout.Set_Ignore_Errors'Access,
674                Put_Char          => null,
675                New_EOL           => null);
676
677             Scn.Scanner.Set_End_Of_Line_As_Token (True);
678             Scn.Scanner.Reset_Special_Characters;
679
680             --  Initialize the scanner and process the definition file
681
682             Scn.Scanner.Initialize_Scanner (Deffile);
683             Prep.Parse_Def_File;
684
685             --  Reset the behaviour of the scanner to the default
686
687             Scn.Scanner.Set_End_Of_Line_As_Token (False);
688
689             --  Fail if errors were found while processing the definition file
690
691             if T /= Total_Errors_Detected then
692                Errout.Finalize (Last_Call => True);
693                Errout.Output_Messages;
694                Fail ("errors found in definition file """
695                      & Get_Name_String (N)
696                      & """");
697             end if;
698
699             for Index in 1 .. Dependencies.Last loop
700                if Dependencies.Table (Index) = Deffile then
701                   Add_Deffile := False;
702                   exit;
703                end if;
704             end loop;
705
706             if Add_Deffile then
707                Dependencies.Increment_Last;
708                Dependencies.Table (Dependencies.Last) := Deffile;
709             end if;
710          end;
711
712          --  Get back the mapping, indicate that the definition file is
713          --  processed and store back the preprocessing data.
714
715          Current_Data.Mapping := Prep.Mapping;
716          Current_Data.Processed := True;
717
718          if Default then
719             Default_Data := Current_Data;
720
721          else
722             Preproc_Data_Table.Table (Index) := Current_Data;
723          end if;
724       end if;
725
726       Preprocessing_Needed := True;
727    end Prepare_To_Preprocess;
728
729    ---------------------------------------------
730    -- Process_Command_Line_Symbol_Definitions --
731    ---------------------------------------------
732
733    procedure Process_Command_Line_Symbol_Definitions is
734       Symbol_Data : Prep.Symbol_Data;
735       Found : Boolean := False;
736
737    begin
738       Symbol_Table.Init (Command_Line_Symbols);
739
740       --  The command line definitions have been stored temporarily in
741       --  array Symbol_Definitions.
742
743       for Index in 1 .. Last_Definition loop
744          --  Check each symbol definition, fail immediately if syntax is not
745          --  correct.
746
747          Check_Command_Line_Symbol_Definition
748            (Definition => Symbol_Definitions (Index).all,
749             Data       => Symbol_Data);
750          Found := False;
751
752          --  If there is already a definition for this symbol, replace the old
753          --  definition by this one.
754
755          for J in 1 .. Symbol_Table.Last (Command_Line_Symbols) loop
756             if Command_Line_Symbols.Table (J).Symbol = Symbol_Data.Symbol then
757                Command_Line_Symbols.Table (J) := Symbol_Data;
758                Found := True;
759                exit;
760             end if;
761          end loop;
762
763          --  Otherwise, create a new entry in the table
764
765          if not Found then
766             Symbol_Table.Increment_Last (Command_Line_Symbols);
767             Command_Line_Symbols.Table
768               (Symbol_Table.Last (Command_Line_Symbols)) := Symbol_Data;
769          end if;
770       end loop;
771    end Process_Command_Line_Symbol_Definitions;
772
773    -------------------------
774    -- Skip_To_End_Of_Line --
775    -------------------------
776
777    procedure Skip_To_End_Of_Line is
778    begin
779       Set_Ignore_Errors (To => True);
780
781       while Token /= Tok_End_Of_Line and then Token /= Tok_EOF loop
782          Scan;
783       end loop;
784
785       Set_Ignore_Errors (To => False);
786    end Skip_To_End_Of_Line;
787
788 end Prepcomp;