From: Richard Stallman Date: Thu, 10 Jun 1993 17:47:20 +0000 (+0000) Subject: (translate_options): Don't assume option_map[j].arg_info != 0. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cc198f10a70de862defaa52b47900eace3cf7879;p=gcc.git (translate_options): Don't assume option_map[j].arg_info != 0. From-SVN: r4658 --- diff --git a/gcc/gcc.c b/gcc/gcc.c index 963eb3777b5..016d99715b1 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -731,6 +731,10 @@ translate_options (argcp, argvp) { int optlen = strlen (option_map[j].name); int complen = strlen (argv[i]); + char *arginfo = option_map[j].arg_info; + + if (arginfo == 0) + arginfo = ""; if (complen > optlen) complen = optlen; if (!strncmp (argv[i], option_map[j].name, complen)) @@ -745,19 +749,18 @@ translate_options (argcp, argvp) arg = argv[i] + optlen + 1; /* If this mapping allows extra text at end of name, accept that as "argument". */ - else if (index (option_map[j].arg_info, '*') != 0) + else if (index (arginfo, '*') != 0) arg = argv[i] + optlen; /* Otherwise, extra text at end means mismatch. Try other mappings. */ else continue; } - else if (option_map[j].arg_info != 0 - && index (option_map[j].arg_info, '*') != 0) + else if (index (arginfo, '*') != 0) error ("Incomplete `%s' option", option_map[j].name); /* Handle arguments. */ - if (index (option_map[j].arg_info, 'o') != 0) + if (index (arginfo, 'o') != 0) { if (arg == 0) { @@ -767,7 +770,7 @@ translate_options (argcp, argvp) arg = argv[++i]; } } - else if (index (option_map[j].arg_info, 'a') == 0) + else if (index (arginfo, 'a') == 0) { if (arg != 0) error ("Extraneous argument to `%s' option", @@ -776,7 +779,7 @@ translate_options (argcp, argvp) } /* Store the translation as one argv elt or as two. */ - if (arg != 0 && index (option_map[j].arg_info, 'j') != 0) + if (arg != 0 && index (arginfo, 'j') != 0) newv[newindex++] = concat (option_map[j].equivalent, arg, ""); else if (arg != 0)