summaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-12 23:53:29 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-12 23:53:29 +0000
commitb0b1af642fd3c2318975ed201648def1b7aee348 (patch)
tree55c81129e5904e9a77beedcea89e8ae836694907 /gcc/c-common.c
parent29dcf6e523dfe91a272557e419a034df52b1343b (diff)
downloadgcc-b0b1af642fd3c2318975ed201648def1b7aee348.tar.gz
* c-common.c, c-decl.c, c-lex.c, c-objc-common.c, c-opts.c,
c-parse.in, c-pragma.c, c-typeck.c: Use %q, %< and %> for quoting in diagnostics. Use %' for English apostrophes. * c-tree.h (ATTRIBUTE_GCC_CDIAG): Define. (pedwarn_c90, pedwarn_c99): Use it. * c-decl.c (lookup_label): Quote label name in diagnostic. * c-parse.in (yyprint): Use ' instead of ` for left quote. * c-typeck.c (warn_for_assignment): Likewise. testsuite: * g++.dg/warn/Wswitch-1.C, g++.dg/warn/Wswitch-2.C, gcc.dg/Wswitch-2.c, gcc.dg/Wswitch-enum.c, gcc.dg/Wswitch.c, gcc.dg/declspec-9.c, gcc.dg/declspec-10.c, gcc.dg/declspec-11.c, gcc.dg/m-un-2.c, gcc.dg/noreturn-1.c, gcc.dg/wtr-conversion-1.c: Update expected messages. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@87413 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c110
1 files changed, 55 insertions, 55 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 2b13588c85a..47494106824 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -828,7 +828,7 @@ fname_decl (unsigned int rid, tree id)
input_location = saved_location;
}
if (!ix && !current_function_decl)
- pedwarn ("%J'%D' is not defined outside of function scope", decl, decl);
+ pedwarn ("%J%qD is not defined outside of function scope", decl, decl);
return decl;
}
@@ -849,7 +849,7 @@ fix_string_type (tree value)
nchars = wide_flag ? length / wchar_bytes : length;
if (pedantic && nchars - 1 > nchars_max && !c_dialect_cxx ())
- pedwarn ("string length `%d' is greater than the length `%d' ISO C%d compilers are required to support",
+ pedwarn ("string length %qd is greater than the length %qd ISO C%d compilers are required to support",
nchars - 1, nchars_max, flag_isoc99 ? 99 : 89);
e_type = wide_flag ? wchar_type_node : char_type_node;
@@ -1135,7 +1135,7 @@ warn_for_collisions_1 (tree written, tree writer, struct tlist *list,
&& DECL_NAME (list->expr))
{
warned_ids = new_tlist (warned_ids, written, NULL_TREE);
- warning ("operation on `%s' may be undefined",
+ warning ("operation on %qs may be undefined",
IDENTIFIER_POINTER (DECL_NAME (list->expr)));
}
list = list->next;
@@ -2229,7 +2229,7 @@ pointer_int_sum (enum tree_code resultcode, tree ptrop, tree intop)
if (TREE_CODE (TREE_TYPE (result_type)) == VOID_TYPE)
{
if (pedantic || warn_pointer_arith)
- pedwarn ("pointer of type `void *' used in arithmetic");
+ pedwarn ("pointer of type %<void *%> used in arithmetic");
size_exp = integer_one_node;
}
else if (TREE_CODE (TREE_TYPE (result_type)) == FUNCTION_TYPE)
@@ -2349,7 +2349,7 @@ c_common_truthvalue_conversion (tree expr)
{
/* Common Ada/Pascal programmer's mistake. We always warn
about this since it is so bad. */
- warning ("the address of `%D', will always evaluate as `true'",
+ warning ("the address of %qD, will always evaluate as %<true%>",
TREE_OPERAND (expr, 0));
return truthvalue_true_node;
}
@@ -2494,7 +2494,7 @@ c_build_qualified_type (tree type, int type_quals)
&& (!POINTER_TYPE_P (type)
|| !C_TYPE_OBJECT_OR_INCOMPLETE_P (TREE_TYPE (type))))
{
- error ("invalid use of `restrict'");
+ error ("invalid use of %<restrict%>");
type_quals &= ~TYPE_QUAL_RESTRICT;
}
@@ -2534,7 +2534,7 @@ c_apply_type_quals_to_decl (int type_quals, tree decl)
if (!type
|| !POINTER_TYPE_P (type)
|| !C_TYPE_OBJECT_OR_INCOMPLETE_P (TREE_TYPE (type)))
- error ("invalid use of `restrict'");
+ error ("invalid use of %<restrict%>");
else if (flag_strict_aliasing && type == TREE_TYPE (decl))
/* Indicate we need to make a unique alias set for this pointer.
We can't do it here because it might be pointing to an
@@ -2749,7 +2749,7 @@ c_sizeof_or_alignof_type (tree type, enum tree_code op, int complain)
if (op == SIZEOF_EXPR)
{
if (complain && (pedantic || warn_pointer_arith))
- pedwarn ("invalid application of `sizeof' to a function type");
+ pedwarn ("invalid application of %<sizeof%> to a function type");
value = size_one_node;
}
else
@@ -2759,13 +2759,13 @@ c_sizeof_or_alignof_type (tree type, enum tree_code op, int complain)
{
if (type_code == VOID_TYPE
&& complain && (pedantic || warn_pointer_arith))
- pedwarn ("invalid application of `%s' to a void type", op_name);
+ pedwarn ("invalid application of %qs to a void type", op_name);
value = size_one_node;
}
else if (!COMPLETE_TYPE_P (type))
{
if (complain)
- error ("invalid application of `%s' to incomplete type `%T' ",
+ error ("invalid application of %qs to incomplete type %qT ",
op_name, type);
value = size_zero_node;
}
@@ -2806,7 +2806,7 @@ c_alignof_expr (tree expr)
else if (TREE_CODE (expr) == COMPONENT_REF
&& DECL_C_BIT_FIELD (TREE_OPERAND (expr, 1)))
{
- error ("`__alignof' applied to a bit-field");
+ error ("%<__alignof%> applied to a bit-field");
t = size_one_node;
}
else if (TREE_CODE (expr) == COMPONENT_REF
@@ -3249,7 +3249,7 @@ void
disable_builtin_function (const char *name)
{
if (strncmp (name, "__builtin_", strlen ("__builtin_")) == 0)
- error ("cannot disable built-in function `%s'", name);
+ error ("cannot disable built-in function %qs", name);
else
{
disabled_builtin *new_disabled_builtin = XNEW (disabled_builtin);
@@ -3657,10 +3657,10 @@ match_case_to_enum_1 (tree key, tree type, tree label)
TREE_INT_CST_HIGH (key), TREE_INT_CST_LOW (key));
if (TYPE_NAME (type) == 0)
- warning ("%Jcase value `%s' not in enumerated type",
+ warning ("%Jcase value %qs not in enumerated type",
CASE_LABEL (label), buf);
else
- warning ("%Jcase value `%s' not in enumerated type `%T'",
+ warning ("%Jcase value %qs not in enumerated type %qT",
CASE_LABEL (label), buf, type);
}
@@ -3761,7 +3761,7 @@ c_do_switch_warnings (splay_tree cases, tree switch_stmt)
{
/* Warn if there are enumerators that don't correspond to
case expressions. */
- warning ("%Henumeration value `%E' not handled in switch",
+ warning ("%Henumeration value %qE not handled in switch",
&switch_location, TREE_PURPOSE (chain));
}
}
@@ -3957,7 +3957,7 @@ handle_packed_attribute (tree *node, tree name, tree ARG_UNUSED (args),
that changes what the typedef is typing. */
else
{
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
*no_add_attrs = true;
}
@@ -3976,7 +3976,7 @@ handle_nocommon_attribute (tree *node, tree name,
DECL_COMMON (*node) = 0;
else
{
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
*no_add_attrs = true;
}
@@ -3994,7 +3994,7 @@ handle_common_attribute (tree *node, tree name, tree ARG_UNUSED (args),
DECL_COMMON (*node) = 1;
else
{
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
*no_add_attrs = true;
}
@@ -4021,7 +4021,7 @@ handle_noreturn_attribute (tree *node, tree name, tree ARG_UNUSED (args),
TYPE_READONLY (TREE_TYPE (type)), 1));
else
{
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
*no_add_attrs = true;
}
@@ -4040,7 +4040,7 @@ handle_noinline_attribute (tree *node, tree name,
DECL_UNINLINABLE (*node) = 1;
else
{
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
*no_add_attrs = true;
}
@@ -4063,7 +4063,7 @@ handle_always_inline_attribute (tree *node, tree name,
}
else
{
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
*no_add_attrs = true;
}
@@ -4087,7 +4087,7 @@ handle_used_attribute (tree *pnode, tree name, tree ARG_UNUSED (args),
}
else
{
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
*no_add_attrs = true;
}
@@ -4113,7 +4113,7 @@ handle_unused_attribute (tree *node, tree name, tree ARG_UNUSED (args),
TREE_USED (decl) = 1;
else
{
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
*no_add_attrs = true;
}
}
@@ -4147,7 +4147,7 @@ handle_const_attribute (tree *node, tree name, tree ARG_UNUSED (args),
TREE_THIS_VOLATILE (TREE_TYPE (type))));
else
{
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
*no_add_attrs = true;
}
@@ -4191,7 +4191,7 @@ handle_transparent_union_attribute (tree *node, tree name,
DECL_TRANSPARENT_UNION (decl) = 1;
else
{
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
*no_add_attrs = true;
}
@@ -4219,7 +4219,7 @@ handle_constructor_attribute (tree *node, tree name,
}
else
{
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
*no_add_attrs = true;
}
@@ -4247,7 +4247,7 @@ handle_destructor_attribute (tree *node, tree name,
}
else
{
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
*no_add_attrs = true;
}
@@ -4266,7 +4266,7 @@ handle_mode_attribute (tree *node, tree name, tree args,
*no_add_attrs = true;
if (TREE_CODE (TREE_VALUE (args)) != IDENTIFIER_NODE)
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
else
{
int j;
@@ -4367,7 +4367,7 @@ handle_mode_attribute (tree *node, tree name, tree args,
this mode for this type. */
if (TREE_CODE (typefm) != INTEGER_TYPE)
{
- error ("cannot use mode '%s' for enumeral types",
+ error ("cannot use mode %qs for enumeral types",
GET_MODE_NAME (mode));
return NULL_TREE;
}
@@ -4417,7 +4417,7 @@ handle_section_attribute (tree *node, tree ARG_UNUSED (name), tree args,
&& strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (decl)),
TREE_STRING_POINTER (TREE_VALUE (args))) != 0)
{
- error ("%Jsection of '%D' conflicts with previous declaration",
+ error ("%Jsection of %qD conflicts with previous declaration",
*node, *node);
*no_add_attrs = true;
}
@@ -4426,7 +4426,7 @@ handle_section_attribute (tree *node, tree ARG_UNUSED (name), tree args,
}
else
{
- error ("%Jsection attribute not allowed for '%D'", *node, *node);
+ error ("%Jsection attribute not allowed for %qD", *node, *node);
*no_add_attrs = true;
}
}
@@ -4506,7 +4506,7 @@ handle_aligned_attribute (tree *node, tree ARG_UNUSED (name), tree args,
else if (TREE_CODE (decl) != VAR_DECL
&& TREE_CODE (decl) != FIELD_DECL)
{
- error ("%Jalignment may not be specified for '%D'", decl, decl);
+ error ("%Jalignment may not be specified for %qD", decl, decl);
*no_add_attrs = true;
}
else
@@ -4544,7 +4544,7 @@ handle_alias_attribute (tree *node, tree name, tree args,
if ((TREE_CODE (decl) == FUNCTION_DECL && DECL_INITIAL (decl))
|| (TREE_CODE (decl) != FUNCTION_DECL && ! DECL_EXTERNAL (decl)))
{
- error ("%J'%D' defined both normally and as an alias", decl, decl);
+ error ("%J%qD defined both normally and as an alias", decl, decl);
*no_add_attrs = true;
}
@@ -4578,7 +4578,7 @@ handle_alias_attribute (tree *node, tree name, tree args,
}
else
{
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
*no_add_attrs = true;
}
@@ -4602,14 +4602,14 @@ handle_visibility_attribute (tree *node, tree name, tree args,
{
if (TREE_CODE (*node) != RECORD_TYPE && TREE_CODE (*node) != UNION_TYPE)
{
- warning ("`%s' attribute ignored on non-class types",
+ warning ("%qs attribute ignored on non-class types",
IDENTIFIER_POINTER (name));
return NULL_TREE;
}
}
else if (decl_function_context (decl) != 0 || ! TREE_PUBLIC (decl))
{
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
return NULL_TREE;
}
@@ -4695,7 +4695,7 @@ handle_tls_model_attribute (tree *node, tree name, tree args,
if (! DECL_THREAD_LOCAL (decl))
{
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
*no_add_attrs = true;
}
else
@@ -4736,12 +4736,12 @@ handle_no_instrument_function_attribute (tree *node, tree name,
if (TREE_CODE (decl) != FUNCTION_DECL)
{
- error ("%J'%E' attribute applies only to functions", decl, name);
+ error ("%J%qE attribute applies only to functions", decl, name);
*no_add_attrs = true;
}
else if (DECL_INITIAL (decl))
{
- error ("%Jcan't set '%E' attribute after definition", decl, name);
+ error ("%Jcan%'t set %qE attribute after definition", decl, name);
*no_add_attrs = true;
}
else
@@ -4762,7 +4762,7 @@ handle_malloc_attribute (tree *node, tree name, tree ARG_UNUSED (args),
/* ??? TODO: Support types. */
else
{
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
*no_add_attrs = true;
}
@@ -4782,12 +4782,12 @@ handle_no_limit_stack_attribute (tree *node, tree name,
if (TREE_CODE (decl) != FUNCTION_DECL)
{
- error ("%J'%E' attribute applies only to functions", decl, name);
+ error ("%J%qE attribute applies only to functions", decl, name);
*no_add_attrs = true;
}
else if (DECL_INITIAL (decl))
{
- error ("%Jcan't set '%E' attribute after definition", decl, name);
+ error ("%Jcan%'t set %qE attribute after definition", decl, name);
*no_add_attrs = true;
}
else
@@ -4808,7 +4808,7 @@ handle_pure_attribute (tree *node, tree name, tree ARG_UNUSED (args),
/* ??? TODO: Support types. */
else
{
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
*no_add_attrs = true;
}
@@ -4863,10 +4863,10 @@ handle_deprecated_attribute (tree *node, tree name,
what = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
}
if (what)
- warning ("`%s' attribute ignored for `%s'",
+ warning ("%qs attribute ignored for %qs",
IDENTIFIER_POINTER (name), what);
else
- warning ("`%s' attribute ignored",
+ warning ("%qs attribute ignored",
IDENTIFIER_POINTER (name));
}
@@ -4895,7 +4895,7 @@ handle_vector_size_attribute (tree *node, tree name, tree args,
if (! host_integerp (size, 1))
{
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
return NULL_TREE;
}
@@ -4924,7 +4924,7 @@ handle_vector_size_attribute (tree *node, tree name, tree args,
&& GET_MODE_CLASS (orig_mode) != MODE_INT)
|| ! host_integerp (TYPE_SIZE_UNIT (type), 1))
{
- error ("invalid vector type for attribute `%s'",
+ error ("invalid vector type for attribute %qs",
IDENTIFIER_POINTER (name));
return NULL_TREE;
}
@@ -5174,7 +5174,7 @@ handle_nothrow_attribute (tree *node, tree name, tree ARG_UNUSED (args),
/* ??? TODO: Support types. */
else
{
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
*no_add_attrs = true;
}
@@ -5197,7 +5197,7 @@ handle_cleanup_attribute (tree *node, tree name, tree args,
we'd be missing too much, since we do have attribute constructor. */
if (TREE_CODE (decl) != VAR_DECL || TREE_STATIC (decl))
{
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
*no_add_attrs = true;
return NULL_TREE;
}
@@ -5236,7 +5236,7 @@ handle_warn_unused_result_attribute (tree *node, tree name,
/* Ignore the attribute for functions not returning any value. */
if (VOID_TYPE_P (TREE_TYPE (*node)))
{
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
*no_add_attrs = true;
}
@@ -5253,7 +5253,7 @@ handle_sentinel_attribute (tree *node, tree name, tree args,
if (!params)
{
- warning ("`%s' attribute requires prototypes with named arguments",
+ warning ("%qs attribute requires prototypes with named arguments",
IDENTIFIER_POINTER (name));
*no_add_attrs = true;
}
@@ -5264,7 +5264,7 @@ handle_sentinel_attribute (tree *node, tree name, tree args,
if (VOID_TYPE_P (TREE_VALUE (params)))
{
- warning ("`%s' attribute only applies to variadic functions",
+ warning ("%qs attribute only applies to variadic functions",
IDENTIFIER_POINTER (name));
*no_add_attrs = true;
}
@@ -5489,7 +5489,7 @@ c_parse_error (const char *msgid, enum cpp_ttype token, tree value)
else if (token == CPP_NAME)
error ("%s before \"%s\"", string, IDENTIFIER_POINTER (value));
else if (token < N_TTYPES)
- error ("%s before '%s' token", string, cpp_type2name (token));
+ error ("%s before %qs token", string, cpp_type2name (token));
else
error ("%s", string);
}
@@ -5551,7 +5551,7 @@ c_warn_unused_result (tree *top_p)
if (lookup_attribute ("warn_unused_result", TYPE_ATTRIBUTES (ftype)))
{
if (fdecl)
- warning ("%Hignoring return value of `%D', "
+ warning ("%Hignoring return value of %qD, "
"declared with attribute warn_unused_result",
EXPR_LOCUS (t), fdecl);
else
@@ -5595,7 +5595,7 @@ fold_offsetof_1 (tree expr)
if (DECL_C_BIT_FIELD (t))
{
error ("attempt to take address of bit-field structure "
- "member `%s'", IDENTIFIER_POINTER (DECL_NAME (t)));
+ "member %qs", IDENTIFIER_POINTER (DECL_NAME (t)));
return error_mark_node;
}
off = size_binop (PLUS_EXPR, DECL_FIELD_OFFSET (t),