OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [wtr-conversion-1.c] - Blame information for rev 378

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* Test for -Wtraditional warnings on conversions by prototypes.
2
   Note, gcc should omit these warnings in system header files.
3
   By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 4/09/2001.  */
4
/* { dg-do compile } */
5
/* { dg-options "-Wtraditional" } */
6
 
7
extern void foo_i (int);
8
extern void foo_f (float);
9
extern void foo_ld (long double);
10
extern void foo_cd (__complex__ double);
11
 
12
extern int i;
13
extern float f;
14
extern long double ld;
15
extern __complex__ double cd;
16
 
17
void
18
testfunc1 ()
19
{
20
  foo_i (i);
21
  foo_i (f); /* { dg-warning "as integer rather than floating" "prototype conversion warning" } */
22
  foo_i (ld); /* { dg-warning "as integer rather than floating" "prototype conversion warning" } */
23
  foo_i (cd); /* { dg-warning "as integer rather than complex" "prototype conversion warning" } */
24
 
25
  foo_f (i); /* { dg-warning "as floating rather than integer" "prototype conversion warning" } */
26
  foo_f (f); /* { dg-warning "as 'float' rather than 'double'" "prototype conversion warning" } */
27
  foo_f (ld); /* { dg-warning "as 'float' rather than 'double'" "prototype conversion warning" } */
28
  foo_f (cd); /* { dg-warning "as floating rather than complex" "prototype conversion warning" } */
29
 
30
  foo_ld (i); /* { dg-warning "as floating rather than integer" "prototype conversion warning" } */
31
  foo_ld (f); /* { dg-warning "as 'float' rather than 'double'" "small double" { target { "avr-*-*" } } } */
32
  foo_ld (ld);/* { dg-warning "as 'float' rather than 'double'" "small long double" { target { "avr-*-*" } } } */
33
  foo_ld (cd);/* { dg-warning "as floating rather than complex" "prototype conversion warning" } */
34
 
35
  foo_cd (i); /* { dg-warning "as complex rather than integer" "prototype conversion warning" } */
36
  foo_cd (f); /* { dg-warning "as complex rather than floating" "prototype conversion warning" } */
37
  foo_cd (ld); /* { dg-warning "as complex rather than floating" "prototype conversion warning" } */
38
  foo_cd (cd);
39
}
40
 
41
# 54 "sys-header.h" 3
42
/* We are in system headers now, no -Wtraditional warnings should issue.  */
43
 
44
void
45
testfunc2 ()
46
{
47
  foo_i (i);
48
  foo_i (f);
49
  foo_i (ld);
50
  foo_i (cd);
51
 
52
  foo_f (i);
53
  foo_f (f);
54
  foo_f (ld);
55
  foo_f (cd);
56
 
57
  foo_ld (i);
58
  foo_ld (f);
59
  foo_ld (ld);
60
  foo_ld (cd);
61
 
62
  foo_cd (i);
63
  foo_cd (f);
64
  foo_cd (ld);
65
  foo_cd (cd);
66
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.