-foptimize-sibling-calls |
Refer to flag_optimize_sibling_calls |
CL_COMMON |
-foptional-diags |
Enable optional diagnostics |
CL_CXX | CL_ObjCXX |
-fpack-struct |
Refer to flag_pack_struct |
CL_COMMON |
-fpcc-struct-return |
Refer to flag_pcc_struct_return |
CL_COMMON |
-fpch-deps |
When using precompiled headers, this flag will cause the dependency-output flags to also list the files from the precompiled header’s dependencies. If not specified only the precompiled header would be listed and not the files that were used to create it because those files are not consulted when a precompiled header is used. |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX |
-fpeel-loops |
Refer to flag_peel_loops |
CL_COMMON |
-fpeephole |
Refer to flag_no_peephole |
CL_COMMON |
-fpeephole2 |
Refer to flag_peephole2 |
CL_COMMON |
-fpermissive |
Refer to flag_permissive |
CL_CXX | CL_ObjCXX |
-fpic |
Refer to flag_pic |
CL_COMMON |
-fpie |
Refer to flag_pie |
CL_COMMON |
-fprefetch-loop-arrays |
Refer to flag_prefetch_loop_arrays |
CL_COMMON |
-fpreprocessed |
Refer to flag_preprocess_only |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX |
-fprofile |
Enable basic program profiling code |
CL_COMMON |
-fprofile-arcs |
Insert arc-based program profiling code |
CL_COMMON |
-fprofile-generate |
Enable common options for generating profile info for profile feedback directed optimizations |
CL_COMMON |
-fprofile-use |
Enable common options for performing profile feedback directed optimizations |
CL_COMMON |
-fprofile-values |
Insert code to profile values of expressions |
CL_COMMON |
-frandom-seed |
Refer to flag_random_seed |
CL_COMMON |
-frandom-seed=<string> |
CL_COMMON | CL_JOINED | CL_REJECT_NEGATIVE |
|
-freduce-all-givs |
Refer to flag_reduce_all_givs |
CL_COMMON |
-freg-struct-return |
Return small aggregates in registers |
CL_COMMON |
-fregmove |
Enables a register move optimization |
CL_COMMON |
-frename-registers |
Perform a register renaming optimization pass |
CL_COMMON |
-freorder-blocks |
Refer to flag_reorder_blocks |
CL_COMMON |
-freorder-functions |
Refer to flag_reorder_functions |
CL_COMMON |
-frepo |
Enable automatic template instantiation |
CL_CXX | CL_ObjCXX |
-frerun-cse-after-loop |
Add a common subexpression elimination pass after loop optimizations |
CL_COMMON |
-frerun-loop-opt |
Run the loop optimizer twice |
CL_COMMON |
-frounding-math |
Disable optimizations that assume default FP rounding behavior |
CL_COMMON |
-frtti |
Generate run time type descriptor information |
CL_CXX | CL_ObjCXX |
-fsched-interblock |
Enable scheduling across basic blocks |
CL_COMMON |
-fsched-spec |
Refer to flag_schedule_speculative |
CL_COMMON |
-fsched-spec-load |
Refer to flag_schedule_speculative_load |
CL_COMMON |
-fsched-spec-load-dangerous |
Refer to flag_schedule_speculative_load_dangerous |
CL_COMMON |
-fsched-stalled-insns |
Refer to flag_sched_stalled_insns |
CL_COMMON |
-fsched-stalled-insns=<number> |
CL_COMMON | CL_JOINED | CL_REJECT_NEGATIVE | CL_UINTEGER |
|
-fsched-stalled-insns-dep |
Refer to flag_sched_stalled_insns_dep |
CL_COMMON |
-fsched-stalled-insns-dep=<number> |
CL_COMMON | CL_JOINED | CL_REJECT_NEGATIVE | CL_UINTEGER |
|
-fsched-verbose=<number> |
Set the verbosity level of the scheduler |
CL_COMMON | CL_JOINED | CL_REJECT_NEGATIVE |
-fsched2-use-superblocks |
Refer to flag_sched2_use_superblocks |
CL_COMMON |
-fsched2-use-traces |
Refer to flag_sched2_use_traces |
CL_COMMON |
-fschedule-insns |
Refer to flag_schedule_insns |
CL_COMMON |
-fschedule-insns2 |
Refer to flag_schedule_insns_after_reload |
CL_COMMON |
-fshared-data |
Refer to flag_shared_data |
CL_COMMON |
-fshort-double |
Refer to flag_short_double |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX |
-fshort-enums |
Refer to flag_short_enums |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX |
-fshort-wchar |
Refer to flag_short_wchar |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX |
-fshow-column |
!!! This switch lacks documentation |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX |
-fsignaling-nans |
Refer to flag_signaling_nans |
CL_COMMON |
-fsigned-bitfields |
When "signed" or "unsigned" is not given make the bitfield signed |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX |
-fsigned-char |
Make "char" signed by default |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX |
-fsingle-precision-constant |
Convert floating point constants to single precision constants |
CL_COMMON |
-fsquangle |
Depricated |
CL_CXX | CL_ObjCXX |
-fstack-check |
Insert stack checking code into the program |
CL_COMMON |
-fstack-limit |
Refer to stack_limit_rtx |
CL_COMMON |
-fstack-limit-register=<register> |
CL_COMMON | CL_JOINED | CL_REJECT_NEGATIVE |
|
-fstack-limit-symbol=<name> |
||
-fstats |
Display statistics accumulated during compilation |
CL_CXX | CL_ObjCXX |
-fstrength-reduce |
Perform strength reduction optimizations |
CL_COMMON |
-fstrict-aliasing |
Assume strict aliasing rules apply |
CL_COMMON |
-fstrict-prototype |
Depricated |
CL_CXX | CL_ObjCXX |
-fsyntax-only |
Check for syntax errors, then stop |
CL_COMMON |
-ftabstop=<number> |
Distance between tab stops for column reporting |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX | CL_JOINED | CL_REJECT_NEGATIVE | CL_UINTEGER |
-ftemplate-depth-<number> |
Specify maximum template instantiation depth |
CL_CXX | CL_ObjCXX | CL_JOINED | CL_REJECT_NEGATIVE | CL_UINTEGER |
-ftest-coverage |
Create data files needed by "gcov" |
CL_COMMON |
-fthis-is-variable |
Depricated |
CL_CXX | CL_ObjCXX |
-fthread-jumps |
Refer to flag_thread_jumps |
CL_COMMON |
-ftime-report |
Report the time taken by each compiler pass |
CL_COMMON |
-ftls-model=[global-dynamic|local-dynamic|initial-exec|local-exec] |
Set the default thread-local storage code generation model |
CL_COMMON | CL_JOINED | CL_REJECT_NEGATIVE |
-ftracer |
Refer to flag_tracer |
CL_COMMON |
-ftrapping-math |
Assume floating-point operations can trap |
CL_COMMON |
-ftrapv |
Trap for signed overflow in addition, subtraction and multiplication |
CL_COMMON |
-funit-at-a-time |
Compile whole compilation unit at a time |
CL_COMMON |
-funroll-all-loops |
Perform loop unrolling for all loops |
CL_COMMON |
-funroll-loops |
Perform loop unrolling when iteration count is known |
CL_COMMON |
-funsafe-math-optimizations |
Allow math optimizations that may violate IEEE or ISO standards |
CL_COMMON |
-funsigned-bitfields |
When "signed" or "unsigned" is not given make the bitfield unsigned |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX |
-funsigned-char |
Make "char" unsigned by default |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX |
-funswitch-loops |
Refer to flag_unswitch_loops |
CL_COMMON |
-funwind-tables |
Refer to flag_unwind_tables |
CL_COMMON |
-fuse-cxa-atexit |
Use __cxa_atexit to register destructors |
CL_CXX | CL_ObjCXX |
-fverbose-asm |
Add extra commentary to assembler output |
CL_COMMON |
-fvpt |
Use expression value profiles in optimizations |
CL_COMMON |
-fvtable-gc |
Discard unused virtual functions |
CL_CXX | CL_ObjCXX |
-fvtable-thunks |
Implement vtables using thunks |
CL_CXX | CL_ObjCXX |
-fweak |
Refer to flag_weak |
CL_CXX | CL_ObjCXX |
-fweb |
Refer to flag_web |
CL_COMMON |
-fwide-exec-charset=<cset> |
Convert all wide strings and character constants to character set <cset> |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX | CL_JOINED | CL_REJECT_NEGATIVE |
-fworking-directory |
Generate a #line directive pointing at the current working directory |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX |
-fwrapv |
Assume signed arithmetic overflow wraps around |
CL_COMMON |
-fwritable-strings |
Store strings in writable data section |
CL_COMMON |
-fxref |
Emit cross referencing information |
CL_CXX | CL_ObjCXX |
-fzero-initialized-in-bss |
Put zero initialized data in the bss section |
CL_COMMON |
-g |
Generate debug information in default format |
CL_COMMON | CL_JOINED | CL_MISSING_OK |
-gcoff |
Generate debug information in COFF format |
CL_COMMON | CL_JOINED | CL_MISSING_OK |
-gdwarf-2 |
Generate debug information in DWARF v2 format |
CL_COMMON | CL_JOINED | CL_MISSING_OK |
-ggdb |
Generate debug information in default extended format |
CL_COMMON | CL_JOINED | CL_MISSING_OK |
-gstabs |
Generate debug information in STABS format |
CL_COMMON | CL_JOINED | CL_MISSING_OK |
-gstabs+ |
Generate debug information in extended STABS format |
CL_COMMON | CL_JOINED | CL_MISSING_OK |
-gvms |
Generate debug information in VMS format |
CL_COMMON | CL_JOINED | CL_MISSING_OK |
-gxcoff |
Generate debug information in XCOFF format |
CL_COMMON | CL_JOINED | CL_MISSING_OK |
-gxcoff+ |
Generate debug information in extended XCOFF format |
CL_COMMON | CL_JOINED | CL_MISSING_OK |
-idirafter<dir> |
Add <dir> to the end of the system include path |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX | CL_JOINED | CL_SEPARATE |
-imacros<file> |
Accept definition of macros in <file>, but throw away any output produced by scanning <file> |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX | CL_JOINED | CL_SEPARATE |
-include<file> |
Include the contents of <file> before other files |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX | CL_JOINED | CL_SEPARATE |
-iprefix<path> |
Refer to iprefix |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX | CL_JOINED | CL_SEPARATE |
-isysroot<dir> |
Set <dir> to be the system root directory |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX | CL_JOINED | CL_SEPARATE |
-isystem<dir> |
Add <dir> to the start of the system include path |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX | CL_JOINED | CL_SEPARATE |
-iwithprefix<dir> |
Refer to add_prefixed_path |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX | CL_JOINED | CL_SEPARATE |
-iwithprefixbefore<dir> |
||
-lang-asm |
!!! This switch lacks documentation |
CL_C | CL_UNDOCUMENTED |
-lang-objc |
Compile code of objC |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX | CL_UNDOCUMENTED |
-m |
Prefix for options related to target |
CL_COMMON | CL_JOINED |
-nostdinc |
Do not search standard system include directories (those specified with -isystem will still be used) |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX |
-nostdinc++ |
Do not search standard system include directories for C++ |
CL_CXX | CL_ObjCXX |
-o <file> |
Place output into <file> |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX | CL_COMMON | CL_JOINED | CL_SEPARATE |
-p |
Enable function profiling |
CL_COMMON |
-pedantic |
Issue warnings needed for strict compliance to the standard |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX | CL_COMMON |
-pedantic-errors |
Like -pedantic but issue them as errors |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX | CL_COMMON |
-quiet |
Do not display functions compiled or elapsed time |
CL_COMMON |
-remap |
Enable special code to work around file systems which only permit very shortfile names, such as MS-DOS. |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX |
-std=c++98 |
Conform to the ISO 1998 C++ standard |
CL_CXX | CL_ObjCXX |
-std=c89 |
Conform to the ISO 1990 C standard |
CL_C | CL_ObjC |
-std=c99 |
Conform to the ISO 1999 C standard |
CL_C | CL_ObjC |
-std=c9x |
Deprecated in favor of -std=c99 |
CL_C | CL_ObjC |
-std=gnu++98 |
Conform to the ISO 1998 C++ standard with GNU extensions |
CL_CXX | CL_ObjCXX |
-std=gnu89 |
Conform to the ISO 1990 C standard with GNU extensions |
CL_C | CL_ObjC |
-std=gnu99 |
Conform to the ISO 1999 C standard with GNU extensions |
CL_C | CL_ObjC |
-std=gnu9x |
Deprecated in favor of -std=gnu99 |
CL_C | CL_ObjC |
-std=iso9899:1990 |
Conform to the ISO 1990 C standard |
CL_C | CL_ObjC |
-std=iso9899:199409 |
Conform to the ISO 1990 C standard as amended in 1994 |
CL_C | CL_ObjC |
-std=iso9899:1999 |
Conform to the ISO 1999 C standard |
CL_C | CL_ObjC |
-std=iso9899:199x |
Deprecated in favor of -std=iso9899:1999 |
CL_C | CL_ObjC |
-traditional-cpp |
Enable traditional preprocessing |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX |
-trigraphs |
Support ISO C trigraphs |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX |
-undef |
Do not predefine system-specific and GCC-specific macros |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX |
-v |
Enable verbose output |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX |
-version |
Display the compiler's version |
CL_COMMON |
-w |
Suppress warnings |
CL_C | CL_CXX | CL_ObjC | CL_ObjCXX | CL_COMMON |
Table 11: C++ language specified options
In above table, options are assigned variable flags set, in which 2 groups are identified. One is to indicate the specified langauge the options applied.
3 #define CL_C (1 << 0) in options.h
4 #define CL_CXX (1 << 1)
5 #define CL_ObjC (1 << 2)
6 #define CL_ObjCXX (1 << 3)
The other tells other characteristics of the options, in which CL_COMMON should belong to first group.
40 #define CL_JOINED (1 << 24) /* If takes joined argument. */ in opts.h
41 #define CL_SEPARATE (1 << 25) /* If takes a separate argument. */
42 #define CL_REJECT_NEGATIVE (1 << 26) /* Reject no- form. */
43 #define CL_MISSING_OK (1 << 27) /* Missing argument OK (joined). */
44 #define CL_UINTEGER (1 << 28) /* Argument is an integer >=0. */
45 #define CL_COMMON (1 << 29) /* Language-independent. */
46 #define CL_UNDOCUMENTED (1 << 30) /* Do not output with --help. */
When arriving here, it means the option really within cl_options, it now needs to check its validity. Below testing at line 397 has been executed by find_opt, however find_opt still accepts the unmatching options for the language; so here find them out again, gives out warning and does abandonment.
handle_option (continue)
364 /* We've recognized this switch. */
365 result = 1;
366
367 /* Sort out any argument the switch takes. */
368 if (option->flags & CL_JOINED)
369 {
370 /* Have arg point to the original switch. This is because
371 some code, such as disable_builtin_function, expects its
372 argument to be persistent until the program exits. */
373 arg = argv[0] + cl_options[opt_index].opt_len + 1;
374 if (!value)
375 arg += strlen ("no-");
376
377 if (*arg == '/0' && !(option->flags & CL_MISSING_OK))
378 {
379 if (option->flags & CL_SEPARATE)
380 {
381 arg = argv[1];
382 result = 2;
383 }
384 else
385 /* Missing argument. */
386 arg = NULL;
387 }
388 }
389 else if (option->flags & CL_SEPARATE)
390 {
391 arg = argv[1];
392 result = 2;
393 }
394
395 /* Now we've swallowed any potential argument, complain if this
396 is a switch for a different front end. */
397 if (!(option->flags & (lang_mask | CL_COMMON)))
398 {
399 complain_wrong_lang (argv[0], option, lang_mask);
400 goto done;
401 }
402
403 if (arg == NULL && (option->flags & (CL_JOINED | CL_SEPARATE)))
404 {
405 if (!(*lang_hooks.missing_argument) (opt, opt_index))
406 error ("missing argument to /"%s/"", opt);
407 goto done;
408 }
409
410 /* If the switch takes an integer, convert it. */
411 if (arg && (option->flags & CL_UINTEGER))
412 {
413 value = integral_argument (arg);
414 if (value == -1)
415 {
416 error ("argument to /"%s/" should be a non-negative integer",
417 option->opt_text);
418 goto done;
419 }
420 }
For option of CL_JOINED, it looks like -A=value or -Avalue, and for option of CL_SEPARATE, it looks like -A= value or -A value. So above code snippet fetches the parameter of the option.
handle_option (continue)
422 if (option->flags & lang_mask)
423 if ((*lang_hooks.handle_option) (opt_index, arg, value) == 0)
424 result = 0;
425
426 if (result && (option->flags & CL_COMMON))
427 if (c_common_handle_option (opt_index, arg, value) == 0)
428 result = 0;
429
430 done:
431 if (dup)
432 free (dup);
433 return result;
434 }
Condition at line 422 selects out the options specially for the language, and passes them to the hook of the front-end.