This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch to avoid shorthand "arg" in diagnostics
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 9 Nov 2004 00:30:22 +0000 (UTC)
- Subject: Patch to avoid shorthand "arg" in diagnostics
It was noted in comments on bug 1027 that diagnostics should use the
word "argument" instead of the abbreviated form "arg". Some cases
were fixed in the fix for that bug. This patch fixes various other
cases.
This patch depends on my previous diagnostic cleanup patch
<http://gcc.gnu.org/ml/gcc-patches/2004-11/msg00559.html>.
Bootstrapped with no regressions on i686-pc-linux-gnu. OK to commit
(the builtins.c changes)?
--
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
jsm@polyomino.org.uk (personal mail)
joseph@codesourcery.com (CodeSourcery mail)
jsm28@gcc.gnu.org (Bugzilla assignments and CCs)
2004-11-09 Joseph S. Myers <joseph@codesourcery.com>
* builtins.c, c-common.c, c-decl.c, c-format.c: Say "argument"
instead of "arg" in diagnostics.
2004-11-09 Joseph S. Myers <joseph@codesourcery.com>
* gcc.dg/builtin-prefetch-1.c: Update expected diagnostic.
diff -rupN GCC.orig/gcc/builtins.c GCC/gcc/builtins.c
--- GCC.orig/gcc/builtins.c 2004-11-07 15:24:04.000000000 +0000
+++ GCC/gcc/builtins.c 2004-11-07 16:13:52.000000000 +0000
@@ -922,28 +922,29 @@ expand_builtin_prefetch (tree arglist)
/* Argument 1 (read/write flag) must be a compile-time constant int. */
if (TREE_CODE (arg1) != INTEGER_CST)
{
- error ("second arg to %<__builtin_prefetch%> must be a constant");
+ error ("second argument to %<__builtin_prefetch%> must be a constant");
arg1 = integer_zero_node;
}
op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
/* Argument 1 must be either zero or one. */
if (INTVAL (op1) != 0 && INTVAL (op1) != 1)
{
- warning ("invalid second arg to %<__builtin_prefetch%>; using zero");
+ warning ("invalid second argument to %<__builtin_prefetch%>;"
+ " using zero");
op1 = const0_rtx;
}
/* Argument 2 (locality) must be a compile-time constant int. */
if (TREE_CODE (arg2) != INTEGER_CST)
{
- error ("third arg to %<__builtin_prefetch%> must be a constant");
+ error ("third argument to %<__builtin_prefetch%> must be a constant");
arg2 = integer_zero_node;
}
op2 = expand_expr (arg2, NULL_RTX, VOIDmode, 0);
/* Argument 2 must be 0, 1, 2, or 3. */
if (INTVAL (op2) < 0 || INTVAL (op2) > 3)
{
- warning ("invalid third arg to %<__builtin_prefetch%>; using zero");
+ warning ("invalid third argument to %<__builtin_prefetch%>; using zero");
op2 = const0_rtx;
}
@@ -4158,9 +4159,9 @@ expand_builtin_frame_address (tree fndec
else if (! host_integerp (TREE_VALUE (arglist), 1))
{
if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_FRAME_ADDRESS)
- error ("invalid arg to %<__builtin_frame_address%>");
+ error ("invalid argument to %<__builtin_frame_address%>");
else
- error ("invalid arg to %<__builtin_return_address%>");
+ error ("invalid argument to %<__builtin_return_address%>");
return const0_rtx;
}
else
@@ -4174,9 +4175,9 @@ expand_builtin_frame_address (tree fndec
if (tem == NULL)
{
if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_FRAME_ADDRESS)
- warning ("unsupported arg to %<__builtin_frame_address%>");
+ warning ("unsupported argument to %<__builtin_frame_address%>");
else
- warning ("unsupported arg to %<__builtin_return_address%>");
+ warning ("unsupported argument to %<__builtin_return_address%>");
return const0_rtx;
}
@@ -4279,7 +4280,7 @@ expand_builtin_expect (tree arglist, rtx
if (TREE_CODE (c) != INTEGER_CST)
{
- error ("second arg to %<__builtin_expect%> must be a constant");
+ error ("second argument to %<__builtin_expect%> must be a constant");
c = integer_zero_node;
}
diff -rupN GCC.orig/gcc/c-common.c GCC/gcc/c-common.c
--- GCC.orig/gcc/c-common.c 2004-11-07 15:24:04.000000000 +0000
+++ GCC/gcc/c-common.c 2004-11-07 16:14:19.000000000 +0000
@@ -4577,7 +4577,7 @@ handle_alias_attribute (tree *node, tree
id = TREE_VALUE (args);
if (TREE_CODE (id) != STRING_CST)
{
- error ("alias arg not a string");
+ error ("alias argument not a string");
*no_add_attrs = true;
return NULL_TREE;
}
@@ -4632,7 +4632,7 @@ handle_visibility_attribute (tree *node,
if (TREE_CODE (id) != STRING_CST)
{
- error ("visibility arg not a string");
+ error ("visibility argument not a string");
return NULL_TREE;
}
@@ -4653,7 +4653,7 @@ handle_visibility_attribute (tree *node,
else if (strcmp (TREE_STRING_POINTER (id), "protected") == 0)
DECL_VISIBILITY (decl) = VISIBILITY_PROTECTED;
else
- error ("visibility arg must be one of \"default\", \"hidden\", \"protected\" or \"internal\"");
+ error ("visibility argument must be one of \"default\", \"hidden\", \"protected\" or \"internal\"");
DECL_VISIBILITY_SPECIFIED (decl) = 1;
/* For decls only, go ahead and attach the attribute to the node as well.
@@ -4722,7 +4722,7 @@ handle_tls_model_attribute (tree *node,
id = TREE_VALUE (args);
if (TREE_CODE (id) != STRING_CST)
{
- error ("tls_model arg not a string");
+ error ("tls_model argument not a string");
*no_add_attrs = true;
return NULL_TREE;
}
@@ -4731,7 +4731,7 @@ handle_tls_model_attribute (tree *node,
&& strcmp (TREE_STRING_POINTER (id), "local-dynamic")
&& strcmp (TREE_STRING_POINTER (id), "global-dynamic"))
{
- error ("tls_model arg must be one of \"local-exec\", \"initial-exec\", \"local-dynamic\" or \"global-dynamic\"");
+ error ("tls_model argument must be one of \"local-exec\", \"initial-exec\", \"local-dynamic\" or \"global-dynamic\"");
*no_add_attrs = true;
return NULL_TREE;
}
@@ -4993,7 +4993,7 @@ handle_nonnull_attribute (tree *node, tr
if (!get_nonnull_operand (TREE_VALUE (args), &arg_num))
{
- error ("nonnull argument has invalid operand number (arg %lu)",
+ error ("nonnull argument has invalid operand number (argument %lu)",
(unsigned long) attr_arg_num);
*no_add_attrs = true;
return NULL_TREE;
@@ -5012,7 +5012,7 @@ handle_nonnull_attribute (tree *node, tr
if (!argument
|| TREE_CODE (TREE_VALUE (argument)) == VOID_TYPE)
{
- error ("nonnull argument with out-of-range operand number (arg %lu, operand %lu)",
+ error ("nonnull argument with out-of-range operand number (argument %lu, operand %lu)",
(unsigned long) attr_arg_num, (unsigned long) arg_num);
*no_add_attrs = true;
return NULL_TREE;
@@ -5020,7 +5020,7 @@ handle_nonnull_attribute (tree *node, tr
if (TREE_CODE (TREE_VALUE (argument)) != POINTER_TYPE)
{
- error ("nonnull argument references non-pointer operand (arg %lu, operand %lu)",
+ error ("nonnull argument references non-pointer operand (argument %lu, operand %lu)",
(unsigned long) attr_arg_num, (unsigned long) arg_num);
*no_add_attrs = true;
return NULL_TREE;
@@ -5154,7 +5154,7 @@ check_nonnull_arg (void * ARG_UNUSED (ct
return;
if (integer_zerop (param))
- warning ("null argument where non-null required (arg %lu)",
+ warning ("null argument where non-null required (argument %lu)",
(unsigned long) param_num);
}
@@ -5225,14 +5225,14 @@ handle_cleanup_attribute (tree *node, tr
cleanup_id = TREE_VALUE (args);
if (TREE_CODE (cleanup_id) != IDENTIFIER_NODE)
{
- error ("cleanup arg not an identifier");
+ error ("cleanup argument not an identifier");
*no_add_attrs = true;
return NULL_TREE;
}
cleanup_decl = lookup_name (cleanup_id);
if (!cleanup_decl || TREE_CODE (cleanup_decl) != FUNCTION_DECL)
{
- error ("cleanup arg not a function");
+ error ("cleanup argument not a function");
*no_add_attrs = true;
return NULL_TREE;
}
diff -rupN GCC.orig/gcc/c-decl.c GCC/gcc/c-decl.c
--- GCC.orig/gcc/c-decl.c 2004-11-07 15:24:04.000000000 +0000
+++ GCC/gcc/c-decl.c 2004-11-07 16:14:36.000000000 +0000
@@ -1063,7 +1063,8 @@ validate_proto_after_old_defn (tree newd
for the arg. */
else if (!comptypes (oldargtype, newargtype))
{
- error ("%Jprototype for %qD declares arg %d with incompatible type",
+ error ("%Jprototype for %qD declares argument %d"
+ " with incompatible type",
newdecl, newdecl, i);
return false;
}
diff -rupN GCC.orig/gcc/c-format.c GCC/gcc/c-format.c
--- GCC.orig/gcc/c-format.c 2004-11-07 15:24:04.000000000 +0000
+++ GCC/gcc/c-format.c 2004-11-07 16:15:25.000000000 +0000
@@ -139,7 +139,7 @@ check_format_string (tree argument, unsi
!= char_type_node))
{
if (!(flags & (int) ATTR_FLAG_BUILT_IN))
- error ("format string arg not a string type");
+ error ("format string argument not a string type");
*no_add_attrs = true;
return false;
}
@@ -219,7 +219,7 @@ decode_format_attr (tree args, function_
if (info->first_arg_num != 0 && info->first_arg_num <= info->format_num)
{
gcc_assert (!validated_p);
- error ("format string arg follows the args to be formatted");
+ error ("format string argument follows the args to be formatted");
return false;
}
@@ -2069,7 +2069,7 @@ check_format_types (format_wanted_type *
&& i == 0
&& cur_param != 0
&& integer_zerop (cur_param))
- warning ("writing through null pointer (arg %d)",
+ warning ("writing through null pointer (argument %d)",
arg_num);
/* Check for reading through a NULL pointer. */
@@ -2077,7 +2077,7 @@ check_format_types (format_wanted_type *
&& i == 0
&& cur_param != 0
&& integer_zerop (cur_param))
- warning ("reading through null pointer (arg %d)",
+ warning ("reading through null pointer (argument %d)",
arg_num);
if (cur_param != 0 && TREE_CODE (cur_param) == ADDR_EXPR)
@@ -2097,7 +2097,8 @@ check_format_types (format_wanted_type *
&& (CONSTANT_CLASS_P (cur_param)
|| (DECL_P (cur_param)
&& TREE_READONLY (cur_param))))))
- warning ("writing into constant object (arg %d)", arg_num);
+ warning ("writing into constant object (argument %d)",
+ arg_num);
/* If there are extra type qualifiers beyond the first
indirection, then this makes the types technically
@@ -2107,7 +2108,8 @@ check_format_types (format_wanted_type *
&& (TYPE_READONLY (cur_type)
|| TYPE_VOLATILE (cur_type)
|| TYPE_RESTRICT (cur_type)))
- warning ("extra type qualifiers in format argument (arg %d)",
+ warning ("extra type qualifiers in format argument "
+ "(argument %d)",
arg_num);
}
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/builtin-prefetch-1.c GCC/gcc/testsuite/gcc.dg/builtin-prefetch-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/builtin-prefetch-1.c 2004-11-08 12:48:06.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/builtin-prefetch-1.c 2004-11-08 13:06:26.000000000 +0000
@@ -28,12 +28,12 @@ good (int *p)
void
bad (int *p)
{
- __builtin_prefetch (p, -1, 0); /* { dg-warning "invalid second arg to '__builtin_prefetch'; using zero" } */
- __builtin_prefetch (p, 2, 0); /* { dg-warning "invalid second arg to '__builtin_prefetch'; using zero" } */
- __builtin_prefetch (p, bogus, 0); /* { dg-warning "invalid second arg to '__builtin_prefetch'; using zero" } */
- __builtin_prefetch (p, 0, -1); /* { dg-warning "invalid third arg to '__builtin_prefetch'; using zero" } */
- __builtin_prefetch (p, 0, 4); /* { dg-warning "invalid third arg to '__builtin_prefetch'; using zero" } */
- __builtin_prefetch (p, 0, bogus); /* { dg-warning "invalid third arg to '__builtin_prefetch'; using zero" } */
+ __builtin_prefetch (p, -1, 0); /* { dg-warning "invalid second argument to '__builtin_prefetch'; using zero" } */
+ __builtin_prefetch (p, 2, 0); /* { dg-warning "invalid second argument to '__builtin_prefetch'; using zero" } */
+ __builtin_prefetch (p, bogus, 0); /* { dg-warning "invalid second argument to '__builtin_prefetch'; using zero" } */
+ __builtin_prefetch (p, 0, -1); /* { dg-warning "invalid third argument to '__builtin_prefetch'; using zero" } */
+ __builtin_prefetch (p, 0, 4); /* { dg-warning "invalid third argument to '__builtin_prefetch'; using zero" } */
+ __builtin_prefetch (p, 0, bogus); /* { dg-warning "invalid third argument to '__builtin_prefetch'; using zero" } */
}
int