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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [dfp/] [pragma-float-const-decimal64-3.c] - Blame information for rev 689

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do compile } */
2
/* { dg-options "-Wall" } */
3
 
4
/* N1312 7.1.1: The FLOAT_CONST_DECIMAL64 pragma.
5
   C99 6.4.4.2a (New).  */
6
 
7
/* Check that defining macros whose names are the same as the tokens used
8
   in the pragma doesn't affect use of the pragma.  */
9
 
10
#define ON YES
11
#define OFF NO
12
#define DEFAULT NOPE
13
#define STDC OFFICIAL
14
#define FLOAT_CONST_DECIMAL64 NEW_PRAGMA
15
 
16
double a;
17
 
18
void
19
f1a (void)
20
{
21
#pragma STDC FLOAT_CONST_DECIMAL64 ON
22
  a = 1.0dd + 2.0;
23
}
24
 
25
void
26
f1b (void)
27
{
28
#pragma STDC FLOAT_CONST_DECIMAL64 OFF
29
  a = 2.0d + 3.0;
30
}
31
 
32
void
33
f1c (void)
34
{
35
#pragma STDC FLOAT_CONST_DECIMAL64 DEFAULT
36
  a = 3.0d + 4.0;
37
}
38
 
39
/* Check that a macro can be used for the entire pragma.  */
40
 
41
#define PRAGMA(x) _Pragma (#x)
42
#define DEFAULT_FLOAT_IS_DECIMAL PRAGMA(STDC FLOAT_CONST_DECIMAL64 ON)
43
#define DEFAULT_FLOAT_IS_BINARY PRAGMA(STDC FLOAT_CONST_DECIMAL64 OFF)
44
 
45
void
46
f2a (void)
47
{
48
  DEFAULT_FLOAT_IS_DECIMAL
49
  a = 5.0 * 6.0dd;
50
}
51
 
52
void
53
f2b (void)
54
{
55
  DEFAULT_FLOAT_IS_BINARY
56
  a = 6.0 * 7.0d;
57
}
58
 
59
/* _Pragma can be used with macros, including the use of a macro for the
60
    switch.  */
61
 
62
#undef ON
63
#undef OFF
64
#undef DEFAULT
65
#undef STDC
66
#undef FLOAT_CONST_DECIMAL64
67
 
68
#define SWITCH ON
69
#define FLOAT_CONST_DECIMAL64(x) PRAGMA(STDC FLOAT_CONST_DECIMAL64 x)
70
 
71
void
72
f3a (void)
73
{
74
  FLOAT_CONST_DECIMAL64(SWITCH)
75
  a = 1.0 * 7.0dd;
76
}
77
 
78
void
79
f3b (void)
80
{
81
  FLOAT_CONST_DECIMAL64(OFF)
82
  a = 1.0 + 2.0d;
83
}

powered by: WebSVN 2.1.0

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