OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [dfp/] [composite-type.c] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* { dg-do compile } */
2
/* { dg-options "-std=gnu99 -O -Wall" } */
3
 
4
/* C99 6.2.7: Compatible type and composite type.  */
5
 
6
#define DECIMAL_COMPOSITE_DECL(TYPE) \
7
  _Decimal##TYPE g1_##TYPE(); \
8
  _Decimal##TYPE g2_##TYPE(); \
9
  _Decimal##TYPE (*h1_##TYPE)[2]; \
10
  _Decimal##TYPE (*h2_##TYPE)[3]; \
11
  _Decimal##TYPE (*h3_##TYPE)[4]; \
12
  _Decimal##TYPE f1_##TYPE(_Decimal##TYPE(*)()); \
13
  _Decimal##TYPE f1_##TYPE(_Decimal##TYPE(*)(_Decimal##TYPE*)); \
14
  _Decimal##TYPE f1_##TYPE (_Decimal##TYPE(*g)(_Decimal##TYPE*)) \
15
   { \
16
     _Decimal##TYPE d##TYPE; \
17
     d##TYPE = ((_Decimal##TYPE (*) (_Decimal##TYPE*)) g)(&d##TYPE); \
18
     d##TYPE = ((_Decimal##TYPE (*) ()) g); \
19
     return d##TYPE; \
20
   } \
21
   _Decimal##TYPE f2_##TYPE(_Decimal##TYPE(*)[]); \
22
   _Decimal##TYPE f2_##TYPE(_Decimal##TYPE(*)[3]);
23
 
24
#define DECIMAL_COMPOSITE_TEST(TYPE) \
25
do \
26
{ \
27
 _Decimal##TYPE d##TYPE; \
28
 d##TYPE = f1_##TYPE(g1_##TYPE); \
29
 d##TYPE = f1_##TYPE(g2_##TYPE); \
30
 d##TYPE = f2_##TYPE(h1_##TYPE); \
31
 d##TYPE = f2_##TYPE(h2_##TYPE); \
32
 d##TYPE = f2_##TYPE(h3_##TYPE); \
33
} while(0)
34
 
35
DECIMAL_COMPOSITE_DECL(32);  /* { dg-error "incompatible types in assignment" } */
36
DECIMAL_COMPOSITE_DECL(64);  /* { dg-error "incompatible types in assignment" } */
37
DECIMAL_COMPOSITE_DECL(128); /* { dg-error "incompatible types in assignment" } */
38
 
39
int main()
40
{
41
  DECIMAL_COMPOSITE_TEST(32);  /* { dg-warning "incompatible pointer type" } */
42
  DECIMAL_COMPOSITE_TEST(64);  /* { dg-warning "incompatible pointer type" } */
43
  DECIMAL_COMPOSITE_TEST(128); /* { dg-warning "incompatible pointer type" } */
44
 
45
  return 0;
46
}

powered by: WebSVN 2.1.0

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