@@ -27,6 +27,40 @@ Function: gcc_cmdlinet::parse
27
27
28
28
\*******************************************************************/
29
29
30
+ // non-gcc options
31
+ const char *goto_cc_options_with_separated_argument[]=
32
+ {
33
+ " --verbosity" ,
34
+ " --function" ,
35
+ " --native-compiler" ,
36
+ " --native-linker" ,
37
+ " --print-rejected-preprocessed-source" ,
38
+ NULL
39
+ };
40
+
41
+ // non-gcc options
42
+ const char *goto_cc_options_without_argument[]=
43
+ {
44
+ " --show-symbol-table" ,
45
+ " --show-function-table" ,
46
+ " --ppc-macos" ,
47
+ " --i386-linux" ,
48
+ " --i386-win32" ,
49
+ " --i386-macos" ,
50
+ " --winx64" ,
51
+ " --string-abstraction" ,
52
+ " --no-library" ,
53
+ " --16" ,
54
+ " --32" ,
55
+ " --64" ,
56
+ " --little-endian" ,
57
+ " --big-endian" ,
58
+ " --no-arch" ,
59
+ " --partial-inlining" ,
60
+ " -?" ,
61
+ NULL
62
+ };
63
+
30
64
// separated or concatenated
31
65
const char *gcc_options_with_argument[]=
32
66
{
@@ -51,11 +85,6 @@ const char *gcc_options_with_argument[]=
51
85
52
86
const char *gcc_options_with_separated_argument[]=
53
87
{
54
- " --verbosity" , // non-gcc
55
- " --function" , // non-gcc
56
- " --native-compiler" , // non-gcc
57
- " --native-linker" , // non-gcc
58
- " --print-rejected-preprocessed-source" , // non-gcc
59
88
" -aux-info" ,
60
89
" --param" , // Apple only
61
90
" -imacros" ,
@@ -94,25 +123,8 @@ const char *gcc_options_with_concatenated_argument[]=
94
123
95
124
const char *gcc_options_without_argument[]=
96
125
{
97
- " --show-symbol-table" , // NON-GCC
98
- " --show-function-table" , // NON-GCC
99
- " --ppc-macos" , // NON-GCC
100
- " --i386-linux" , // NON-GCC
101
- " --i386-win32" , // NON-GCC
102
- " --i386-macos" , // NON-GCC
103
- " --winx64" , // NON_GCC
104
- " --string-abstraction" , // NON-GCC
105
- " --no-library" , // NON-GCC
106
- " --16" , // NON-GCC
107
- " --32" , // NON-GCC
108
- " --64" , // NON-GCC
109
- " --little-endian" , // NON-GCC
110
- " --big-endian" , // NON-GCC
111
- " --no-arch" , // NON-GCC
112
- " --partial-inlining" , // NON-GCC
126
+ " --help" ,
113
127
" -h" ,
114
- " --help" , // NON-GCC
115
- " -?" , // NON-GCC
116
128
" -r" , // for ld mimicking
117
129
" -dylib" , // for ld mimicking on MacOS
118
130
" -c" ,
@@ -261,14 +273,55 @@ bool gcc_cmdlinet::parse_arguments(
261
273
// file?
262
274
if (argv_i==" -" || !has_prefix (argv_i, " -" ))
263
275
{
264
- if (!spec_file )
276
+ if (!in_spec_file )
265
277
add_infile_arg (argv_i);
266
278
continue ;
267
279
}
268
280
269
- // add to new_argv
270
- if (!spec_file)
281
+ if (!in_spec_file)
282
+ {
283
+ argst::const_iterator next=it;
284
+ ++next;
285
+
286
+ bool found=false ;
287
+
288
+ if (in_list (argv_i.c_str (),
289
+ goto_cc_options_without_argument)) // without argument
290
+ {
291
+ set (argv_i);
292
+ found=true ;
293
+ }
294
+
295
+ // separated only, and also allow concatenation with "="
296
+ for (const char **o=goto_cc_options_with_separated_argument;
297
+ *o!=NULL && !found;
298
+ ++o)
299
+ {
300
+ if (argv_i==*o) // separated
301
+ {
302
+ found=true ;
303
+ if (next!=args.end ())
304
+ {
305
+ set (argv_i, *next);
306
+ ++it;
307
+ }
308
+ else
309
+ set (argv_i, " " );
310
+ }
311
+ // concatenated with "="
312
+ else if (has_prefix (argv_i, std::string (*o)+" =" ))
313
+ {
314
+ found=true ;
315
+ set (*o, argv_i.substr (strlen (*o)+1 ));
316
+ }
317
+ }
318
+
319
+ if (found)
320
+ continue ;
321
+
322
+ // add to new_argv
271
323
add_arg (argv_i);
324
+ }
272
325
273
326
// also store in cmdlinet
274
327
0 commit comments