/* Define builtin-in macros for the C family front ends.
- Copyright (C) 2002-2019 Free Software Foundation, Inc.
+ Copyright (C) 2002-2020 Free Software Foundation, Inc.
This file is part of GCC.
/* 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);
/* 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)
if (flag_rtti)
{
cpp_define (pfile, "__GXX_RTTI");
- cpp_define (pfile, "__cpp_rtti=199711");
+ cpp_define (pfile, "__cpp_rtti=199711L");
}
if (cxx_dialect >= cxx11)
/* 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
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_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=200802");
+ cpp_define (pfile, "__cpp_inheriting_constructors=200802L");
else
- cpp_define (pfile, "__cpp_inheriting_constructors=201511");
- cpp_define (pfile, "__cpp_ref_qualifiers=200710");
- cpp_define (pfile, "__cpp_alias_templates=200704");
+ 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++17. */
- 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");
- cpp_define (pfile, "__cpp_capture_star_this=201603");
- cpp_define (pfile, "__cpp_inline_variables=201606");
- cpp_define (pfile, "__cpp_aggregate_bases=201603");
- cpp_define (pfile, "__cpp_deduction_guides=201703");
- cpp_define (pfile, "__cpp_noexcept_function_type=201510");
+ 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=201606");
- cpp_define (pfile, "__cpp_structured_bindings=201606");
- cpp_define (pfile, "__cpp_variadic_using=201611");
- cpp_define (pfile, "__cpp_guaranteed_copy_elision=201606");
- cpp_define (pfile, "__cpp_nontype_template_parameter_auto=201606");
+ 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_conditional_explicit=201806");
- cpp_define (pfile, "__cpp_nontype_template_parameter_class=201806");
- cpp_define (pfile, "__cpp_impl_destroying_delete=201806");
+ 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)
- cpp_define (pfile, "__cpp_concepts=201507");
+ {
+ 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=201500");
+ cpp_define (pfile, "__cpp_transactional_memory=201500L");
if (flag_sized_deallocation)
- cpp_define (pfile, "__cpp_sized_deallocation=201309");
+ 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_threshold);
}
if (flag_new_ttp)
- cpp_define (pfile, "__cpp_template_template_args=201611");
+ cpp_define (pfile, "__cpp_template_template_args=201611L");
if (flag_threadsafe_statics)
- cpp_define (pfile, "__cpp_threadsafe_static_init=200806");
+ cpp_define (pfile, "__cpp_threadsafe_static_init=200806L");
if (flag_char8_t)
- cpp_define (pfile, "__cpp_char8_t=201811");
+ 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. */
{
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
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 ())
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");
};
/* 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
+ 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 (4 * (3 + NUM_FLOATN_NX_TYPES))
+#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;
/* This is very expensive, so if possible expand them lazily. */
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)
{
if (lazy_hex_fp_value_count == 0)