c-cppbuiltin.c (c_cpp_builtins): Use ggc_strdup for the fp_suffix argument.
authorJakub Jelinek <jakub@gcc.gnu.org>
Sat, 27 Jan 2018 06:27:47 +0000 (07:27 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 27 Jan 2018 06:27:47 +0000 (07:27 +0100)
* c-cppbuiltin.c (c_cpp_builtins): Use ggc_strdup for the fp_suffix
argument.
(LAZY_HEX_FP_VALUES_CNT): Define.
(lazy_hex_fp_values): Allow up to LAZY_HEX_FP_VALUES_CNT lazy hex fp
values rather than just 12.
(builtin_define_with_hex_fp_value): Likewise.

* include/cpplib.h (enum cpp_builtin_type): Change BT_LAST_USER from
BT_FIRST_USER + 31 to BT_FIRST_USER + 63.

From-SVN: r257118

gcc/c-family/ChangeLog
gcc/c-family/c-cppbuiltin.c
libcpp/ChangeLog
libcpp/include/cpplib.h

index 7d293826e5dc5d86053ea31b1f07bf887ac20ea2..335eeeb10b6aeb7dbe3e55d1c8da66c95d00f5e5 100644 (file)
@@ -1,10 +1,19 @@
+2018-01-27  Jakub Jelinek  <jakub@redhat.com>
+
+       * c-cppbuiltin.c (c_cpp_builtins): Use ggc_strdup for the fp_suffix
+       argument.
+       (LAZY_HEX_FP_VALUES_CNT): Define.
+       (lazy_hex_fp_values): Allow up to LAZY_HEX_FP_VALUES_CNT lazy hex fp
+       values rather than just 12.
+       (builtin_define_with_hex_fp_value): Likewise.
+
 2018-01-18  Boris Kolpackov  <boris@codesynthesis.com>
 
         PR other/70268
-        * c-family/c.opt (-fmacro-prefix-map): New option.
-        * c-family/c-opts.c (c_common_handle_option): Handle it.
-        * c-family/c-lex.c (init_c_lex): Set remap_filename cpp callback.
-        * c-family/c-ppoutput.c (init_pp_output): Likewise.
+        * c.opt (-fmacro-prefix-map): New option.
+        * c-opts.c (c_common_handle_option): Handle it.
+        * c-lex.c (init_c_lex): Set remap_filename cpp callback.
+        * c-ppoutput.c (init_pp_output): Likewise.
 
 2018-01-17  David Malcolm  <dmalcolm@redhat.com>
 
index c58e8e70eb4b335793ba99db081bcce8b73d7a13..0624c0062786362b5da442307970f031cb4126f4 100644 (file)
@@ -1124,8 +1124,8 @@ c_cpp_builtins (cpp_reader *pfile)
               floatn_nx_types[i].extended ? "X" : "");
       sprintf (csuffix, "F%d%s", floatn_nx_types[i].n,
               floatn_nx_types[i].extended ? "x" : "");
-      builtin_define_float_constants (prefix, csuffix, "%s", csuffix,
-                                     FLOATN_NX_TYPE_NODE (i));
+      builtin_define_float_constants (prefix, ggc_strdup (csuffix), "%s",
+                                     csuffix, FLOATN_NX_TYPE_NODE (i));
     }
 
   /* For decfloat.h.  */
@@ -1571,7 +1571,14 @@ struct GTY(()) lazy_hex_fp_value_struct
   int digits;
   const char *fp_suffix;
 };
-static GTY(()) struct lazy_hex_fp_value_struct lazy_hex_fp_values[12];
+/* Number of the expensive to compute macros we should evaluate lazily.
+   Each builtin_define_float_constants invocation calls
+   builtin_define_with_hex_fp_value 4 times and builtin_define_float_constants
+   is called for FLT, DBL, LDBL and up to NUM_FLOATN_NX_TYPES times for
+   FLTNN*.  */ 
+#define LAZY_HEX_FP_VALUES_CNT (4 * (3 + NUM_FLOATN_NX_TYPES))
+static GTY(()) struct lazy_hex_fp_value_struct
+  lazy_hex_fp_values[LAZY_HEX_FP_VALUES_CNT];
 static GTY(()) int lazy_hex_fp_value_count;
 
 static bool
@@ -1616,7 +1623,7 @@ builtin_define_with_hex_fp_value (const char *macro,
   char dec_str[64], buf[256], buf1[128], buf2[64];
 
   /* This is very expensive, so if possible expand them lazily.  */
-  if (lazy_hex_fp_value_count < 12
+  if (lazy_hex_fp_value_count < LAZY_HEX_FP_VALUES_CNT
       && flag_dump_macros == 0
       && !cpp_get_options (parse_in)->traditional)
     {
index 5d2aa26b7bfb9ff63fdee8f6a63f736b6a9d8146..fdddd93f9aeee49f0c9e515446d2cb8c13e1f3af 100644 (file)
@@ -1,8 +1,13 @@
+2018-01-27  Jakub Jelinek  <jakub@redhat.com>
+
+       * include/cpplib.h (enum cpp_builtin_type): Change BT_LAST_USER from
+       BT_FIRST_USER + 31 to BT_FIRST_USER + 63.
+
 2018-01-18  Boris Kolpackov  <boris@codesynthesis.com>
 
         PR other/70268
         * include/cpplib.h (cpp_callbacks::remap_filename): New callback.
-        * libcpp/macro.c (_cpp_builtin_macro_text): Call remap_filename for
+        * macro.c (_cpp_builtin_macro_text): Call remap_filename for
         __FILE__ and __BASE_FILE__.
 
 2018-01-10  Kelvin Nilsen  <kelvin@gcc.gnu.org>
index 9814d0d862b95a8c18747d6fb14acb77bae6b9e4..3ad52d5e01e5a78a551c937d2cc6dce4c37a0608 100644 (file)
@@ -719,7 +719,7 @@ enum cpp_builtin_type
   BT_COUNTER,                  /* `__COUNTER__' */
   BT_HAS_ATTRIBUTE,            /* `__has_attribute__(x)' */
   BT_FIRST_USER,               /* User defined builtin macros.  */
-  BT_LAST_USER = BT_FIRST_USER + 31
+  BT_LAST_USER = BT_FIRST_USER + 63
 };
 
 #define CPP_HASHNODE(HNODE)    ((cpp_hashnode *) (HNODE))