[arm] PR target/83193: Do not print arch/cpu hints twice on invalid -march/-mcpu
commit4eb5d65231dc4cc395a7e2d83b91dc89d2554b24
authorktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 9 Mar 2018 15:42:10 +0000 (9 15:42 +0000)
committerktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 9 Mar 2018 15:42:10 +0000 (9 15:42 +0000)
tree0793b593ec8e160f63556156df25265d0c1b92c4
parent7176d3663982d25a6497a63277f92fafb4771e50
[arm] PR target/83193: Do not print arch/cpu hints twice on invalid -march/-mcpu

Currently when handling an invalid -march or -mcpu option on a toolchain without an explicit --with-mode configuration
and compiling without an explicit -mthumb or -marm the arm specs end up calling arm_target_thumb_only to determine
the "thumbness" of the target, which involves parsing the architecture or cpu name. But the functions doing that
parsing also emit error messages and hints on invalid arguments. Later when we parse the architecture or cpu string to
as part of the canonicalisation process (arm_canon_arch_option) we end up emitting the errors again.

The solution in this patch is to silence the errors during the arm_target_thumb_only processing so that they are not emitted
twice. arm_canon_arch_option is guaranteed to run as well, so it can emit the errors and hints that it needs.

Bootstrapped and tested on arm-none-linux-gnueabihf.

Checked that we emit the arch/cpu hints for invalid -march/-mcpu options only once when no "thumbness" options were specified
during configuration or invocation.

PR target/83193
* common/config/arm/arm-common.c (arm_parse_arch_option_name):
Accept complain bool parameter.  Only emit errors if it is true.
(arm_parse_cpu_option_name): Likewise.
(arm_target_thumb_only): Adjust callers of the above.
* config/arm/arm-protos.h (arm_parse_cpu_option_name): Adjust
prototype to take a default true bool parameter.
(arm_parse_arch_option_name): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@258389 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/common/config/arm/arm-common.c
gcc/config/arm/arm-protos.h