PR driver/69265: add hint for options with misspelled arguments
authorDavid Malcolm <dmalcolm@redhat.com>
Thu, 19 May 2016 00:52:08 +0000 (00:52 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Thu, 19 May 2016 00:52:08 +0000 (00:52 +0000)
commit70f25790a1effc8f1cba3cb8a368b129c66a87b0
tree9a1079536c4e30ba3cb0ff1e7cf8ebb14bdadd92
parent69e95fa03cda406fe61e94371244f0ba9b59339e
PR driver/69265: add hint for options with misspelled arguments

opts-common.c's cmdline_handle_error handles invalid arguments
for options with CL_ERR_ENUM_ARG by building a string listing the
valid arguments.  By also building a vec of valid arguments, we
can use find_closest_string and provide a hint if we see a close
misspelling.

gcc/ChangeLog:
PR driver/69265
* Makefile.in (GCC_OBJS): Move spellcheck.o to...
(OBJS-libcommon-target): ...here.
* opts-common.c: Include spellcheck.h.
(cmdline_handle_error): Build a vec of valid options and use it
to suggest provide hints for misspelled arguments.

gcc/testsuite/ChangeLog:
PR driver/69265
* gcc.dg/spellcheck-options-11.c: New test case.

From-SVN: r236439
gcc/ChangeLog
gcc/Makefile.in
gcc/opts-common.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/spellcheck-options-11.c [new file with mode: 0644]