mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-29 14:40:47 +00:00
tools/gcc-frr-format: fix ICE in gcc-10
gcc-10 has a more strict internal assert for type checks so the plugin currently causes an Internal Compiler Error. Fix. Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
parent
84fa466b68
commit
cd67bcf99a
@ -2729,6 +2729,16 @@ tree type_normalize (tree type, tree *cousin, tree target = NULL)
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* gcc-10 asserts when you give a TYPE_DECL instead of the actual TYPE */
|
||||||
|
static tree
|
||||||
|
decl_deref(tree typ)
|
||||||
|
{
|
||||||
|
while (TREE_CODE (typ) == TYPE_DECL)
|
||||||
|
typ = DECL_ORIGINAL_TYPE (typ);
|
||||||
|
|
||||||
|
return typ;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
check_format_types (const substring_loc &fmt_loc,
|
check_format_types (const substring_loc &fmt_loc,
|
||||||
format_wanted_type *types, const format_kind_info *fki,
|
format_wanted_type *types, const format_kind_info *fki,
|
||||||
@ -2750,6 +2760,8 @@ check_format_types (const substring_loc &fmt_loc,
|
|||||||
wanted_type = types->wanted_type;
|
wanted_type = types->wanted_type;
|
||||||
arg_num = types->arg_num;
|
arg_num = types->arg_num;
|
||||||
|
|
||||||
|
wanted_type = decl_deref(wanted_type);
|
||||||
|
|
||||||
/* The following should not occur here. */
|
/* The following should not occur here. */
|
||||||
gcc_assert (wanted_type);
|
gcc_assert (wanted_type);
|
||||||
gcc_assert (wanted_type != void_type_node || types->pointer_count);
|
gcc_assert (wanted_type != void_type_node || types->pointer_count);
|
||||||
@ -2873,7 +2885,7 @@ check_format_types (const substring_loc &fmt_loc,
|
|||||||
|| cur_type == signed_char_type_node
|
|| cur_type == signed_char_type_node
|
||||||
|| cur_type == unsigned_char_type_node);
|
|| cur_type == unsigned_char_type_node);
|
||||||
|
|
||||||
int compat = lang_hooks.types_compatible_p (wanted_type, cur_type);
|
int compat = lang_hooks.types_compatible_p (decl_deref (wanted_type), decl_deref (cur_type));
|
||||||
/* Check the type of the "real" argument, if there's a type we want. */
|
/* Check the type of the "real" argument, if there's a type we want. */
|
||||||
if ((TREE_CODE (wanted_type) != INTEGER_TYPE || types->pointer_count)
|
if ((TREE_CODE (wanted_type) != INTEGER_TYPE || types->pointer_count)
|
||||||
&& compat)
|
&& compat)
|
||||||
@ -3180,6 +3192,9 @@ matching_type_p (tree spec_type, tree arg_type)
|
|||||||
gcc_assert (spec_type);
|
gcc_assert (spec_type);
|
||||||
gcc_assert (arg_type);
|
gcc_assert (arg_type);
|
||||||
|
|
||||||
|
spec_type = decl_deref (spec_type);
|
||||||
|
arg_type = decl_deref (arg_type);
|
||||||
|
|
||||||
/* If any of the types requires structural equality, we can't compare
|
/* If any of the types requires structural equality, we can't compare
|
||||||
their canonical types. */
|
their canonical types. */
|
||||||
if (TYPE_STRUCTURAL_EQUALITY_P (spec_type)
|
if (TYPE_STRUCTURAL_EQUALITY_P (spec_type)
|
||||||
|
Loading…
Reference in New Issue
Block a user