diff options
author | Richard Stallman <rms@gnu.org> | 1993-06-10 17:47:20 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1993-06-10 17:47:20 +0000 |
commit | cc198f10a70de862defaa52b47900eace3cf7879 (patch) | |
tree | c35f0c47585ab3e85195bc50b62c5557fde218dd | |
parent | e49a094d25160e3186f9cc6aee2fdadaf5649b2d (diff) | |
download | gcc-cc198f10a70de862defaa52b47900eace3cf7879.zip gcc-cc198f10a70de862defaa52b47900eace3cf7879.tar.gz gcc-cc198f10a70de862defaa52b47900eace3cf7879.tar.bz2 |
(translate_options): Don't assume option_map[j].arg_info != 0.
From-SVN: r4658
-rw-r--r-- | gcc/gcc.c | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -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) |