[OpenACC] bump version for 2.6 plus libgomp.texi update
[gcc.git] / gcc / c-family / c-cppbuiltin.c
index bb30829c9871984d2de98d60f6454cee0919004d..5532ae46ae146931d416687a1ead79e8990110b1 100644 (file)
@@ -1,5 +1,5 @@
 /* Define builtin-in macros for the C family front ends.
-   Copyright (C) 2002-2016 Free Software Foundation, Inc.
+   Copyright (C) 2002-2020 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -22,6 +22,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "target.h"
 #include "c-common.h"
+#include "memmodel.h"
 #include "tm_p.h"              /* For TARGET_CPU_CPP_BUILTINS & friends.  */
 #include "stringpool.h"
 #include "stor-layout.h"
@@ -30,7 +31,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "output.h"            /* For user_label_prefix.  */
 #include "debug.h"             /* For dwarf2out_do_cfi_asm.  */
 #include "common/common-target.h"
-#include "cpp-id-data.h"
 #include "cppbuiltin.h"
 
 #ifndef TARGET_OS_CPP_BUILTINS
@@ -72,22 +72,27 @@ mode_has_fma (machine_mode mode)
   switch (mode)
     {
 #ifdef HAVE_fmasf4
-    case SFmode:
+    case E_SFmode:
       return !!HAVE_fmasf4;
 #endif
 
 #ifdef HAVE_fmadf4
-    case DFmode:
+    case E_DFmode:
       return !!HAVE_fmadf4;
 #endif
 
+#ifdef HAVE_fmakf4     /* PowerPC if long double != __float128.  */
+    case E_KFmode:
+      return !!HAVE_fmakf4;
+#endif
+
 #ifdef HAVE_fmaxf4
-    case XFmode:
+    case E_XFmode:
       return !!HAVE_fmaxf4;
 #endif
 
 #ifdef HAVE_fmatf4
-    case TFmode:
+    case E_TFmode:
       return !!HAVE_fmatf4;
 #endif
 
@@ -244,22 +249,26 @@ builtin_define_float_constants (const char *name_prefix,
     if (type_decimal_dig < type_d_decimal_dig)
       type_decimal_dig++;
   }
-  /* Arbitrarily, define __DECIMAL_DIG__ when defining macros for long
-     double, although it may be greater than the value for long
-     double.  */
+  /* Define __DECIMAL_DIG__ to the value for long double to be
+     compatible with C99 and C11; see DR#501 and N2108.  */
   if (type == long_double_type_node)
-    builtin_define_with_int_value ("__DECIMAL_DIG__", decimal_dig);
+    builtin_define_with_int_value ("__DECIMAL_DIG__", type_decimal_dig);
   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
      constants.  */
-  get_max_float (fmt, buf, sizeof (buf));
+  get_max_float (fmt, buf, sizeof (buf), false);
 
   sprintf (name, "__%s_MAX__", name_prefix);
   builtin_define_with_hex_fp_value (name, type, decimal_dig, buf, fp_suffix, fp_cast);
 
+  get_max_float (fmt, buf, sizeof (buf), true);
+
+  sprintf (name, "__%s_NORM_MAX__", name_prefix);
+  builtin_define_with_hex_fp_value (name, type, decimal_dig, buf, fp_suffix, fp_cast);
+
   /* The minimum normalized positive floating-point number,
      b**(emin-1).  */
   sprintf (name, "__%s_MIN__", name_prefix);
@@ -698,6 +707,9 @@ cpp_atomic_builtins (cpp_reader *pfile)
                        (have_swap[SWAP_INDEX (boolean_type_node)]? 2 : 1));
   builtin_define_with_int_value ("__GCC_ATOMIC_CHAR_LOCK_FREE", 
                        (have_swap[SWAP_INDEX (signed_char_type_node)]? 2 : 1));
+  if (flag_char8_t)
+    builtin_define_with_int_value ("__GCC_ATOMIC_CHAR8_T_LOCK_FREE",
+                       (have_swap[SWAP_INDEX (char8_type_node)]? 2 : 1));
   builtin_define_with_int_value ("__GCC_ATOMIC_CHAR16_T_LOCK_FREE", 
                        (have_swap[SWAP_INDEX (char16_type_node)]? 2 : 1));
   builtin_define_with_int_value ("__GCC_ATOMIC_CHAR32_T_LOCK_FREE", 
@@ -727,6 +739,31 @@ cpp_atomic_builtins (cpp_reader *pfile)
                        (have_swap[psize]? 2 : 1));
 }
 
+/* Return TRUE if the implicit excess precision in which the back-end will
+   compute floating-point calculations is not more than the explicit
+   excess precision that the front-end will apply under
+   -fexcess-precision=[standard|fast].
+
+   More intuitively, return TRUE if the excess precision proposed by the
+   front-end is the excess precision that will actually be used.  */
+
+static bool
+c_cpp_flt_eval_method_iec_559 (void)
+{
+  enum excess_precision_type front_end_ept
+    = (flag_excess_precision == EXCESS_PRECISION_STANDARD
+       ? EXCESS_PRECISION_TYPE_STANDARD
+       : EXCESS_PRECISION_TYPE_FAST);
+
+  enum flt_eval_method back_end
+    = targetm.c.excess_precision (EXCESS_PRECISION_TYPE_IMPLICIT);
+
+  enum flt_eval_method front_end
+    = targetm.c.excess_precision (front_end_ept);
+
+  return excess_precision_mode_join (front_end, back_end) == front_end;
+}
+
 /* Return the value for __GCC_IEC_559.  */
 static int
 cpp_iec_559_value (void)
@@ -769,16 +806,17 @@ cpp_iec_559_value (void)
       || !dfmt->has_signed_zero)
     ret = 0;
 
-  /* In strict C standards conformance mode, consider unpredictable
-     excess precision to mean lack of IEEE 754 support.  The same
-     applies to unpredictable contraction.  For C++, and outside
-     strict conformance mode, do not consider these options to mean
-     lack of IEEE 754 support.  */
+  /* In strict C standards conformance mode, consider a back-end providing
+     more implicit excess precision than the explicit excess precision
+     the front-end options would require to mean a lack of IEEE 754
+     support.  For C++, and outside strict conformance mode, do not consider
+     this to mean a lack of IEEE 754 support.  */
+
   if (flag_iso
       && !c_dialect_cxx ()
-      && TARGET_FLT_EVAL_METHOD != 0
-      && flag_excess_precision_cmdline != EXCESS_PRECISION_STANDARD)
+      && !c_cpp_flt_eval_method_iec_559 ())
     ret = 0;
+
   if (flag_iso
       && !c_dialect_cxx ()
       && flag_fp_contract_mode == FP_CONTRACT_FAST)
@@ -838,12 +876,6 @@ c_cpp_builtins (cpp_reader *pfile)
   /* For stddef.h.  They require macros defined in c-common.c.  */
   c_stddef_cpp_builtins ();
 
-  /* Set include test macros for all C/C++ (not for just C++11 etc.)
-     The builtins __has_include__ and __has_include_next__ are defined
-     in libcpp.  */
-  cpp_define (pfile, "__has_include(STR)=__has_include__(STR)");
-  cpp_define (pfile, "__has_include_next(STR)=__has_include_next__(STR)");
-
   if (c_dialect_cxx ())
     {
       if (flag_weak && SUPPORTS_ONE_ONLY)
@@ -857,7 +889,7 @@ c_cpp_builtins (cpp_reader *pfile)
       if (flag_rtti)
        {
          cpp_define (pfile, "__GXX_RTTI");
-         cpp_define (pfile, "__cpp_rtti=199711");
+         cpp_define (pfile, "__cpp_rtti=199711L");
        }
 
       if (cxx_dialect >= cxx11)
@@ -866,11 +898,11 @@ c_cpp_builtins (cpp_reader *pfile)
       /* Binary literals have been allowed in g++ before C++11
         and were standardized for C++14.  */
       if (!pedantic || cxx_dialect > cxx11)
-       cpp_define (pfile, "__cpp_binary_literals=201304");
+       cpp_define (pfile, "__cpp_binary_literals=201304L");
 
       /* Similarly for hexadecimal floating point literals and C++17.  */
       if (!pedantic || cpp_get_options (parse_in)->extended_numbers)
-       cpp_define (pfile, "__cpp_hex_float=201603");
+       cpp_define (pfile, "__cpp_hex_float=201603L");
 
       /* Arrays of runtime bound were removed from C++14, but we still
         support GNU VLAs.  Let's define this macro to a low number
@@ -878,78 +910,127 @@ c_cpp_builtins (cpp_reader *pfile)
         complain about use of VLAs.  */
       if (c_dialect_cxx ()
          && (pedantic ? warn_vla == 0 : warn_vla <= 0))
-       cpp_define (pfile, "__cpp_runtime_arrays=198712");
+       cpp_define (pfile, "__cpp_runtime_arrays=198712L");
 
       if (cxx_dialect >= cxx11)
        {
          /* Set feature test macros for C++11.  */
          if (cxx_dialect <= cxx14)
-           cpp_define (pfile, "__cpp_unicode_characters=200704");
-         cpp_define (pfile, "__cpp_raw_strings=200710");
-         cpp_define (pfile, "__cpp_unicode_literals=200710");
-         cpp_define (pfile, "__cpp_user_defined_literals=200809");
-         cpp_define (pfile, "__cpp_lambdas=200907");
+           cpp_define (pfile, "__cpp_unicode_characters=200704L");
+         cpp_define (pfile, "__cpp_raw_strings=200710L");
+         cpp_define (pfile, "__cpp_unicode_literals=200710L");
+         cpp_define (pfile, "__cpp_user_defined_literals=200809L");
+         cpp_define (pfile, "__cpp_lambdas=200907L");
          if (cxx_dialect == cxx11)
-           cpp_define (pfile, "__cpp_constexpr=200704");
+           cpp_define (pfile, "__cpp_constexpr=200704L");
          if (cxx_dialect <= cxx14)
-           cpp_define (pfile, "__cpp_range_based_for=200907");
+           cpp_define (pfile, "__cpp_range_based_for=200907L");
          if (cxx_dialect <= cxx14)
-           cpp_define (pfile, "__cpp_static_assert=200410");
-         cpp_define (pfile, "__cpp_decltype=200707");
-         cpp_define (pfile, "__cpp_attributes=200809");
-         cpp_define (pfile, "__cpp_rvalue_reference=200610");
-         cpp_define (pfile, "__cpp_rvalue_references=200610");
-         cpp_define (pfile, "__cpp_variadic_templates=200704");
-         cpp_define (pfile, "__cpp_initializer_lists=200806");
-         cpp_define (pfile, "__cpp_delegating_constructors=200604");
-         cpp_define (pfile, "__cpp_nsdmi=200809");
-         cpp_define (pfile, "__cpp_inheriting_constructors=200802");
-         cpp_define (pfile, "__cpp_ref_qualifiers=200710");
-         cpp_define (pfile, "__cpp_alias_templates=200704");
+           cpp_define (pfile, "__cpp_static_assert=200410L");
+         cpp_define (pfile, "__cpp_decltype=200707L");
+         cpp_define (pfile, "__cpp_attributes=200809L");
+         cpp_define (pfile, "__cpp_rvalue_reference=200610L");
+         cpp_define (pfile, "__cpp_rvalue_references=200610L");
+         cpp_define (pfile, "__cpp_variadic_templates=200704L");
+         cpp_define (pfile, "__cpp_initializer_lists=200806L");
+         cpp_define (pfile, "__cpp_delegating_constructors=200604L");
+         cpp_define (pfile, "__cpp_nsdmi=200809L");
+         if (!flag_new_inheriting_ctors)
+           cpp_define (pfile, "__cpp_inheriting_constructors=200802L");
+         else
+           cpp_define (pfile, "__cpp_inheriting_constructors=201511L");
+         cpp_define (pfile, "__cpp_ref_qualifiers=200710L");
+         cpp_define (pfile, "__cpp_alias_templates=200704L");
        }
       if (cxx_dialect > cxx11)
        {
          /* Set feature test macros for C++14.  */
-         cpp_define (pfile, "__cpp_return_type_deduction=201304");
-         cpp_define (pfile, "__cpp_init_captures=201304");
-         cpp_define (pfile, "__cpp_generic_lambdas=201304");
+         cpp_define (pfile, "__cpp_return_type_deduction=201304L");
+         if (cxx_dialect <= cxx17)
+           {
+             cpp_define (pfile, "__cpp_init_captures=201304L");
+             cpp_define (pfile, "__cpp_generic_lambdas=201304L");
+           }
          if (cxx_dialect <= cxx14)
-           cpp_define (pfile, "__cpp_constexpr=201304");
-         cpp_define (pfile, "__cpp_decltype_auto=201304");
-         cpp_define (pfile, "__cpp_aggregate_nsdmi=201304");
-         cpp_define (pfile, "__cpp_variable_templates=201304");
-         cpp_define (pfile, "__cpp_digit_separators=201309");
+           cpp_define (pfile, "__cpp_constexpr=201304L");
+         cpp_define (pfile, "__cpp_decltype_auto=201304L");
+         cpp_define (pfile, "__cpp_aggregate_nsdmi=201304L");
+         cpp_define (pfile, "__cpp_variable_templates=201304L");
+         cpp_define (pfile, "__cpp_digit_separators=201309L");
        }
       if (cxx_dialect > cxx14)
        {
-         /* Set feature test macros for C++1z.  */
-         cpp_define (pfile, "__cpp_unicode_characters=201411");
-         cpp_define (pfile, "__cpp_static_assert=201411");
-         cpp_define (pfile, "__cpp_namespace_attributes=201411");
-         cpp_define (pfile, "__cpp_enumerator_attributes=201411");
-         cpp_define (pfile, "__cpp_nested_namespace_definitions=201411");
-         cpp_define (pfile, "__cpp_fold_expressions=201603");
-         cpp_define (pfile, "__cpp_nontype_template_args=201411");
-         cpp_define (pfile, "__cpp_range_based_for=201603");
-         cpp_define (pfile, "__cpp_constexpr=201603");
-         cpp_define (pfile, "__cpp_if_constexpr=201606");
+         /* Set feature test macros for C++17.  */
+         cpp_define (pfile, "__cpp_unicode_characters=201411L");
+         cpp_define (pfile, "__cpp_static_assert=201411L");
+         cpp_define (pfile, "__cpp_namespace_attributes=201411L");
+         cpp_define (pfile, "__cpp_enumerator_attributes=201411L");
+         cpp_define (pfile, "__cpp_nested_namespace_definitions=201411L");
+         cpp_define (pfile, "__cpp_fold_expressions=201603L");
+         cpp_define (pfile, "__cpp_nontype_template_args=201411L");
+         cpp_define (pfile, "__cpp_range_based_for=201603L");
+         if (cxx_dialect <= cxx17)
+           cpp_define (pfile, "__cpp_constexpr=201603L");
+         cpp_define (pfile, "__cpp_if_constexpr=201606L");
+         cpp_define (pfile, "__cpp_capture_star_this=201603L");
+         cpp_define (pfile, "__cpp_inline_variables=201606L");
+         cpp_define (pfile, "__cpp_aggregate_bases=201603L");
+         if (cxx_dialect <= cxx17)
+           cpp_define (pfile, "__cpp_deduction_guides=201703L");
+         cpp_define (pfile, "__cpp_noexcept_function_type=201510L");
+         /* Old macro, superseded by
+            __cpp_nontype_template_parameter_auto.  */
+         cpp_define (pfile, "__cpp_template_auto=201606L");
+         cpp_define (pfile, "__cpp_structured_bindings=201606L");
+         cpp_define (pfile, "__cpp_variadic_using=201611L");
+         cpp_define (pfile, "__cpp_guaranteed_copy_elision=201606L");
+         cpp_define (pfile, "__cpp_nontype_template_parameter_auto=201606L");
+       }
+      if (cxx_dialect > cxx17)
+       {
+         /* Set feature test macros for C++2a.  */
+         cpp_define (pfile, "__cpp_init_captures=201803L");
+         cpp_define (pfile, "__cpp_generic_lambdas=201707L");
+         cpp_define (pfile, "__cpp_designated_initializers=201707L");
+         cpp_define (pfile, "__cpp_constexpr=201907L");
+         cpp_define (pfile, "__cpp_constexpr_in_decltype=201711L");
+         cpp_define (pfile, "__cpp_conditional_explicit=201806L");
+         /* cpp_define (pfile, "__cpp_consteval=201811L"); */
+         cpp_define (pfile, "__cpp_constinit=201907L");
+         cpp_define (pfile, "__cpp_deduction_guides=201907L");
+         cpp_define (pfile, "__cpp_nontype_template_parameter_class=201806L");
+         cpp_define (pfile, "__cpp_impl_destroying_delete=201806L");
+         cpp_define (pfile, "__cpp_constexpr_dynamic_alloc=201907L");
+         cpp_define (pfile, "__cpp_impl_three_way_comparison=201907L");
+         cpp_define (pfile, "__cpp_aggregate_paren_init=201902L");
        }
       if (flag_concepts)
-       /* Use a value smaller than the 201507 specified in
-          the TS, since we don't yet support extended auto.  */
-       cpp_define (pfile, "__cpp_concepts=201500");
+        {
+          if (cxx_dialect >= cxx2a)
+            cpp_define (pfile, "__cpp_concepts=201907L");
+          else
+            cpp_define (pfile, "__cpp_concepts=201507L");
+        }
+      if (flag_coroutines)
+       cpp_define (pfile, "__cpp_coroutines=201902L"); /* n4835, C++20 CD */
       if (flag_tm)
        /* Use a value smaller than the 201505 specified in
           the TS, since we don't yet support atomic_cancel.  */
-       cpp_define (pfile, "__cpp_transactional_memory=210500");
+       cpp_define (pfile, "__cpp_transactional_memory=201500L");
       if (flag_sized_deallocation)
-       cpp_define (pfile, "__cpp_sized_deallocation=201309");
-      if (aligned_new_threshhold)
+       cpp_define (pfile, "__cpp_sized_deallocation=201309L");
+      if (aligned_new_threshold)
        {
-         cpp_define (pfile, "__cpp_aligned_new=201606");
+         cpp_define (pfile, "__cpp_aligned_new=201606L");
          cpp_define_formatted (pfile, "__STDCPP_DEFAULT_NEW_ALIGNMENT__=%d",
-                               aligned_new_threshhold);
+                               aligned_new_threshold);
        }
+      if (flag_new_ttp)
+       cpp_define (pfile, "__cpp_template_template_args=201611L");
+      if (flag_threadsafe_statics)
+       cpp_define (pfile, "__cpp_threadsafe_static_init=200806L");
+      if (flag_char8_t)
+        cpp_define (pfile, "__cpp_char8_t=201811L");
     }
   /* Note that we define this for C as well, so that we know if
      __attribute__((cleanup)) will interface with EH.  */
@@ -957,7 +1038,7 @@ c_cpp_builtins (cpp_reader *pfile)
     {
       cpp_define (pfile, "__EXCEPTIONS");
       if (c_dialect_cxx ())
-       cpp_define (pfile, "__cpp_exceptions=199711");
+       cpp_define (pfile, "__cpp_exceptions=199711L");
     }
 
   /* Represents the C++ ABI version, always defined so it can be used while
@@ -1036,9 +1117,22 @@ c_cpp_builtins (cpp_reader *pfile)
   builtin_define_with_int_value ("__GCC_IEC_559_COMPLEX",
                                 cpp_iec_559_complex_value ());
 
-  /* float.h needs to know this.  */
+  /* float.h needs these to correctly set FLT_EVAL_METHOD
+
+     We define two values:
+
+     __FLT_EVAL_METHOD__
+       Which, depending on the value given for
+       -fpermitted-flt-eval-methods, may be limited to only those values
+       for FLT_EVAL_METHOD defined in C99/C11.
+
+     __FLT_EVAL_METHOD_TS_18661_3__
+       Which always permits the values for FLT_EVAL_METHOD defined in
+       ISO/IEC TS 18661-3.  */
   builtin_define_with_int_value ("__FLT_EVAL_METHOD__",
-                                TARGET_FLT_EVAL_METHOD);
+                                c_flt_eval_method (true));
+  builtin_define_with_int_value ("__FLT_EVAL_METHOD_TS_18661_3__",
+                                c_flt_eval_method (false));
 
   /* And decfloat.h needs this.  */
   builtin_define_with_int_value ("__DEC_EVAL_METHOD__",
@@ -1067,14 +1161,20 @@ 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", NULL,
-                                     FLOATN_NX_TYPE_NODE (i));
+      builtin_define_float_constants (prefix, ggc_strdup (csuffix), "%s",
+                                     csuffix, FLOATN_NX_TYPE_NODE (i));
     }
 
-  /* For decfloat.h.  */
-  builtin_define_decimal_float_constants ("DEC32", "DF", dfloat32_type_node);
-  builtin_define_decimal_float_constants ("DEC64", "DD", dfloat64_type_node);
-  builtin_define_decimal_float_constants ("DEC128", "DL", dfloat128_type_node);
+  /* For float.h.  */
+  if (targetm.decimal_float_supported_p ())
+    {
+      builtin_define_decimal_float_constants ("DEC32", "DF",
+                                             dfloat32_type_node);
+      builtin_define_decimal_float_constants ("DEC64", "DD",
+                                             dfloat64_type_node);
+      builtin_define_decimal_float_constants ("DEC128", "DL",
+                                             dfloat128_type_node);
+    }
 
   /* For fixed-point fibt, ibit, max, min, and epsilon.  */
   if (targetm.fixed_point_supported_p ())
@@ -1136,10 +1236,10 @@ c_cpp_builtins (cpp_reader *pfile)
   if (flag_building_libgcc)
     {
       /* Properties of floating-point modes for libgcc2.c.  */
-      for (machine_mode mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT);
-          mode != VOIDmode;
-          mode = GET_MODE_WIDER_MODE (mode))
+      opt_scalar_float_mode mode_iter;
+      FOR_EACH_MODE_IN_CLASS (mode_iter, MODE_FLOAT)
        {
+         scalar_float_mode mode = mode_iter.require ();
          const char *name = GET_MODE_NAME (mode);
          char *macro_name
            = (char *) alloca (strlen (name)
@@ -1179,25 +1279,38 @@ c_cpp_builtins (cpp_reader *pfile)
              gcc_assert (found_suffix);
            }
          builtin_define_with_value (macro_name, suffix, 0);
+
+         /* The way __LIBGCC_*_EXCESS_PRECISION__ is used is about
+            eliminating excess precision from results assigned to
+            variables - meaning it should be about the implicit excess
+            precision only.  */
          bool excess_precision = false;
-         if (TARGET_FLT_EVAL_METHOD != 0
-             && mode != TYPE_MODE (long_double_type_node)
-             && (mode == TYPE_MODE (float_type_node)
-                 || mode == TYPE_MODE (double_type_node)))
-           switch (TARGET_FLT_EVAL_METHOD)
-             {
-             case -1:
-             case 2:
-               excess_precision = true;
-               break;
-
-             case 1:
-               excess_precision = mode == TYPE_MODE (float_type_node);
-               break;
-
-             default:
-               gcc_unreachable ();
-             }
+         machine_mode float16_type_mode = (float16_type_node
+                                           ? TYPE_MODE (float16_type_node)
+                                           : VOIDmode);
+         switch (targetm.c.excess_precision
+                   (EXCESS_PRECISION_TYPE_IMPLICIT))
+           {
+           case FLT_EVAL_METHOD_UNPREDICTABLE:
+           case FLT_EVAL_METHOD_PROMOTE_TO_LONG_DOUBLE:
+             excess_precision = (mode == float16_type_mode
+                                 || mode == TYPE_MODE (float_type_node)
+                                 || mode == TYPE_MODE (double_type_node));
+             break;
+
+           case FLT_EVAL_METHOD_PROMOTE_TO_DOUBLE:
+             excess_precision = (mode == float16_type_mode
+                                 || mode == TYPE_MODE (float_type_node));
+             break;
+           case FLT_EVAL_METHOD_PROMOTE_TO_FLOAT:
+             excess_precision = mode == float16_type_mode;
+             break;
+           case FLT_EVAL_METHOD_PROMOTE_TO_FLOAT16:
+             excess_precision = false;
+             break;
+           default:
+             gcc_unreachable ();
+           }
          macro_name = (char *) alloca (strlen (name)
                                        + sizeof ("__LIBGCC__EXCESS_"
                                                  "PRECISION__"));
@@ -1212,10 +1325,6 @@ c_cpp_builtins (cpp_reader *pfile)
       builtin_define_with_value ("__LIBGCC_EH_FRAME_SECTION_NAME__",
                                 EH_FRAME_SECTION_NAME, 1);
 #endif
-#ifdef JCR_SECTION_NAME
-      builtin_define_with_value ("__LIBGCC_JCR_SECTION_NAME__",
-                                JCR_SECTION_NAME, 1);
-#endif
 #ifdef CTORS_SECTION_ASM_OP
       builtin_define_with_value ("__LIBGCC_CTORS_SECTION_ASM_OP__",
                                 CTORS_SECTION_ASM_OP, 1);
@@ -1295,7 +1404,12 @@ c_cpp_builtins (cpp_reader *pfile)
     cpp_define (pfile, "__WCHAR_UNSIGNED__");
 
   cpp_atomic_builtins (pfile);
-    
+
+  /* Show support for __builtin_speculation_safe_value () if the target
+     has been updated to fully support it.  */
+  if (targetm.have_speculation_safe_value (false))
+    cpp_define (pfile, "__HAVE_SPECULATION_SAFE_VALUE");
+
 #ifdef DWARF2_UNWIND_INFO
   if (dwarf2out_do_cfi_asm ())
     cpp_define (pfile, "__GCC_HAVE_DWARF2_CFI_ASM");
@@ -1321,7 +1435,7 @@ c_cpp_builtins (cpp_reader *pfile)
     cpp_define (pfile, "__SSP__=1");
 
   if (flag_openacc)
-    cpp_define (pfile, "_OPENACC=201306");
+    cpp_define (pfile, "_OPENACC=201711");
 
   if (flag_openmp)
     cpp_define (pfile, "_OPENMP=201511");
@@ -1500,42 +1614,47 @@ builtin_define_with_int_value (const char *macro, HOST_WIDE_INT value)
 struct GTY(()) lazy_hex_fp_value_struct
 {
   const char *hex_str;
-  cpp_macro *macro;
   machine_mode mode;
   int digits;
   const char *fp_suffix;
 };
-static GTY(()) struct lazy_hex_fp_value_struct lazy_hex_fp_values[12];
-static GTY(()) int lazy_hex_fp_value_count;
+/* Number of the expensive to compute macros we should evaluate lazily.
+   Each builtin_define_float_constants invocation calls
+   builtin_define_with_hex_fp_value 5 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 (5 * (3 + NUM_FLOATN_NX_TYPES))
+static GTY(()) struct lazy_hex_fp_value_struct
+  lazy_hex_fp_values[LAZY_HEX_FP_VALUES_CNT];
+static GTY(()) unsigned lazy_hex_fp_value_count;
 
-static bool
-lazy_hex_fp_value (cpp_reader *pfile ATTRIBUTE_UNUSED,
-                  cpp_hashnode *node)
+static void
+lazy_hex_fp_value (cpp_reader *, cpp_macro *macro, unsigned num)
 {
   REAL_VALUE_TYPE real;
   char dec_str[64], buf1[256];
-  unsigned int idx;
-  if (node->value.builtin < BT_FIRST_USER
-      || (int) node->value.builtin >= BT_FIRST_USER + lazy_hex_fp_value_count)
-    return false;
 
-  idx = node->value.builtin - BT_FIRST_USER;
-  real_from_string (&real, lazy_hex_fp_values[idx].hex_str);
+  gcc_checking_assert (num < lazy_hex_fp_value_count);
+
+  real_from_string (&real, lazy_hex_fp_values[num].hex_str);
   real_to_decimal_for_mode (dec_str, &real, sizeof (dec_str),
-                           lazy_hex_fp_values[idx].digits, 0,
-                           lazy_hex_fp_values[idx].mode);
-
-  sprintf (buf1, "%s%s", dec_str, lazy_hex_fp_values[idx].fp_suffix);
-  node->flags &= ~(NODE_BUILTIN | NODE_USED);
-  node->value.macro = lazy_hex_fp_values[idx].macro;
-  for (idx = 0; idx < node->value.macro->count; idx++)
-    if (node->value.macro->exp.tokens[idx].type == CPP_NUMBER)
-      break;
-  gcc_assert (idx < node->value.macro->count);
-  node->value.macro->exp.tokens[idx].val.str.len = strlen (buf1);
-  node->value.macro->exp.tokens[idx].val.str.text
-    = (const unsigned char *) ggc_strdup (buf1);
-  return true;
+                           lazy_hex_fp_values[num].digits, 0,
+                           lazy_hex_fp_values[num].mode);
+
+  size_t len
+    = sprintf (buf1, "%s%s", dec_str, lazy_hex_fp_values[num].fp_suffix);
+  gcc_assert (len < sizeof (buf1));
+  for (unsigned idx = 0; idx < macro->count; idx++)
+    if (macro->exp.tokens[idx].type == CPP_NUMBER)
+      {
+       macro->exp.tokens[idx].val.str.len = len;
+       macro->exp.tokens[idx].val.str.text
+         = (const unsigned char *) ggc_strdup (buf1);
+       return;
+      }
+
+  /* We must have replaced a token.  */
+  gcc_unreachable ();
 }
 
 /* Pass an object-like macro a hexadecimal floating-point value.  */
@@ -1547,30 +1666,26 @@ builtin_define_with_hex_fp_value (const char *macro,
                                  const char *fp_cast)
 {
   REAL_VALUE_TYPE real;
-  char dec_str[64], buf1[256], buf2[256];
+  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
+      && flag_dump_go_spec == NULL
       && !cpp_get_options (parse_in)->traditional)
     {
-      struct cpp_hashnode *node;
       if (lazy_hex_fp_value_count == 0)
-       cpp_get_callbacks (parse_in)->user_builtin_macro = lazy_hex_fp_value;
+       cpp_get_callbacks (parse_in)->user_lazy_macro = lazy_hex_fp_value;
       sprintf (buf2, fp_cast, "1.1");
       sprintf (buf1, "%s=%s", macro, buf2);
       cpp_define (parse_in, buf1);
-      node = C_CPP_HASHNODE (get_identifier (macro));
+      struct cpp_hashnode *node = C_CPP_HASHNODE (get_identifier (macro));
       lazy_hex_fp_values[lazy_hex_fp_value_count].hex_str
        = ggc_strdup (hex_str);
       lazy_hex_fp_values[lazy_hex_fp_value_count].mode = TYPE_MODE (type);
       lazy_hex_fp_values[lazy_hex_fp_value_count].digits = digits;
       lazy_hex_fp_values[lazy_hex_fp_value_count].fp_suffix = fp_suffix;
-      lazy_hex_fp_values[lazy_hex_fp_value_count].macro = node->value.macro;
-      node->flags |= NODE_BUILTIN;
-      node->value.builtin
-       = (enum cpp_builtin_type) (BT_FIRST_USER + lazy_hex_fp_value_count);
-      lazy_hex_fp_value_count++;
+      cpp_define_lazily (parse_in, node, lazy_hex_fp_value_count++);
       return;
     }
 
@@ -1590,11 +1705,11 @@ builtin_define_with_hex_fp_value (const char *macro,
 
   /* Assemble the macro in the following fashion
      macro = fp_cast [dec_str fp_suffix] */
-  sprintf (buf1, "%s%s", dec_str, fp_suffix);
-  sprintf (buf2, fp_cast, buf1);
-  sprintf (buf1, "%s=%s", macro, buf2);
+  sprintf (buf2, "%s%s", dec_str, fp_suffix);
+  sprintf (buf1, fp_cast, buf2);
+  sprintf (buf, "%s=%s", macro, buf1);
 
-  cpp_define (parse_in, buf1);
+  cpp_define (parse_in, buf);
 }
 
 /* Return a string constant for the suffix for a value of type TYPE