comparison gcc/c-cppbuiltin.c @ 63:b7f97abdc517 gcc-4.6-20100522

update gcc from gcc-4.5.0 to gcc-4.6
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Mon, 24 May 2010 12:47:05 +0900
parents 77e2b8dfacca
children
comparison
equal deleted inserted replaced
56:3c8a44c06a95 63:b7f97abdc517
23 #include "coretypes.h" 23 #include "coretypes.h"
24 #include "tm.h" 24 #include "tm.h"
25 #include "tree.h" 25 #include "tree.h"
26 #include "version.h" 26 #include "version.h"
27 #include "flags.h" 27 #include "flags.h"
28 #include "real.h"
29 #include "c-common.h" 28 #include "c-common.h"
30 #include "c-pragma.h" 29 #include "c-pragma.h"
31 #include "output.h" 30 #include "output.h"
32 #include "except.h" /* For USING_SJLJ_EXCEPTIONS. */ 31 #include "except.h" /* For USING_SJLJ_EXCEPTIONS. */
33 #include "debug.h" /* For dwarf2out_do_frame. */ 32 #include "debug.h" /* For dwarf2out_do_cfi_asm. */
34 #include "toplev.h" 33 #include "toplev.h"
35 #include "tm_p.h" /* Target prototypes. */ 34 #include "tm_p.h" /* For TARGET_CPU_CPP_BUILTINS & friends. */
36 #include "target.h" 35 #include "target.h"
37 36
38 #ifndef TARGET_OS_CPP_BUILTINS 37 #ifndef TARGET_OS_CPP_BUILTINS
39 # define TARGET_OS_CPP_BUILTINS() 38 # define TARGET_OS_CPP_BUILTINS()
40 #endif 39 #endif
103 const struct real_format *ldfmt; 102 const struct real_format *ldfmt;
104 103
105 char name[64], buf[128]; 104 char name[64], buf[128];
106 int dig, min_10_exp, max_10_exp; 105 int dig, min_10_exp, max_10_exp;
107 int decimal_dig; 106 int decimal_dig;
107 int type_decimal_dig;
108 108
109 fmt = REAL_MODE_FORMAT (TYPE_MODE (type)); 109 fmt = REAL_MODE_FORMAT (TYPE_MODE (type));
110 gcc_assert (fmt->b != 10); 110 gcc_assert (fmt->b != 10);
111 ldfmt = REAL_MODE_FORMAT (TYPE_MODE (long_double_type_node)); 111 ldfmt = REAL_MODE_FORMAT (TYPE_MODE (long_double_type_node));
112 gcc_assert (ldfmt->b != 10); 112 gcc_assert (ldfmt->b != 10);
196 = 1 + (fmt->p < ldfmt->p ? ldfmt->p : fmt->p) * log10_b; 196 = 1 + (fmt->p < ldfmt->p ? ldfmt->p : fmt->p) * log10_b;
197 decimal_dig = d_decimal_dig; 197 decimal_dig = d_decimal_dig;
198 if (decimal_dig < d_decimal_dig) 198 if (decimal_dig < d_decimal_dig)
199 decimal_dig++; 199 decimal_dig++;
200 } 200 }
201 /* Similar, for this type rather than long double. */
202 {
203 double type_d_decimal_dig = 1 + fmt->p * log10_b;
204 type_decimal_dig = type_d_decimal_dig;
205 if (type_decimal_dig < type_d_decimal_dig)
206 type_decimal_dig++;
207 }
201 if (type == long_double_type_node) 208 if (type == long_double_type_node)
202 builtin_define_with_int_value ("__DECIMAL_DIG__", decimal_dig); 209 builtin_define_with_int_value ("__DECIMAL_DIG__", decimal_dig);
210 else
211 {
212 sprintf (name, "__%s_DECIMAL_DIG__", name_prefix);
213 builtin_define_with_int_value (name, type_decimal_dig);
214 }
203 215
204 /* Since, for the supported formats, B is always a power of 2, we 216 /* Since, for the supported formats, B is always a power of 2, we
205 construct the following numbers directly as a hexadecimal 217 construct the following numbers directly as a hexadecimal
206 constants. */ 218 constants. */
207 get_max_float (fmt, buf, sizeof (buf)); 219 get_max_float (fmt, buf, sizeof (buf));