aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-05-20 04:04:55 +0000
committerRichard Stallman <rms@gnu.org>1992-05-20 04:04:55 +0000
commit754a4d82e32c12735c84a4d786e0fe28bd1713b1 (patch)
tree5828b605239145c8e5eceb606e705ca63c2d93cc /gcc
parent450446554518c3fb2b8aa64b41f8a11e9aca554b (diff)
downloadgcc-754a4d82e32c12735c84a4d786e0fe28bd1713b1.zip
gcc-754a4d82e32c12735c84a4d786e0fe28bd1713b1.tar.gz
gcc-754a4d82e32c12735c84a4d786e0fe28bd1713b1.tar.bz2
*** empty log message ***
From-SVN: r1027
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-typeck.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 751a258..53afdd0 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -1972,17 +1972,17 @@ convert_arguments (typelist, values, name)
if (TREE_CODE (type) != REAL_TYPE
&& TREE_CODE (TREE_TYPE (val)) == REAL_TYPE)
- warning ("floating argument converted to integer");
+ warn_for_assignment ("%s as integer rather than floating due to prototype", (char *) 0, name, parmnum + 1);
else if (TREE_CODE (type) == REAL_TYPE
&& TREE_CODE (TREE_TYPE (val)) != REAL_TYPE)
- warning ("integer argument converted to floating");
+ warn_for_assignment ("%s as floating rather than integer due to prototype", (char *) 0, name, parmnum + 1);
else if (TREE_CODE (type) == REAL_TYPE
&& TREE_CODE (TREE_TYPE (val)) == REAL_TYPE)
{
/* Warn if any argument is passed as `float',
since without a prototype it would be `double'. */
if (formal_prec == TYPE_PRECISION (float_type_node))
- warning ("floating argument passed as `float' rather than `double'");
+ warn_for_assignment ("%s as `float' rather than `double' due to prototype", (char *) 0, name, parmnum + 1);
}
/* Detect integer changing in width or signedness. */
else if ((TREE_CODE (type) == INTEGER_TYPE
@@ -1993,8 +1993,13 @@ convert_arguments (typelist, values, name)
tree would_have_been = default_conversion (val);
tree type1 = TREE_TYPE (would_have_been);
- if (formal_prec != TYPE_PRECISION (type))
- warning ("prototype changes width used for integer argument");
+ if (TREE_CODE (type) == ENUMERAL_TYPE
+ && type == TREE_TYPE (val))
+ /* No warning if function asks for enum
+ and the actual arg is that enum type. */
+ ;
+ else if (formal_prec != TYPE_PRECISION (type1))
+ warn_for_assignment ("%s with different width due to prototype", (char *) 0, name, parmnum + 1);
else if (TREE_UNSIGNED (type) == TREE_UNSIGNED (type1))
;
else if (TREE_CODE (val) == INTEGER_CST
@@ -2009,9 +2014,9 @@ convert_arguments (typelist, values, name)
if an enum value is unaffected. */
;
else if (TREE_UNSIGNED (type))
- warning ("argument passed as unsigned due to prototype");
+ warn_for_assignment ("%s as unsigned due to prototype", (char *) 0, name, parmnum + 1);
else
- warning ("argument passed as signed due to prototype");
+ warn_for_assignment ("%s as signed due to prototype", (char *) 0, name, parmnum + 1);
}
}