intel/tools: allow --color option to be used without arg

There's already code handling that case and help text also says
it's possible.

Found, because Coverity complained about optarg NULL check,
suggesting optarg can be NULL for other options, where it's not
possible. IOW, false positive lead me to finding an unrelated issue.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7449>
This commit is contained in:
Marcin Ślusarz 2020-11-04 17:33:53 +01:00 committed by Marge Bot
parent 0dad1a7c72
commit d13b7d6591
2 changed files with 2 additions and 2 deletions

View File

@ -297,7 +297,7 @@ int main(int argc, char *argv[])
{ "no-offsets", no_argument, (int *) &option_print_offsets, false },
{ "gen", required_argument, NULL, 'g' },
{ "headers", no_argument, (int *) &option_full_decode, false },
{ "color", required_argument, NULL, 'c' },
{ "color", optional_argument, NULL, 'c' },
{ "xml", required_argument, NULL, 'x' },
{ "max-vbo-lines", required_argument, NULL, 'v' },
{ NULL, 0, NULL, 0 }

View File

@ -759,7 +759,7 @@ main(int argc, char *argv[])
{ "no-pager", no_argument, (int *) &pager, false },
{ "no-offsets", no_argument, (int *) &option_print_offsets, false },
{ "headers", no_argument, (int *) &option_full_decode, false },
{ "color", required_argument, NULL, 'c' },
{ "color", optional_argument, NULL, 'c' },
{ "xml", required_argument, NULL, 'x' },
{ "all-bb", no_argument, (int *) &option_print_all_bb, true },
{ NULL, 0, NULL, 0 }