On Sat, 2023-12-02 at 16:14 +0800, Lulu Cheng wrote:
/* snip */
> diff --git a/gcc/config/loongarch/loongarch-opts.cc
> b/gcc/config/loongarch/loongarch-opts.cc
> index b5836f198c0..6861642a98d 100644
> --- a/gcc/config/loongarch/loongarch-opts.cc
> +++ b/gcc/config/loongarch/loongarch-opts.cc
> @@ -163,6 +163,7 @@ loongarch_config_target (struct loongarch_target
> *target,
> int follow_multilib_list_p)
> {
> struct loongarch_target t;
> +
> if (!target)
> return;
>
> @@ -657,12 +658,18 @@ abi_str (struct loongarch_abi abi)
> strlen (loongarch_abi_base_strings[abi.base]));
> else
> {
> + /* This situation has not yet occurred, so in order to avoid
> the
> + -Warray-bounds warning during C++ syntax checking, this part
> + of the code is commented first.*/
> + /*
Just put a "gcc_unreachable ();" here?
> APPEND_STRING (loongarch_abi_base_strings[abi.base])
> APPEND1 ('/')
> APPEND_STRING (loongarch_abi_ext_strings[abi.ext])
> APPEND1 ('\0')
>
> return XOBFINISH (&msg_obstack, const char *);
> + */
> + gcc_unreachable ();
> }
> }
>
> diff --git a/gcc/config/loongarch/loongarch-opts.h
> b/gcc/config/loongarch/loongarch-opts.h
> index fa3773223bc..7a644c86d48 100644
> --- a/gcc/config/loongarch/loongarch-opts.h
> +++ b/gcc/config/loongarch/loongarch-opts.h
> @@ -21,7 +21,10 @@ along with GCC; see the file COPYING3. If not see
> #ifndef LOONGARCH_OPTS_H
> #define LOONGARCH_OPTS_H
>
> +/* This is a C++ header and it shouldn't be used by target libraries. */
> +#if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) && !defined(IN_RTS)
> #include "loongarch-def.h"
> +#endif
With this change we can revert r14-5634 (remove the #if
!defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) && !defined(IN_RTS)
guards in loongarch-def.h as they'll be unneeded).
--
Xi Ruoyao <[email protected]>
School of Aerospace Science and Technology, Xidian University