"new" warnings on alphaev6-unknown-linux-gnu
Kaveh R. Ghazi
ghazi@caip.rutgers.edu
Sun Apr 15 21:04:00 GMT 2001
> From: Richard Henderson <rth@redhat.com>
>
> On Sat, Apr 14, 2001 at 10:54:09AM -0400, Kaveh R. Ghazi wrote:
> > I'll have to think about this a bit more. It may be that I disable
> > the width checks and only do the fixed<->floating point checks when
> > using -Wtraditional.
>
> I suspect this is the only viable option.
> r~
Here's a patch which does this. Bootstrapped on sparc-sun-solaris2.7,
wtr-conversion-1.c continues to pass. Also bootstrapped on
i686-pc-linux-gnu and the spurious glibc macro warnings go away. I
also received private confirmation from Brad that the 1300 alpha
size_t<->int warnings go away.
Ok to install on trunk (and branch since the issue impacts there as
well?)
Thanks,
--Kaveh
2001-04-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* c-typeck.c (convert_arguments): Don't check for width changes
with -Wtraditional.
* invoke.texi (-Wtraditional): Update documentation.
testsuite:
* gcc.dg/wtr-conversion-1.c: Don't test for width changes.
diff -rup orig/egcs-CVS20010415/gcc/c-typeck.c egcs-CVS20010415/gcc/c-typeck.c
--- orig/egcs-CVS20010415/gcc/c-typeck.c Tue Apr 10 18:36:18 2001
+++ egcs-CVS20010415/gcc/c-typeck.c Sun Apr 15 16:17:13 2001
@@ -1709,8 +1709,10 @@ convert_arguments (typelist, values, nam
if (formal_prec == TYPE_PRECISION (float_type_node))
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 (INTEGRAL_TYPE_P (type)
+ /* Detect integer changing in width or signedness.
+ These warnings are only activated with
+ -Wconversion, not with -Wtraditional. */
+ else if (warn_conversion && INTEGRAL_TYPE_P (type)
&& INTEGRAL_TYPE_P (TREE_TYPE (val)))
{
tree would_have_been = default_conversion (val);
@@ -1755,15 +1757,10 @@ convert_arguments (typelist, values, nam
else if (TYPE_PRECISION (TREE_TYPE (val)) < TYPE_PRECISION (type)
&& TREE_UNSIGNED (TREE_TYPE (val)))
;
- /* These warnings are only activated with
- -Wconversion, not with -Wtraditional. */
- else if (warn_conversion)
- {
- if (TREE_UNSIGNED (type))
- warn_for_assignment ("%s as unsigned due to prototype", (char *) 0, name, parmnum + 1);
- else
- warn_for_assignment ("%s as signed due to prototype", (char *) 0, name, parmnum + 1);
- }
+ else if (TREE_UNSIGNED (type))
+ warn_for_assignment ("%s as unsigned due to prototype", (char *) 0, name, parmnum + 1);
+ else
+ warn_for_assignment ("%s as signed due to prototype", (char *) 0, name, parmnum + 1);
}
}
diff -rup orig/egcs-CVS20010415/gcc/invoke.texi egcs-CVS20010415/gcc/invoke.texi
--- orig/egcs-CVS20010415/gcc/invoke.texi Thu Apr 12 14:08:28 2001
+++ egcs-CVS20010415/gcc/invoke.texi Sun Apr 15 16:31:12 2001
@@ -2125,9 +2125,10 @@ initializer warnings and relies on defau
traditional C case.
@item
-Conversions by prototypes. This is similar to @samp{-Wconversion} in
-that it warns about width changes and fixed/floating point conversions,
-however it does not warn about changes in signedness.
+Conversions by prototypes between fixed/floating point values and vice
+versa. The absence of these prototypes when compiling with traditional
+C would cause serious problems. This is a subset of the possible
+conversion warnings, for the full set use @samp{-Wconversion}.
@end itemize
@item -Wundef
diff -rup orig/egcs-CVS20010415/gcc/testsuite/gcc.dg/wtr-conversion-1.c egcs-CVS20010415/gcc/testsuite/gcc.dg/wtr-conversion-1.c
--- orig/egcs-CVS20010415/gcc/testsuite/gcc.dg/wtr-conversion-1.c Tue Apr 10 18:36:21 2001
+++ egcs-CVS20010415/gcc/testsuite/gcc.dg/wtr-conversion-1.c Sun Apr 15 16:21:01 2001
@@ -4,14 +4,12 @@
/* { dg-do compile } */
/* { dg-options "-Wtraditional" } */
-extern void foo_c (char);
-extern void foo_ll (long long);
+extern void foo_i (int);
extern void foo_f (float);
extern void foo_ld (long double);
extern void foo_cd (__complex__ double);
-extern char c;
-extern long long ll;
+extern int i;
extern float f;
extern long double ld;
extern __complex__ double cd;
@@ -19,32 +17,22 @@ extern __complex__ double cd;
void
testfunc1 (void)
{
- foo_c (c); /* { dg-warning "with different width" "prototype conversion warning" } */
- foo_c (ll); /* { dg-warning "with different width" "prototype conversion warning" } */
- foo_c (f); /* { dg-warning "as integer rather than floating" "prototype conversion warning" } */
- foo_c (ld); /* { dg-warning "as integer rather than floating" "prototype conversion warning" } */
- foo_c (cd); /* { dg-warning "as integer rather than complex" "prototype conversion warning" } */
-
- foo_ll (c); /* { dg-warning "with different width" "prototype conversion warning" } */
- foo_ll (ll);
- foo_ll (f); /* { dg-warning "as integer rather than floating" "prototype conversion warning" } */
- foo_ll (ld); /* { dg-warning "as integer rather than floating" "prototype conversion warning" } */
- foo_ll (cd); /* { dg-warning "as integer rather than complex" "prototype conversion warning" } */
+ foo_i (i);
+ foo_i (f); /* { dg-warning "as integer rather than floating" "prototype conversion warning" } */
+ foo_i (ld); /* { dg-warning "as integer rather than floating" "prototype conversion warning" } */
+ foo_i (cd); /* { dg-warning "as integer rather than complex" "prototype conversion warning" } */
- foo_f (c); /* { dg-warning "as floating rather than integer" "prototype conversion warning" } */
- foo_f (ll); /* { dg-warning "as floating rather than integer" "prototype conversion warning" } */
+ foo_f (i); /* { dg-warning "as floating rather than integer" "prototype conversion warning" } */
foo_f (f); /* { dg-warning "as `float' rather than `double'" "prototype conversion warning" } */
foo_f (ld); /* { dg-warning "as `float' rather than `double'" "prototype conversion warning" } */
foo_f (cd); /* { dg-warning "as floating rather than complex" "prototype conversion warning" } */
- foo_ld (c); /* { dg-warning "as floating rather than integer" "prototype conversion warning" } */
- foo_ld (ll); /* { dg-warning "as floating rather than integer" "prototype conversion warning" } */
+ foo_ld (i); /* { dg-warning "as floating rather than integer" "prototype conversion warning" } */
foo_ld (f);
foo_ld (ld);
foo_ld (cd); /* { dg-warning "as floating rather than complex" "prototype conversion warning" } */
- foo_cd (c); /* { dg-warning "as complex rather than integer" "prototype conversion warning" } */
- foo_cd (ll); /* { dg-warning "as complex rather than integer" "prototype conversion warning" } */
+ foo_cd (i); /* { dg-warning "as complex rather than integer" "prototype conversion warning" } */
foo_cd (f); /* { dg-warning "as complex rather than floating" "prototype conversion warning" } */
foo_cd (ld); /* { dg-warning "as complex rather than floating" "prototype conversion warning" } */
foo_cd (cd);
@@ -56,32 +44,22 @@ testfunc1 (void)
void
testfunc2 (void)
{
- foo_c (c);
- foo_c (ll);
- foo_c (f);
- foo_c (ld);
- foo_c (cd);
-
- foo_ll (c);
- foo_ll (ll);
- foo_ll (f);
- foo_ll (ld);
- foo_ll (cd);
+ foo_i (i);
+ foo_i (f);
+ foo_i (ld);
+ foo_i (cd);
- foo_f (c);
- foo_f (ll);
+ foo_f (i);
foo_f (f);
foo_f (ld);
foo_f (cd);
- foo_ld (c);
- foo_ld (ll);
+ foo_ld (i);
foo_ld (f);
foo_ld (ld);
foo_ld (cd);
- foo_cd (c);
- foo_cd (ll);
+ foo_cd (i);
foo_cd (f);
foo_cd (ld);
foo_cd (cd);
More information about the Gcc
mailing list