OSDN Git Service

Sort static functions in topological order.
[pf3gnuchains/gcc-fork.git] / gcc / c-cppbuiltin.c
index 1565aac..b697b89 100644 (file)
@@ -25,14 +25,13 @@ along with GCC; see the file COPYING3.  If not see
 #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 @@ builtin_define_float_constants (const char *name_prefix,
   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 @@ builtin_define_float_constants (const char *name_prefix,
     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