[Bug translation/90149] diagnostics containing BIT_FIELD_REF don't conform to diagnostics guideline
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat May 11 18:17:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90149
--- Comment #13 from Martin Sebor <msebor at gcc dot gnu.org> ---
I had started by doing that but gave up when I noticed that there are lots of
them, some like this:
if (TREE_CODE (expr) == REALPART_EXPR
|| TREE_CODE (expr) == IMAGPART_EXPR
|| TREE_CODE (expr) == BIT_FIELD_REF)
{
tree op = TREE_OPERAND (expr, 0);
if (!is_gimple_reg_type (TREE_TYPE (expr)))
{
error ("non-scalar BIT_FIELD_REF, IMAGPART_EXPR or REALPART_EXPR");
return true;
}
some like this:
case VEC_UNPACK_HI_EXPR:
case VEC_UNPACK_LO_EXPR:
case VEC_UNPACK_FLOAT_HI_EXPR:
case VEC_UNPACK_FLOAT_LO_EXPR:
case VEC_UNPACK_FIX_TRUNC_HI_EXPR:
case VEC_UNPACK_FIX_TRUNC_LO_EXPR:
...
error ("type mismatch in vector unpack expression");
that avoid mentioning the exact code altogether, or like this:
case LSHIFT_EXPR:
case RSHIFT_EXPR:
case LROTATE_EXPR:
case RROTATE_EXPR:
...
error ("type mismatch in shift expression");
and some even that "lie" for the sake of brevity. It would be nice to always
mention the exact code.
But I can save the result of get_tree_code_name (rhs_code) and use that instead
of calling it repeatedly. (My initial approach was to add a new directive to
the generic pretty-printer but, sadly, get_tree_code_name is defined in tree.c
and not available there so I'd have had to duplicate the directive code for
each front-end and for the middle-end. That seems like too much hassle.)
More information about the Gcc-bugs
mailing list