gcc/c/ChangeLog:
* c-decl.c (start_decl): Quote keywords, operators, and
types in diagnostics.
(finish_decl): Same.
* c-parser.c (c_parser_asm_statement): Same.
(c_parser_conditional_expression): Same.
(c_parser_transaction_cancel): Same.
* c-typeck.c (c_common_type): Same.
(build_conditional_expr): Same.
(digest_init): Same.
(process_init_element): Same.
(build_binary_op): Same.
@@ -4887,7 +4887,7 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs,
switch (TREE_CODE (decl))
{
case TYPE_DECL:
- error ("typedef %qD is initialized (use __typeof__ instead)", decl);
+ error ("typedef %qD is initialized (use %<__typeof__%> instead)", decl);
initialized = false;
break;
@@ -5282,7 +5282,7 @@ finish_decl (tree decl, location_t init_loc, tree init,
&& VAR_P (decl)
&& !C_DECL_REGISTER (decl)
&& !TREE_STATIC (decl))
- warning (0, "ignoring asm-specifier for non-static local "
+ warning (0, "ignoring %<asm%>-specifier for non-static local "
"variable %q+D", decl);
else
set_user_assembler_name (decl, asmspec);
@@ -6401,7 +6401,7 @@ c_parser_asm_statement (c_parser *parser)
case RID_VOLATILE:
if (volatile_loc)
{
- error_at (loc, "duplicate asm qualifier %qE", token->value);
+ error_at (loc, "duplicate %<asm%> qualifier %qE", token->value);
inform (volatile_loc, "first seen here");
}
else
@@ -6412,7 +6412,7 @@ c_parser_asm_statement (c_parser *parser)
case RID_INLINE:
if (inline_loc)
{
- error_at (loc, "duplicate asm qualifier %qE", token->value);
+ error_at (loc, "duplicate %<asm%> qualifier %qE", token->value);
inform (inline_loc, "first seen here");
}
else
@@ -6423,7 +6423,7 @@ c_parser_asm_statement (c_parser *parser)
case RID_GOTO:
if (goto_loc)
{
- error_at (loc, "duplicate asm qualifier %qE", token->value);
+ error_at (loc, "duplicate %<asm%> qualifier %qE", token->value);
inform (goto_loc, "first seen here");
}
else
@@ -6433,7 +6433,7 @@ c_parser_asm_statement (c_parser *parser)
case RID_CONST:
case RID_RESTRICT:
- error_at (loc, "%qE is not an asm qualifier", token->value);
+ error_at (loc, "%qE is not an %<asm%> qualifier", token->value);
c_parser_consume_token (parser);
continue;
@@ -6791,7 +6791,7 @@ c_parser_conditional_expression (c_parser *parser, struct c_expr *after,
location_t middle_loc = c_parser_peek_token (parser)->location;
pedwarn (middle_loc, OPT_Wpedantic,
- "ISO C forbids omitting the middle term of a ?: expression");
+ "ISO C forbids omitting the middle term of a %<?:%> expression");
if (TREE_CODE (cond.value) == EXCESS_PRECISION_EXPR)
{
eptype = TREE_TYPE (cond.value);
@@ -19825,8 +19825,8 @@ c_parser_transaction_cancel (c_parser *parser)
&& !is_tm_may_cancel_outer (current_function_decl))
{
error_at (loc, "outer %<__transaction_cancel%> not "
- "within outer %<__transaction_atomic%>");
- error_at (loc, " or a %<transaction_may_cancel_outer%> function");
+ "within outer %<__transaction_atomic%> or "
+ "a %<transaction_may_cancel_outer%> function");
goto ret_error;
}
}
@@ -743,17 +743,18 @@ c_common_type (tree t1, tree t2)
{
if (code1 == VECTOR_TYPE || code2 == VECTOR_TYPE)
{
- error ("can%'t mix operands of decimal float and vector types");
+ error ("cannot mix operands of decimal floating and vector types");
return error_mark_node;
}
if (code1 == COMPLEX_TYPE || code2 == COMPLEX_TYPE)
{
- error ("can%'t mix operands of decimal float and complex types");
+ error ("cannot mix operands of decimal floating and complex types");
return error_mark_node;
}
if (code1 == REAL_TYPE && code2 == REAL_TYPE)
{
- error ("can%'t mix operands of decimal float and other float types");
+ error ("cannot mix operands of decimal floating "
+ "and other floating types");
return error_mark_node;
}
}
@@ -5253,13 +5254,13 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp,
/* OK */;
else if (unsigned_op2)
warning_at (op1_loc, OPT_Wsign_compare,
- "operand of ?: changes signedness from "
+ "operand of %<?:%> changes signedness from "
"%qT to %qT due to unsignedness of other "
"operand", TREE_TYPE (orig_op1),
TREE_TYPE (orig_op2));
else
warning_at (op2_loc, OPT_Wsign_compare,
- "operand of ?: changes signedness from "
+ "operand of %<?:%> changes signedness from "
"%qT to %qT due to unsignedness of other "
"operand", TREE_TYPE (orig_op2),
TREE_TYPE (orig_op1));
@@ -7764,13 +7765,13 @@ digest_init (location_t init_loc, tree type, tree init, tree origtype,
that is counted in the length of the constant. */
if (compare_tree_int (TYPE_SIZE_UNIT (type), len - unit) < 0)
pedwarn_init (init_loc, 0,
- ("initializer-string for array of chars "
- "is too long"));
+ ("initializer-string for array of %qT "
+ "is too long"), typ1);
else if (warn_cxx_compat
&& compare_tree_int (TYPE_SIZE_UNIT (type), len) < 0)
warning_at (init_loc, OPT_Wc___compat,
- ("initializer-string for array chars "
- "is too long for C++"));
+ ("initializer-string for array of %qT "
+ "is too long for C++"), typ1);
if (compare_tree_int (TYPE_SIZE_UNIT (type), len) < 0)
{
unsigned HOST_WIDE_INT size
@@ -9888,7 +9889,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit,
&& integer_zerop (constructor_unfilled_index))
{
if (constructor_stack->replacement_value.value)
- error_init (loc, "excess elements in char array initializer");
+ error_init (loc, "excess elements in %<char%> array initializer");
constructor_stack->replacement_value = value;
return;
}
@@ -11937,7 +11938,7 @@ build_binary_op (location_t location, enum tree_code code,
if (FLOAT_TYPE_P (type0) || FLOAT_TYPE_P (type1))
warning_at (location,
OPT_Wfloat_equal,
- "comparing floating point with == or != is unsafe");
+ "comparing floating point with %<==%> or %<!=%> is unsafe");
/* Result of comparison is always int,
but don't convert the args to int! */
build_type = integer_type_node;