annotate gcc/ada/back_end.adb @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT COMPILER COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- B A C K _ E N D --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- B o d y --
kono
parents:
diff changeset
8 -- --
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
9 -- Copyright (C) 1992-2019, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
kono
parents:
diff changeset
17 -- for more details. You should have received a copy of the GNU General --
kono
parents:
diff changeset
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
kono
parents:
diff changeset
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
kono
parents:
diff changeset
20 -- --
kono
parents:
diff changeset
21 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
23 -- --
kono
parents:
diff changeset
24 ------------------------------------------------------------------------------
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 -- This is the version of the Back_End package for GCC back ends
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 with Atree; use Atree;
kono
parents:
diff changeset
29 with Debug; use Debug;
kono
parents:
diff changeset
30 with Elists; use Elists;
kono
parents:
diff changeset
31 with Errout; use Errout;
kono
parents:
diff changeset
32 with Lib; use Lib;
kono
parents:
diff changeset
33 with Osint; use Osint;
kono
parents:
diff changeset
34 with Opt; use Opt;
kono
parents:
diff changeset
35 with Osint.C; use Osint.C;
kono
parents:
diff changeset
36 with Namet; use Namet;
kono
parents:
diff changeset
37 with Nlists; use Nlists;
kono
parents:
diff changeset
38 with Stand; use Stand;
kono
parents:
diff changeset
39 with Sinput; use Sinput;
kono
parents:
diff changeset
40 with Stringt; use Stringt;
kono
parents:
diff changeset
41 with Switch; use Switch;
kono
parents:
diff changeset
42 with Switch.C; use Switch.C;
kono
parents:
diff changeset
43 with System; use System;
kono
parents:
diff changeset
44 with Types; use Types;
kono
parents:
diff changeset
45
kono
parents:
diff changeset
46 with System.OS_Lib; use System.OS_Lib;
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 package body Back_End is
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 type Arg_Array is array (Nat) of Big_String_Ptr;
kono
parents:
diff changeset
51 type Arg_Array_Ptr is access Arg_Array;
kono
parents:
diff changeset
52 -- Types to access compiler arguments
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 flag_stack_check : Int;
kono
parents:
diff changeset
55 pragma Import (C, flag_stack_check);
kono
parents:
diff changeset
56 -- Indicates if stack checking is enabled, imported from misc.c
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 save_argc : Nat;
kono
parents:
diff changeset
59 pragma Import (C, save_argc);
kono
parents:
diff changeset
60 -- Saved value of argc (number of arguments), imported from misc.c
kono
parents:
diff changeset
61
kono
parents:
diff changeset
62 save_argv : Arg_Array_Ptr;
kono
parents:
diff changeset
63 pragma Import (C, save_argv);
kono
parents:
diff changeset
64 -- Saved value of argv (argument pointers), imported from misc.c
kono
parents:
diff changeset
65
kono
parents:
diff changeset
66 function Len_Arg (Arg : Pos) return Nat;
kono
parents:
diff changeset
67 -- Determine length of argument number Arg on original gnat1 command line
kono
parents:
diff changeset
68
kono
parents:
diff changeset
69 -------------------
kono
parents:
diff changeset
70 -- Call_Back_End --
kono
parents:
diff changeset
71 -------------------
kono
parents:
diff changeset
72
kono
parents:
diff changeset
73 procedure Call_Back_End (Mode : Back_End_Mode_Type) is
kono
parents:
diff changeset
74
kono
parents:
diff changeset
75 -- The Source_File_Record type has a lot of components that are
kono
parents:
diff changeset
76 -- meaningless to the back end, so a new record type is created
kono
parents:
diff changeset
77 -- here to contain the needed information for each file.
kono
parents:
diff changeset
78
kono
parents:
diff changeset
79 type File_Info_Type is record
kono
parents:
diff changeset
80 File_Name : File_Name_Type;
kono
parents:
diff changeset
81 Instance : Instance_Id;
kono
parents:
diff changeset
82 Num_Source_Lines : Nat;
kono
parents:
diff changeset
83 end record;
kono
parents:
diff changeset
84
kono
parents:
diff changeset
85 File_Info_Array : array (1 .. Last_Source_File) of File_Info_Type;
kono
parents:
diff changeset
86
kono
parents:
diff changeset
87 procedure gigi
kono
parents:
diff changeset
88 (gnat_root : Int;
kono
parents:
diff changeset
89 max_gnat_node : Int;
kono
parents:
diff changeset
90 number_name : Nat;
kono
parents:
diff changeset
91 nodes_ptr : Address;
kono
parents:
diff changeset
92 flags_ptr : Address;
kono
parents:
diff changeset
93
kono
parents:
diff changeset
94 next_node_ptr : Address;
kono
parents:
diff changeset
95 prev_node_ptr : Address;
kono
parents:
diff changeset
96 elists_ptr : Address;
kono
parents:
diff changeset
97 elmts_ptr : Address;
kono
parents:
diff changeset
98
kono
parents:
diff changeset
99 strings_ptr : Address;
kono
parents:
diff changeset
100 string_chars_ptr : Address;
kono
parents:
diff changeset
101 list_headers_ptr : Address;
kono
parents:
diff changeset
102 number_file : Nat;
kono
parents:
diff changeset
103
kono
parents:
diff changeset
104 file_info_ptr : Address;
kono
parents:
diff changeset
105 gigi_standard_boolean : Entity_Id;
kono
parents:
diff changeset
106 gigi_standard_integer : Entity_Id;
kono
parents:
diff changeset
107 gigi_standard_character : Entity_Id;
kono
parents:
diff changeset
108 gigi_standard_long_long_float : Entity_Id;
kono
parents:
diff changeset
109 gigi_standard_exception_type : Entity_Id;
kono
parents:
diff changeset
110 gigi_operating_mode : Back_End_Mode_Type);
kono
parents:
diff changeset
111
kono
parents:
diff changeset
112 pragma Import (C, gigi);
kono
parents:
diff changeset
113
kono
parents:
diff changeset
114 begin
kono
parents:
diff changeset
115 -- Skip call if in -gnatdH mode
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 if Debug_Flag_HH then
kono
parents:
diff changeset
118 return;
kono
parents:
diff changeset
119 end if;
kono
parents:
diff changeset
120
kono
parents:
diff changeset
121 -- The back end needs to know the maximum line number that can appear
kono
parents:
diff changeset
122 -- in a Sloc, in other words the maximum logical line number.
kono
parents:
diff changeset
123
kono
parents:
diff changeset
124 for J in 1 .. Last_Source_File loop
kono
parents:
diff changeset
125 File_Info_Array (J).File_Name := Full_Debug_Name (J);
kono
parents:
diff changeset
126 File_Info_Array (J).Instance := Instance (J);
kono
parents:
diff changeset
127 File_Info_Array (J).Num_Source_Lines :=
kono
parents:
diff changeset
128 Nat (Physical_To_Logical (Last_Source_Line (J), J));
kono
parents:
diff changeset
129 end loop;
kono
parents:
diff changeset
130
kono
parents:
diff changeset
131 -- Deal with case of generating SCIL, we should not be here unless
kono
parents:
diff changeset
132 -- debugging CodePeer mode in GNAT.
kono
parents:
diff changeset
133
kono
parents:
diff changeset
134 if Generate_SCIL then
kono
parents:
diff changeset
135 Error_Msg_N ("'S'C'I'L generation not available", Cunit (Main_Unit));
kono
parents:
diff changeset
136
kono
parents:
diff changeset
137 if CodePeer_Mode
kono
parents:
diff changeset
138 or else (Mode /= Generate_Object
kono
parents:
diff changeset
139 and then not Back_Annotate_Rep_Info)
kono
parents:
diff changeset
140 then
kono
parents:
diff changeset
141 return;
kono
parents:
diff changeset
142 end if;
kono
parents:
diff changeset
143 end if;
kono
parents:
diff changeset
144
kono
parents:
diff changeset
145 -- We should be here in GNATprove mode only when debugging GNAT. Do not
kono
parents:
diff changeset
146 -- call gigi in that case, as it is not prepared to handle the special
kono
parents:
diff changeset
147 -- form of the tree obtained in GNATprove mode.
kono
parents:
diff changeset
148
kono
parents:
diff changeset
149 if GNATprove_Mode then
kono
parents:
diff changeset
150 return;
kono
parents:
diff changeset
151 end if;
kono
parents:
diff changeset
152
kono
parents:
diff changeset
153 -- The actual call to the back end
kono
parents:
diff changeset
154
kono
parents:
diff changeset
155 gigi
kono
parents:
diff changeset
156 (gnat_root => Int (Cunit (Main_Unit)),
kono
parents:
diff changeset
157 max_gnat_node => Int (Last_Node_Id - First_Node_Id + 1),
kono
parents:
diff changeset
158 number_name => Name_Entries_Count,
kono
parents:
diff changeset
159 nodes_ptr => Nodes_Address,
kono
parents:
diff changeset
160 flags_ptr => Flags_Address,
kono
parents:
diff changeset
161
kono
parents:
diff changeset
162 next_node_ptr => Next_Node_Address,
kono
parents:
diff changeset
163 prev_node_ptr => Prev_Node_Address,
kono
parents:
diff changeset
164 elists_ptr => Elists_Address,
kono
parents:
diff changeset
165 elmts_ptr => Elmts_Address,
kono
parents:
diff changeset
166
kono
parents:
diff changeset
167 strings_ptr => Strings_Address,
kono
parents:
diff changeset
168 string_chars_ptr => String_Chars_Address,
kono
parents:
diff changeset
169 list_headers_ptr => Lists_Address,
kono
parents:
diff changeset
170 number_file => Num_Source_Files,
kono
parents:
diff changeset
171
kono
parents:
diff changeset
172 file_info_ptr => File_Info_Array'Address,
kono
parents:
diff changeset
173 gigi_standard_boolean => Standard_Boolean,
kono
parents:
diff changeset
174 gigi_standard_integer => Standard_Integer,
kono
parents:
diff changeset
175 gigi_standard_character => Standard_Character,
kono
parents:
diff changeset
176 gigi_standard_long_long_float => Standard_Long_Long_Float,
kono
parents:
diff changeset
177 gigi_standard_exception_type => Standard_Exception_Type,
kono
parents:
diff changeset
178 gigi_operating_mode => Mode);
kono
parents:
diff changeset
179 end Call_Back_End;
kono
parents:
diff changeset
180
kono
parents:
diff changeset
181 -------------------------------
kono
parents:
diff changeset
182 -- Gen_Or_Update_Object_File --
kono
parents:
diff changeset
183 -------------------------------
kono
parents:
diff changeset
184
kono
parents:
diff changeset
185 procedure Gen_Or_Update_Object_File is
kono
parents:
diff changeset
186 begin
kono
parents:
diff changeset
187 null;
kono
parents:
diff changeset
188 end Gen_Or_Update_Object_File;
kono
parents:
diff changeset
189
kono
parents:
diff changeset
190 -------------
kono
parents:
diff changeset
191 -- Len_Arg --
kono
parents:
diff changeset
192 -------------
kono
parents:
diff changeset
193
kono
parents:
diff changeset
194 function Len_Arg (Arg : Pos) return Nat is
kono
parents:
diff changeset
195 begin
kono
parents:
diff changeset
196 for J in 1 .. Nat'Last loop
kono
parents:
diff changeset
197 if save_argv (Arg).all (Natural (J)) = ASCII.NUL then
kono
parents:
diff changeset
198 return J - 1;
kono
parents:
diff changeset
199 end if;
kono
parents:
diff changeset
200 end loop;
kono
parents:
diff changeset
201
kono
parents:
diff changeset
202 raise Program_Error;
kono
parents:
diff changeset
203 end Len_Arg;
kono
parents:
diff changeset
204
kono
parents:
diff changeset
205 -----------------------------
kono
parents:
diff changeset
206 -- Scan_Compiler_Arguments --
kono
parents:
diff changeset
207 -----------------------------
kono
parents:
diff changeset
208
kono
parents:
diff changeset
209 procedure Scan_Compiler_Arguments is
kono
parents:
diff changeset
210 Next_Arg : Positive;
kono
parents:
diff changeset
211 -- Next argument to be scanned
kono
parents:
diff changeset
212
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
213 Arg_Count : constant Natural := Natural (save_argc - 1);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
214 Args : Argument_List (1 .. Arg_Count);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
215
111
kono
parents:
diff changeset
216 Output_File_Name_Seen : Boolean := False;
kono
parents:
diff changeset
217 -- Set to True after having scanned file_name for switch "-gnatO file"
kono
parents:
diff changeset
218
kono
parents:
diff changeset
219 procedure Scan_Back_End_Switches (Switch_Chars : String);
kono
parents:
diff changeset
220 -- Procedure to scan out switches stored in Switch_Chars. The first
kono
parents:
diff changeset
221 -- character is known to be a valid switch character, and there are no
kono
parents:
diff changeset
222 -- blanks or other switch terminator characters in the string, so the
kono
parents:
diff changeset
223 -- entire string should consist of valid switch characters, except that
kono
parents:
diff changeset
224 -- an optional terminating NUL character is allowed.
kono
parents:
diff changeset
225 --
kono
parents:
diff changeset
226 -- Back end switches have already been checked and processed by GCC in
kono
parents:
diff changeset
227 -- toplev.c, so no errors can occur and control will always return. The
kono
parents:
diff changeset
228 -- switches must still be scanned to skip "-o" or internal GCC switches
kono
parents:
diff changeset
229 -- with their argument.
kono
parents:
diff changeset
230
kono
parents:
diff changeset
231 ----------------------------
kono
parents:
diff changeset
232 -- Scan_Back_End_Switches --
kono
parents:
diff changeset
233 ----------------------------
kono
parents:
diff changeset
234
kono
parents:
diff changeset
235 procedure Scan_Back_End_Switches (Switch_Chars : String) is
kono
parents:
diff changeset
236 First : constant Positive := Switch_Chars'First + 1;
kono
parents:
diff changeset
237 Last : constant Natural := Switch_Last (Switch_Chars);
kono
parents:
diff changeset
238
kono
parents:
diff changeset
239 begin
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
240 -- Skip -o or internal GCC switches together with their argument
111
kono
parents:
diff changeset
241
kono
parents:
diff changeset
242 if Switch_Chars (First .. Last) = "o"
kono
parents:
diff changeset
243 or else Is_Internal_GCC_Switch (Switch_Chars)
kono
parents:
diff changeset
244 then
kono
parents:
diff changeset
245 Next_Arg := Next_Arg + 1;
kono
parents:
diff changeset
246
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
247 -- Store -G xxx as -Gxxx and go directly to the next argument
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
248
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
249 elsif Switch_Chars (First .. Last) = "G" then
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
250 Next_Arg := Next_Arg + 1;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
251
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
252 -- Should never get there with -G not followed by an argument,
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
253 -- but use defensive code nonetheless. Store as -Gxxx to avoid
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
254 -- storing parameters in ALI files that might create confusion.
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
255
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
256 if Next_Arg <= Args'Last then
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
257 Store_Compilation_Switch (Switch_Chars & Args (Next_Arg).all);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
258 end if;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
259
111
kono
parents:
diff changeset
260 -- Do not record -quiet switch
kono
parents:
diff changeset
261
kono
parents:
diff changeset
262 elsif Switch_Chars (First .. Last) = "quiet" then
kono
parents:
diff changeset
263 null;
kono
parents:
diff changeset
264
kono
parents:
diff changeset
265 -- Store any other GCC switches. Also do special processing for some
kono
parents:
diff changeset
266 -- specific switches that the Ada front-end knows about.
kono
parents:
diff changeset
267
kono
parents:
diff changeset
268 else
kono
parents:
diff changeset
269 Store_Compilation_Switch (Switch_Chars);
kono
parents:
diff changeset
270
kono
parents:
diff changeset
271 -- For gcc back ends, -fno-inline disables Inline pragmas only,
kono
parents:
diff changeset
272 -- not Inline_Always to remain consistent with the always_inline
kono
parents:
diff changeset
273 -- attribute behavior.
kono
parents:
diff changeset
274
kono
parents:
diff changeset
275 if Switch_Chars (First .. Last) = "fno-inline" then
kono
parents:
diff changeset
276 Opt.Disable_FE_Inline := True;
kono
parents:
diff changeset
277
kono
parents:
diff changeset
278 -- Back end switch -fpreserve-control-flow also sets the front end
kono
parents:
diff changeset
279 -- flag that inhibits improper control flow transformations.
kono
parents:
diff changeset
280
kono
parents:
diff changeset
281 elsif Switch_Chars (First .. Last) = "fpreserve-control-flow" then
kono
parents:
diff changeset
282 Opt.Suppress_Control_Flow_Optimizations := True;
kono
parents:
diff changeset
283
kono
parents:
diff changeset
284 -- Back end switch -fdump-scos, which exists primarily for C, is
kono
parents:
diff changeset
285 -- also accepted for Ada as a synonym of -gnateS.
kono
parents:
diff changeset
286
kono
parents:
diff changeset
287 elsif Switch_Chars (First .. Last) = "fdump-scos" then
kono
parents:
diff changeset
288 Opt.Generate_SCO := True;
kono
parents:
diff changeset
289 Opt.Generate_SCO_Instance_Table := True;
kono
parents:
diff changeset
290
kono
parents:
diff changeset
291 elsif Switch_Chars (First) = 'g' then
kono
parents:
diff changeset
292 Debugger_Level := 2;
kono
parents:
diff changeset
293
kono
parents:
diff changeset
294 if First < Last then
kono
parents:
diff changeset
295 case Switch_Chars (First + 1) is
kono
parents:
diff changeset
296 when '0' =>
kono
parents:
diff changeset
297 Debugger_Level := 0;
kono
parents:
diff changeset
298 when '1' =>
kono
parents:
diff changeset
299 Debugger_Level := 1;
kono
parents:
diff changeset
300 when '2' =>
kono
parents:
diff changeset
301 Debugger_Level := 2;
kono
parents:
diff changeset
302 when '3' =>
kono
parents:
diff changeset
303 Debugger_Level := 3;
kono
parents:
diff changeset
304 when others =>
kono
parents:
diff changeset
305 null;
kono
parents:
diff changeset
306 end case;
kono
parents:
diff changeset
307 end if;
kono
parents:
diff changeset
308 end if;
kono
parents:
diff changeset
309 end if;
kono
parents:
diff changeset
310 end Scan_Back_End_Switches;
kono
parents:
diff changeset
311
kono
parents:
diff changeset
312 -- Start of processing for Scan_Compiler_Arguments
kono
parents:
diff changeset
313
kono
parents:
diff changeset
314 begin
kono
parents:
diff changeset
315 -- Acquire stack checking mode directly from GCC. The reason we do this
kono
parents:
diff changeset
316 -- is to make sure that the indication of stack checking being enabled
kono
parents:
diff changeset
317 -- is the same in the front end and the back end. This status obtained
kono
parents:
diff changeset
318 -- from gcc is affected by more than just the switch -fstack-check.
kono
parents:
diff changeset
319
kono
parents:
diff changeset
320 Opt.Stack_Checking_Enabled := (flag_stack_check /= 0);
kono
parents:
diff changeset
321
kono
parents:
diff changeset
322 -- Put the arguments in Args
kono
parents:
diff changeset
323
kono
parents:
diff changeset
324 for Arg in Pos range 1 .. save_argc - 1 loop
kono
parents:
diff changeset
325 declare
kono
parents:
diff changeset
326 Argv_Ptr : constant Big_String_Ptr := save_argv (Arg);
kono
parents:
diff changeset
327 Argv_Len : constant Nat := Len_Arg (Arg);
kono
parents:
diff changeset
328 Argv : constant String :=
kono
parents:
diff changeset
329 Argv_Ptr (1 .. Natural (Argv_Len));
kono
parents:
diff changeset
330 begin
kono
parents:
diff changeset
331 Args (Positive (Arg)) := new String'(Argv);
kono
parents:
diff changeset
332 end;
kono
parents:
diff changeset
333 end loop;
kono
parents:
diff changeset
334
kono
parents:
diff changeset
335 -- Loop through command line arguments, storing them for later access
kono
parents:
diff changeset
336
kono
parents:
diff changeset
337 Next_Arg := 1;
kono
parents:
diff changeset
338 while Next_Arg <= Args'Last loop
kono
parents:
diff changeset
339 Look_At_Arg : declare
kono
parents:
diff changeset
340 Argv : constant String := Args (Next_Arg).all;
kono
parents:
diff changeset
341
kono
parents:
diff changeset
342 begin
kono
parents:
diff changeset
343 -- If the previous switch has set the Output_File_Name_Present
kono
parents:
diff changeset
344 -- flag (that is we have seen a -gnatO), then the next argument
kono
parents:
diff changeset
345 -- is the name of the output object file.
kono
parents:
diff changeset
346
kono
parents:
diff changeset
347 if Output_File_Name_Present and then not Output_File_Name_Seen then
kono
parents:
diff changeset
348 if Is_Switch (Argv) then
kono
parents:
diff changeset
349 Fail ("Object file name missing after -gnatO");
kono
parents:
diff changeset
350 else
kono
parents:
diff changeset
351 Set_Output_Object_File_Name (Argv);
kono
parents:
diff changeset
352 Output_File_Name_Seen := True;
kono
parents:
diff changeset
353 end if;
kono
parents:
diff changeset
354
kono
parents:
diff changeset
355 -- If the previous switch has set the Search_Directory_Present
kono
parents:
diff changeset
356 -- flag (that is if we have just seen -I), then the next argument
kono
parents:
diff changeset
357 -- is a search directory path.
kono
parents:
diff changeset
358
kono
parents:
diff changeset
359 elsif Search_Directory_Present then
kono
parents:
diff changeset
360 if Is_Switch (Argv) then
kono
parents:
diff changeset
361 Fail ("search directory missing after -I");
kono
parents:
diff changeset
362 else
kono
parents:
diff changeset
363 Add_Src_Search_Dir (Argv);
kono
parents:
diff changeset
364 Search_Directory_Present := False;
kono
parents:
diff changeset
365 end if;
kono
parents:
diff changeset
366
kono
parents:
diff changeset
367 -- If not a switch, must be a file name
kono
parents:
diff changeset
368
kono
parents:
diff changeset
369 elsif not Is_Switch (Argv) then
kono
parents:
diff changeset
370 Add_File (Argv);
kono
parents:
diff changeset
371
kono
parents:
diff changeset
372 -- We must recognize -nostdinc to suppress visibility on the
kono
parents:
diff changeset
373 -- standard GNAT RTL sources. This is also a gcc switch.
kono
parents:
diff changeset
374
kono
parents:
diff changeset
375 elsif Argv (Argv'First + 1 .. Argv'Last) = "nostdinc" then
kono
parents:
diff changeset
376 Opt.No_Stdinc := True;
kono
parents:
diff changeset
377 Scan_Back_End_Switches (Argv);
kono
parents:
diff changeset
378
kono
parents:
diff changeset
379 -- We must recognize -nostdlib to suppress visibility on the
kono
parents:
diff changeset
380 -- standard GNAT RTL objects.
kono
parents:
diff changeset
381
kono
parents:
diff changeset
382 elsif Argv (Argv'First + 1 .. Argv'Last) = "nostdlib" then
kono
parents:
diff changeset
383 Opt.No_Stdlib := True;
kono
parents:
diff changeset
384
kono
parents:
diff changeset
385 elsif Is_Front_End_Switch (Argv) then
kono
parents:
diff changeset
386 Scan_Front_End_Switches (Argv, Args, Next_Arg);
kono
parents:
diff changeset
387
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
388 elsif Argv (Argv'First + 1 .. Argv'Last) = "fopenacc" then
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
389 Opt.OpenAcc_Enabled := True;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
390
111
kono
parents:
diff changeset
391 -- All non-front-end switches are back-end switches
kono
parents:
diff changeset
392
kono
parents:
diff changeset
393 else
kono
parents:
diff changeset
394 Scan_Back_End_Switches (Argv);
kono
parents:
diff changeset
395 end if;
kono
parents:
diff changeset
396 end Look_At_Arg;
kono
parents:
diff changeset
397
kono
parents:
diff changeset
398 Next_Arg := Next_Arg + 1;
kono
parents:
diff changeset
399 end loop;
kono
parents:
diff changeset
400 end Scan_Compiler_Arguments;
kono
parents:
diff changeset
401
kono
parents:
diff changeset
402 end Back_End;