1 // SPDX-License-Identifier: MIT
3 * 'sparse' library helper routines.
5 * Copyright (C) 2003 Transmeta Corp.
6 * 2003-2004 Linus Torvalds
7 * 2017-2020 Luc Van Oostenryck
23 # define __GNUC_MINOR__ 95
24 # define __GNUC_PATCHLEVEL__ 0
35 int gcc_major
= __GNUC__
;
36 int gcc_minor
= __GNUC_MINOR__
;
37 int gcc_patchlevel
= __GNUC_PATCHLEVEL__
;
45 #define CMDLINE_INCLUDE 20
46 int cmdline_include_nr
= 0;
47 char *cmdline_include
[CMDLINE_INCLUDE
];
49 const char *base_filename
;
50 const char *diag_prefix
= "";
51 const char *gcc_base_dir
= GCC_BASE
;
52 const char *multiarch_dir
= MULTIARCH_TRIPLET
;
53 const char *outfile
= NULL
;
55 enum standard standard
= STANDARD_GNU89
;
57 int arch_big_endian
= ARCH_BIG_ENDIAN
;
58 int arch_cmodel
= CMODEL_UNKNOWN
;
59 int arch_fp_abi
= FP_ABI_NATIVE
;
60 int arch_m64
= ARCH_M64_DEFAULT
;
61 int arch_msize_long
= 0;
62 int arch_os
= OS_NATIVE
;
69 int dbg_postorder
= 0;
71 int dump_macro_defs
= 0;
72 int dump_macros_only
= 0;
74 unsigned long fdump_ir
;
76 unsigned int fmax_errors
= 100;
77 unsigned int fmax_warnings
= 100;
79 unsigned long long fmemcpy_max_count
= 100000;
80 unsigned long fpasses
= ~0UL;
84 int funsigned_char
= 0;
87 int Waddress_space
= 1;
89 int Wbitwise_pointer
= 0;
90 int Wcast_from_as
= 0;
92 int Wcast_truncate
= 1;
93 int Wconstant_suffix
= 0;
94 int Wconstexpr_not_const
= 0;
97 int Wdeclarationafterstatement
= -1;
98 int Wdefault_bitfield_sign
= 0;
99 int Wdesignated_init
= 1;
101 int Wenum_mismatch
= 1;
102 int Wexternal_function_has_definition
= 1;
103 int Wimplicit_int
= 1;
104 int Winit_cstring
= 0;
105 int Wint_to_pointer_cast
= 1;
106 int Wmemcpy_max_count
= 1;
107 int Wnewline_eof
= 1;
108 int Wnon_pointer_null
= 1;
109 int Wold_initializer
= 1;
110 int Wold_style_definition
= 1;
111 int Wone_bit_signed_bitfield
= 1;
112 int Woverride_init
= 1;
113 int Woverride_init_all
= 0;
114 int Woverride_init_whole_range
= 0;
115 int Wparen_string
= 0;
116 int Wpast_deep_designator
= 0;
118 int Wpointer_arith
= 0;
119 int Wpointer_to_int_cast
= 1;
120 int Wptr_subtraction_blows
= 0;
121 int Wreturn_void
= 0;
123 int Wshift_count_negative
= 1;
124 int Wshift_count_overflow
= 1;
125 int Wsizeof_bool
= 0;
126 int Wsparse_error
= FLAG_FORCE_OFF
;
127 int Wstrict_prototypes
= 1;
128 int Wtautological_compare
= 0;
129 int Wtransparent_union
= 0;
132 int Wuninitialized
= 1;
134 int Wuniversal_initializer
= 0;
135 int Wunknown_attribute
= 0;
138 ////////////////////////////////////////////////////////////////////////////////
139 // Helpers for option parsing
141 static const char *match_option(const char *arg
, const char *prefix
)
143 unsigned int n
= strlen(prefix
);
144 if (strncmp(arg
, prefix
, n
) == 0)
155 static int handle_subopt_val(const char *opt
, const char *arg
, const struct val_map
*map
, int *flag
)
160 die("missing argument for option '%s'", opt
);
161 for (;(name
= map
->name
); map
++) {
162 if (strcmp(name
, arg
) == 0 || strcmp(name
, "*") == 0) {
166 if (strcmp(name
, "?") == 0)
167 die("invalid argument '%s' in option '%s'", arg
, opt
);
178 static int apply_mask(unsigned long *val
, const char *str
, unsigned len
, const struct mask_map
*map
, int neg
)
182 for (;(name
= map
->name
); map
++) {
183 if (!strncmp(name
, str
, len
) && !name
[len
]) {
194 static int handle_suboption_mask(const char *arg
, const char *opt
, const struct mask_map
*map
, unsigned long *flag
)
197 apply_mask(flag
, "", 0, map
, 0);
203 unsigned int len
= strcspn(opt
, ",+");
207 if (!strncmp(opt
, "no-", 3)) {
212 if (apply_mask(flag
, opt
, len
, map
, neg
))
213 die("error: wrong option '%.*s' for \'%s\'", len
, opt
, arg
);
224 #define OPT_INVERSE 1
229 int (*fun
)(const char *arg
, const char *opt
, const struct flag
*, int options
);
234 static int handle_switches(const char *ori
, const char *opt
, const struct flag
*flags
)
236 const char *arg
= opt
;
239 // Prefixe "no-" mean to turn flag off.
240 if (strncmp(arg
, "no-", 3) == 0) {
245 for (; flags
->name
; flags
++) {
246 const char *opt
= match_option(arg
, flags
->name
);
255 options
|= OPT_INVERSE
;
256 if ((rc
= flags
->fun(ori
, opt
, flags
, options
)))
261 if (opt
[0] == '\0' && flags
->flag
) {
262 if (flags
->mask
& OPT_VAL
)
264 if (flags
->mask
& OPT_INVERSE
)
275 static char **handle_onoff_switch(char *arg
, char **next
, const struct flag flags
[])
281 // Prefixes "no" and "no-" mean to turn warning off.
282 if (p
[0] == 'n' && p
[1] == 'o') {
286 flag
= FLAG_FORCE_OFF
;
289 for (i
= 0; flags
[i
].name
; i
++) {
290 if (!strcmp(p
,flags
[i
].name
)) {
291 *flags
[i
].flag
= flag
;
300 static void handle_onoff_switch_finalize(const struct flag flags
[])
304 for (i
= 0; flags
[i
].name
; i
++) {
305 if (*flags
[i
].flag
== FLAG_FORCE_OFF
)
306 *flags
[i
].flag
= FLAG_OFF
;
310 static int handle_switch_setval(const char *arg
, const char *opt
, const struct flag
*flag
, int options
)
312 *(flag
->flag
) = flag
->mask
;
317 #define OPTNUM_ZERO_IS_INF 1
318 #define OPTNUM_UNLIMITED 2
320 #define OPT_NUMERIC(NAME, TYPE, FUNCTION) \
321 static int opt_##NAME(const char *arg, const char *opt, TYPE *ptr, int flag) \
326 val = FUNCTION(opt, &end, 0); \
327 if (*end != '\0' || end == opt) { \
328 if ((flag & OPTNUM_UNLIMITED) && !strcmp(opt, "unlimited")) \
331 die("error: wrong argument to \'%s\'", arg); \
333 if ((flag & OPTNUM_ZERO_IS_INF) && val == 0) \
339 OPT_NUMERIC(ullong
, unsigned long long, strtoull
)
340 OPT_NUMERIC(uint
, unsigned int, strtoul
)
342 ////////////////////////////////////////////////////////////////////////////////
345 static char **handle_switch_a(char *arg
, char **next
)
347 if (!strcmp(arg
, "ansi"))
348 standard
= STANDARD_C89
;
353 static char **handle_switch_D(char *arg
, char **next
)
355 const char *name
= arg
+ 1;
356 const char *value
= "1";
361 die("argument to `-D' is missing");
376 add_pre_buffer("#define %s %s\n", name
, value
);
380 static char **handle_switch_d(char *arg
, char **next
)
382 char *arg_char
= arg
+ 1;
385 * -d<CHARS>, where <CHARS> is a sequence of characters, not preceded
386 * by a space. If you specify characters whose behaviour conflicts,
387 * the result is undefined.
391 case 'M': /* dump just the macro definitions */
392 dump_macros_only
= 1;
395 case 'D': /* like 'M', but also output pre-processed text */
397 dump_macros_only
= 0;
399 case 'N': /* like 'D', but only output macro names not bodies */
401 case 'I': /* like 'D', but also output #include directives */
403 case 'U': /* like 'D', but only output expanded macros */
411 static char **handle_switch_E(char *arg
, char **next
)
418 static int handle_ftabstop(const char *arg
, const char *opt
, const struct flag
*flag
, int options
)
424 die("error: missing argument to \"%s\"", arg
);
426 /* we silently ignore silly values */
427 val
= strtoul(opt
, &end
, 10);
428 if (*end
== '\0' && 1 <= val
&& val
<= 100)
434 static int handle_fpasses(const char *arg
, const char *opt
, const struct flag
*flag
, int options
)
440 if (options
& OPT_INVERSE
)
446 if (options
& OPT_INVERSE
)
448 if (!strcmp(opt
, "-enable")) {
452 if (!strcmp(opt
, "-disable")) {
456 if (!strcmp(opt
, "=last")) {
457 // clear everything above
465 static int handle_fdiagnostic_prefix(const char *arg
, const char *opt
, const struct flag
*flag
, int options
)
469 diag_prefix
= "sparse: ";
472 diag_prefix
= xasprintf("%s: ", opt
+1);
479 static int handle_fdump_ir(const char *arg
, const char *opt
, const struct flag
*flag
, int options
)
481 static const struct mask_map dump_ir_options
[] = {
482 { "", PASS_LINEARIZE
},
483 { "linearize", PASS_LINEARIZE
},
484 { "mem2reg", PASS_MEM2REG
},
485 { "final", PASS_FINAL
},
489 return handle_suboption_mask(arg
, opt
, dump_ir_options
, &fdump_ir
);
492 static int handle_fmemcpy_max_count(const char *arg
, const char *opt
, const struct flag
*flag
, int options
)
494 opt_ullong(arg
, opt
, &fmemcpy_max_count
, OPTNUM_ZERO_IS_INF
|OPTNUM_UNLIMITED
);
498 static int handle_fmax_errors(const char *arg
, const char *opt
, const struct flag
*flag
, int options
)
500 opt_uint(arg
, opt
, &fmax_errors
, OPTNUM_UNLIMITED
);
504 static int handle_fmax_warnings(const char *arg
, const char *opt
, const struct flag
*flag
, int options
)
506 opt_uint(arg
, opt
, &fmax_warnings
, OPTNUM_UNLIMITED
);
510 static struct flag fflags
[] = {
511 { "diagnostic-prefix", NULL
, handle_fdiagnostic_prefix
},
512 { "dump-ir", NULL
, handle_fdump_ir
},
513 { "freestanding", &fhosted
, NULL
, OPT_INVERSE
},
514 { "hosted", &fhosted
},
515 { "linearize", NULL
, handle_fpasses
, PASS_LINEARIZE
},
516 { "max-errors=", NULL
, handle_fmax_errors
},
517 { "max-warnings=", NULL
, handle_fmax_warnings
},
518 { "mem-report", &fmem_report
},
519 { "memcpy-max-count=", NULL
, handle_fmemcpy_max_count
},
520 { "tabstop=", NULL
, handle_ftabstop
},
521 { "mem2reg", NULL
, handle_fpasses
, PASS_MEM2REG
},
522 { "optim", NULL
, handle_fpasses
, PASS_OPTIM
},
523 { "pic", &fpic
, handle_switch_setval
, 1 },
524 { "PIC", &fpic
, handle_switch_setval
, 2 },
525 { "pie", &fpie
, handle_switch_setval
, 1 },
526 { "PIE", &fpie
, handle_switch_setval
, 2 },
527 { "signed-char", &funsigned_char
, NULL
, OPT_INVERSE
},
528 { "short-wchar", &fshort_wchar
},
529 { "unsigned-char", &funsigned_char
, NULL
, },
533 static char **handle_switch_f(char *arg
, char **next
)
535 if (handle_switches(arg
-1, arg
+1, fflags
))
541 static char **handle_switch_G(char *arg
, char **next
)
543 if (!strcmp(arg
, "G") && *next
)
544 return next
+ 1; // "-G 0"
546 return next
; // "-G0" or (bogus) terminal "-G"
549 static char **handle_base_dir(char *arg
, char **next
)
551 gcc_base_dir
= *++next
;
553 die("missing argument for -gcc-base-dir option");
557 static char **handle_switch_g(char *arg
, char **next
)
559 if (!strcmp(arg
, "gcc-base-dir"))
560 return handle_base_dir(arg
, next
);
565 static char **handle_switch_I(char *arg
, char **next
)
571 add_pre_buffer("#split_include\n");
574 case '\0': /* Plain "-I" */
577 die("missing argument for -I option");
580 add_pre_buffer("#add_include \"%s/\"\n", path
);
585 static void add_cmdline_include(char *filename
)
587 if (cmdline_include_nr
>= CMDLINE_INCLUDE
)
588 die("too many include files for %s\n", filename
);
589 cmdline_include
[cmdline_include_nr
++] = filename
;
592 static char **handle_switch_i(char *arg
, char **next
)
594 if (*next
&& !strcmp(arg
, "include"))
595 add_cmdline_include(*++next
);
596 else if (*next
&& !strcmp(arg
, "imacros"))
597 add_cmdline_include(*++next
);
598 else if (*next
&& !strcmp(arg
, "isystem")) {
599 char *path
= *++next
;
601 die("missing argument for -isystem option");
602 add_pre_buffer("#add_isystem \"%s/\"\n", path
);
603 } else if (*next
&& !strcmp(arg
, "idirafter")) {
604 char *path
= *++next
;
606 die("missing argument for -idirafter option");
607 add_pre_buffer("#add_dirafter \"%s/\"\n", path
);
612 static char **handle_switch_M(char *arg
, char **next
)
614 if (!strcmp(arg
, "MF") || !strcmp(arg
,"MQ") || !strcmp(arg
,"MT")) {
616 die("missing argument for -%s option", arg
);
622 static int handle_march(const char *opt
, const char *arg
, const struct flag
*flag
, int options
)
624 if (arch_target
->parse_march
)
625 arch_target
->parse_march(arg
);
629 static int handle_mcmodel(const char *opt
, const char *arg
, const struct flag
*flag
, int options
)
631 static const struct val_map cmodels
[] = {
632 { "kernel", CMODEL_KERNEL
},
633 { "large", CMODEL_LARGE
},
634 { "medany", CMODEL_MEDANY
},
635 { "medium", CMODEL_MEDIUM
},
636 { "medlow", CMODEL_MEDLOW
},
637 { "small", CMODEL_SMALL
},
638 { "tiny", CMODEL_TINY
},
641 return handle_subopt_val(opt
, arg
, cmodels
, flag
->flag
);
644 static int handle_mfloat_abi(const char *opt
, const char *arg
, const struct flag
*flag
, int options
) {
645 static const struct val_map fp_abis
[] = {
646 { "hard", FP_ABI_HARD
},
647 { "soft", FP_ABI_SOFT
},
648 { "softfp", FP_ABI_HYBRID
},
651 return handle_subopt_val(opt
, arg
, fp_abis
, flag
->flag
);
654 static char **handle_multiarch_dir(char *arg
, char **next
)
656 multiarch_dir
= *++next
;
658 die("missing argument for -multiarch-dir option");
662 static const struct flag mflags
[] = {
663 { "64", &arch_m64
, NULL
, OPT_VAL
, ARCH_LP64
},
664 { "32", &arch_m64
, NULL
, OPT_VAL
, ARCH_LP32
},
665 { "31", &arch_m64
, NULL
, OPT_VAL
, ARCH_LP32
},
666 { "16", &arch_m64
, NULL
, OPT_VAL
, ARCH_LP32
},
667 { "x32",&arch_m64
, NULL
, OPT_VAL
, ARCH_X32
},
668 { "size-llp64", &arch_m64
, NULL
, OPT_VAL
, ARCH_LLP64
},
669 { "size-long", &arch_msize_long
},
670 { "arch=", NULL
, handle_march
},
671 { "big-endian", &arch_big_endian
, NULL
},
672 { "little-endian", &arch_big_endian
, NULL
, OPT_INVERSE
},
673 { "cmodel", &arch_cmodel
, handle_mcmodel
},
674 { "float-abi", &arch_fp_abi
, handle_mfloat_abi
},
675 { "hard-float", &arch_fp_abi
, NULL
, OPT_VAL
, FP_ABI_HARD
},
676 { "soft-float", &arch_fp_abi
, NULL
, OPT_VAL
, FP_ABI_SOFT
},
680 static char **handle_switch_m(char *arg
, char **next
)
682 if (!strcmp(arg
, "multiarch-dir")) {
683 return handle_multiarch_dir(arg
, next
);
685 handle_switches(arg
-1, arg
+1, mflags
);
691 static char **handle_nostdinc(char *arg
, char **next
)
693 add_pre_buffer("#nostdinc\n");
697 static char **handle_switch_n(char *arg
, char **next
)
699 if (!strcmp(arg
, "nostdinc"))
700 return handle_nostdinc(arg
, next
);
705 static char **handle_switch_O(char *arg
, char **next
)
708 if (arg
[1] >= '0' && arg
[1] <= '9')
709 level
= arg
[1] - '0';
710 optimize_level
= level
;
711 optimize_size
= arg
[1] == 's';
715 static char **handle_switch_o(char *arg
, char **next
)
717 if (!strcmp(arg
, "o")) { // "-o foo"
719 die("argument to '-o' is missing");
727 static const struct flag pflags
[] = {
728 { "pedantic", &Wpedantic
, NULL
, OPT_VAL
, FLAG_ON
},
732 static char **handle_switch_p(char *arg
, char **next
)
734 handle_switches(arg
-1, arg
, pflags
);
738 static char **handle_switch_s(const char *arg
, char **next
)
740 if ((arg
= match_option(arg
, "std="))) {
741 if (!strcmp(arg
, "c89") ||
742 !strcmp(arg
, "iso9899:1990"))
743 standard
= STANDARD_C89
;
745 else if (!strcmp(arg
, "iso9899:199409"))
746 standard
= STANDARD_C94
;
748 else if (!strcmp(arg
, "c99") ||
749 !strcmp(arg
, "c9x") ||
750 !strcmp(arg
, "iso9899:1999") ||
751 !strcmp(arg
, "iso9899:199x"))
752 standard
= STANDARD_C99
;
754 else if (!strcmp(arg
, "gnu89"))
755 standard
= STANDARD_GNU89
;
757 else if (!strcmp(arg
, "gnu99") || !strcmp(arg
, "gnu9x"))
758 standard
= STANDARD_GNU99
;
760 else if (!strcmp(arg
, "c11") ||
761 !strcmp(arg
, "c1x") ||
762 !strcmp(arg
, "iso9899:2011"))
763 standard
= STANDARD_C11
;
765 else if (!strcmp(arg
, "gnu11"))
766 standard
= STANDARD_GNU11
;
768 else if (!strcmp(arg
, "c17") ||
769 !strcmp(arg
, "c18") ||
770 !strcmp(arg
, "iso9899:2017") ||
771 !strcmp(arg
, "iso9899:2018"))
772 standard
= STANDARD_C17
;
773 else if (!strcmp(arg
, "gnu17") ||
774 !strcmp(arg
, "gnu18"))
775 standard
= STANDARD_GNU17
;
778 die("Unsupported C dialect");
784 static char **handle_switch_U(char *arg
, char **next
)
786 const char *name
= arg
+ 1;
791 die("argument to `-U' is missing");
793 add_pre_buffer("#undef %s\n", name
);
797 static struct flag debugs
[] = {
798 { "compound", &dbg_compound
},
799 { "dead", &dbg_dead
},
800 { "domtree", &dbg_domtree
},
801 { "entry", &dbg_entry
},
803 { "postorder", &dbg_postorder
},
807 static char **handle_switch_v(char *arg
, char **next
)
809 char ** ret
= handle_onoff_switch(arg
, next
, debugs
);
816 } while (*++arg
== 'v');
820 static void handle_switch_v_finalize(void)
822 handle_onoff_switch_finalize(debugs
);
825 static const struct flag warnings
[] = {
826 { "address", &Waddress
},
827 { "address-space", &Waddress_space
},
828 { "bitwise", &Wbitwise
},
829 { "bitwise-pointer", &Wbitwise_pointer
},
830 { "cast-from-as", &Wcast_from_as
},
831 { "cast-to-as", &Wcast_to_as
},
832 { "cast-truncate", &Wcast_truncate
},
833 { "constant-suffix", &Wconstant_suffix
},
834 { "constexpr-not-const", &Wconstexpr_not_const
},
835 { "context", &Wcontext
},
837 { "declaration-after-statement", &Wdeclarationafterstatement
},
838 { "default-bitfield-sign", &Wdefault_bitfield_sign
},
839 { "designated-init", &Wdesignated_init
},
840 { "do-while", &Wdo_while
},
841 { "enum-mismatch", &Wenum_mismatch
},
842 { "external-function-has-definition", &Wexternal_function_has_definition
},
843 { "implicit-int", &Wimplicit_int
},
844 { "init-cstring", &Winit_cstring
},
845 { "int-to-pointer-cast", &Wint_to_pointer_cast
},
846 { "memcpy-max-count", &Wmemcpy_max_count
},
847 { "non-pointer-null", &Wnon_pointer_null
},
848 { "newline-eof", &Wnewline_eof
},
849 { "old-initializer", &Wold_initializer
},
850 { "old-style-definition", &Wold_style_definition
},
851 { "one-bit-signed-bitfield", &Wone_bit_signed_bitfield
},
852 { "override-init", &Woverride_init
},
853 { "override-init-all", &Woverride_init_all
},
854 { "paren-string", &Wparen_string
},
855 { "past-deep-designator", &Wpast_deep_designator
},
856 { "pedantic", &Wpedantic
},
857 { "pointer-to-int-cast", &Wpointer_to_int_cast
},
858 { "ptr-subtraction-blows", &Wptr_subtraction_blows
},
859 { "return-void", &Wreturn_void
},
860 { "shadow", &Wshadow
},
861 { "shift-count-negative", &Wshift_count_negative
},
862 { "shift-count-overflow", &Wshift_count_overflow
},
863 { "sizeof-bool", &Wsizeof_bool
},
864 { "strict-prototypes", &Wstrict_prototypes
},
865 { "pointer-arith", &Wpointer_arith
},
866 { "sparse-error", &Wsparse_error
},
867 { "tautological-compare", &Wtautological_compare
},
868 { "transparent-union", &Wtransparent_union
},
869 { "typesign", &Wtypesign
},
870 { "undef", &Wundef
},
871 { "uninitialized", &Wuninitialized
},
872 { "union-cast", &Wunion_cast
},
873 { "universal-initializer", &Wuniversal_initializer
},
874 { "unknown-attribute", &Wunknown_attribute
},
879 static char **handle_switch_W(char *arg
, char **next
)
881 char ** ret
= handle_onoff_switch(arg
, next
, warnings
);
885 if (!strcmp(arg
, "Wsparse-all")) {
887 for (i
= 0; warnings
[i
].name
; i
++) {
888 if (*warnings
[i
].flag
!= FLAG_FORCE_OFF
)
889 *warnings
[i
].flag
= FLAG_ON
;
897 static void handle_switch_W_finalize(void)
899 handle_onoff_switch_finalize(warnings
);
901 /* default Wdeclarationafterstatement based on the C dialect */
902 if (-1 == Wdeclarationafterstatement
) {
906 Wdeclarationafterstatement
= 1;
909 Wdeclarationafterstatement
= 0;
915 static char **handle_switch_x(char *arg
, char **next
)
918 die("missing argument for -x option");
923 static char **handle_arch(char *arg
, char **next
)
928 die("missing argument for --arch option");
930 mach
= target_parse(arg
);
931 if (mach
!= MACH_UNKNOWN
)
937 static char **handle_param(char *arg
, char **next
)
941 /* For now just skip any '--param=*' or '--param *' */
944 } else if (isspace((unsigned char)*arg
) || *arg
== '=') {
949 die("missing argument for --param option");
954 static char **handle_os(char *arg
, char **next
)
957 die("missing argument for --os option");
964 static char **handle_version(char *arg
, char **next
)
966 printf("%s\n", SPARSE_VERSION
);
972 char **(*fn
)(char *, char **);
973 unsigned int prefix
:1;
976 static char **handle_long_options(char *arg
, char **next
)
978 static struct switches cmd
[] = {
979 { "arch", handle_arch
, 1 },
980 { "os", handle_os
, 1 },
981 { "param", handle_param
, 1 },
982 { "version", handle_version
},
985 struct switches
*s
= cmd
;
988 int optlen
= strlen(s
->name
);
989 if (!strncmp(s
->name
, arg
, optlen
+ !s
->prefix
))
990 return s
->fn(arg
+ optlen
, next
);
996 char **handle_switch(char *arg
, char **next
)
999 case 'a': return handle_switch_a(arg
, next
);
1000 case 'D': return handle_switch_D(arg
, next
);
1001 case 'd': return handle_switch_d(arg
, next
);
1002 case 'E': return handle_switch_E(arg
, next
);
1003 case 'f': return handle_switch_f(arg
, next
);
1004 case 'g': return handle_switch_g(arg
, next
);
1005 case 'G': return handle_switch_G(arg
, next
);
1006 case 'I': return handle_switch_I(arg
, next
);
1007 case 'i': return handle_switch_i(arg
, next
);
1008 case 'M': return handle_switch_M(arg
, next
);
1009 case 'm': return handle_switch_m(arg
, next
);
1010 case 'n': return handle_switch_n(arg
, next
);
1011 case 'o': return handle_switch_o(arg
, next
);
1012 case 'O': return handle_switch_O(arg
, next
);
1013 case 'p': return handle_switch_p(arg
, next
);
1014 case 's': return handle_switch_s(arg
, next
);
1015 case 'U': return handle_switch_U(arg
, next
);
1016 case 'v': return handle_switch_v(arg
, next
);
1017 case 'W': return handle_switch_W(arg
, next
);
1018 case 'x': return handle_switch_x(arg
, next
);
1019 case '-': return handle_long_options(arg
+ 1, next
);
1025 * Ignore unknown command line options:
1026 * they're probably gcc switches
1031 void handle_switch_finalize(void)
1033 handle_switch_v_finalize();
1034 handle_switch_W_finalize();