diff 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
line wrap: on
line diff
--- a/gcc/c-cppbuiltin.c	Fri Feb 12 23:41:23 2010 +0900
+++ b/gcc/c-cppbuiltin.c	Mon May 24 12:47:05 2010 +0900
@@ -25,14 +25,13 @@
 #include "tree.h"
 #include "version.h"
 #include "flags.h"
-#include "real.h"
 #include "c-common.h"
 #include "c-pragma.h"
 #include "output.h"
 #include "except.h"		/* For USING_SJLJ_EXCEPTIONS.  */
-#include "debug.h"		/* For dwarf2out_do_frame.  */
+#include "debug.h"		/* For dwarf2out_do_cfi_asm.  */
 #include "toplev.h"
-#include "tm_p.h"		/* Target prototypes.  */
+#include "tm_p.h"		/* For TARGET_CPU_CPP_BUILTINS & friends.  */
 #include "target.h"
 
 #ifndef TARGET_OS_CPP_BUILTINS
@@ -105,6 +104,7 @@
   char name[64], buf[128];
   int dig, min_10_exp, max_10_exp;
   int decimal_dig;
+  int type_decimal_dig;
 
   fmt = REAL_MODE_FORMAT (TYPE_MODE (type));
   gcc_assert (fmt->b != 10);
@@ -198,8 +198,20 @@
     if (decimal_dig < d_decimal_dig)
       decimal_dig++;
   }
+  /* Similar, for this type rather than long double.  */
+  {
+    double type_d_decimal_dig = 1 + fmt->p * log10_b;
+    type_decimal_dig = type_d_decimal_dig;
+    if (type_decimal_dig < type_d_decimal_dig)
+      type_decimal_dig++;
+  }
   if (type == long_double_type_node)
     builtin_define_with_int_value ("__DECIMAL_DIG__", decimal_dig);
+  else
+    {
+      sprintf (name, "__%s_DECIMAL_DIG__", name_prefix);
+      builtin_define_with_int_value (name, type_decimal_dig);
+    }
 
   /* Since, for the supported formats, B is always a power of 2, we
      construct the following numbers directly as a hexadecimal