===================================================================
@@ -166,7 +166,7 @@
enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_GNUC11,
CLK_STDC89, CLK_STDC94, CLK_STDC99, CLK_STDC11,
CLK_GNUCXX, CLK_CXX98, CLK_GNUCXX11, CLK_CXX11,
- CLK_GNUCXX1Y, CLK_CXX1Y, CLK_ASM};
+ CLK_GNUCXX14, CLK_CXX14, CLK_GNUCXX1Z, CLK_CXX1Z, CLK_ASM};
/* Payload of a NUMBER, STRING, CHAR or COMMENT token. */
struct GTY(()) cpp_string {
===================================================================
@@ -90,26 +90,29 @@
char user_literals;
char binary_constants;
char digit_separators;
+ char trigraphs;
};
static const struct lang_flags lang_defaults[] =
-{ /* c99 c++ xnum xid c11 std // digr ulit rlit udlit bin_cst dig_sep */
- /* GNUC89 */ { 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
- /* GNUC99 */ { 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0 },
- /* GNUC11 */ { 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0 },
- /* STDC89 */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 },
- /* STDC94 */ { 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0 },
- /* STDC99 */ { 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0 },
- /* STDC11 */ { 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0 },
- /* GNUCXX */ { 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
- /* CXX98 */ { 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0 },
- /* GNUCXX11 */ { 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0 },
- /* CXX11 */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0 },
- /* GNUCXX1Y */ { 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1 },
- /* CXX1Y */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
- /* ASM */ { 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 }
+{ /* c99 c++ xnum xid c11 std // digr ulit rlit udlit bincst digsep trig */
+ /* GNUC89 */ { 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 },
+ /* GNUC99 */ { 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 },
+ /* GNUC11 */ { 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0 },
+ /* STDC89 */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1 },
+ /* STDC94 */ { 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1 },
+ /* STDC99 */ { 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1 },
+ /* STDC11 */ { 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1 },
+ /* GNUCXX */ { 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 },
+ /* CXX98 */ { 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1 },
+ /* GNUCXX11 */ { 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0 },
+ /* CXX11 */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1 },
+ /* GNUCXX14 */ { 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0 },
+ /* CXX14 */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
+ /* GNUCXX1Z */ { 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0 },
+ /* CXX1Z */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 },
+ /* ASM */ { 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 }
/* xid should be 1 for GNUC99, STDC99, GNUCXX, CXX98, GNUCXX11, CXX11,
- GNUCXX1Y, and CXX1Y when no longer experimental (when all uses of
+ GNUCXX14, and CXX14 when no longer experimental (when all uses of
identifiers in the compiler have been audited for correct handling
of extended identifiers). */
};
@@ -128,7 +131,6 @@
CPP_OPTION (pfile, extended_identifiers) = l->extended_identifiers;
CPP_OPTION (pfile, c11_identifiers) = l->c11_identifiers;
CPP_OPTION (pfile, std) = l->std;
- CPP_OPTION (pfile, trigraphs) = l->std;
CPP_OPTION (pfile, cplusplus_comments) = l->cplusplus_comments;
CPP_OPTION (pfile, digraphs) = l->digraphs;
CPP_OPTION (pfile, uliterals) = l->uliterals;
@@ -136,6 +138,7 @@
CPP_OPTION (pfile, user_literals) = l->user_literals;
CPP_OPTION (pfile, binary_constants) = l->binary_constants;
CPP_OPTION (pfile, digit_separators) = l->digit_separators;
+ CPP_OPTION (pfile, trigraphs) = l->trigraphs;
}
/* Initialize library global state. */
@@ -489,9 +492,12 @@
if (CPP_OPTION (pfile, cplusplus))
{
- if (CPP_OPTION (pfile, lang) == CLK_CXX1Y
- || CPP_OPTION (pfile, lang) == CLK_GNUCXX1Y)
- _cpp_define_builtin (pfile, "__cplusplus 201300L");
+ if (CPP_OPTION (pfile, lang) == CLK_CXX1Z
+ || CPP_OPTION (pfile, lang) == CLK_GNUCXX1Z)
+ _cpp_define_builtin (pfile, "__cplusplus 201500L");
+ else if (CPP_OPTION (pfile, lang) == CLK_CXX14
+ || CPP_OPTION (pfile, lang) == CLK_GNUCXX14)
+ _cpp_define_builtin (pfile, "__cplusplus 201402L");
else if (CPP_OPTION (pfile, lang) == CLK_CXX11
|| CPP_OPTION (pfile, lang) == CLK_GNUCXX11)
_cpp_define_builtin (pfile, "__cplusplus 201103L");
===================================================================
@@ -640,8 +640,9 @@
/* C++11 */
cxx0x,
cxx11 = cxx0x,
- /* C++1y (C++14?) */
+ /* C++14 */
cxx1y,
+ cxx14 = cxx1y,
/* C++1z (C++17?) */
cxx1z
};
===================================================================
@@ -115,7 +115,7 @@
static void handle_OPT_d (const char *);
static void set_std_cxx98 (int);
static void set_std_cxx11 (int);
-static void set_std_cxx1y (int);
+static void set_std_cxx14 (int);
static void set_std_cxx1z (int);
static void set_std_c89 (int, int);
static void set_std_c99 (int);
@@ -697,7 +697,7 @@
case OPT_std_gnu__1y:
if (!preprocessing_asm_p)
{
- set_std_cxx1y (code == OPT_std_c__1y /* ISO */);
+ set_std_cxx14 (code == OPT_std_c__1y /* ISO */);
if (code == OPT_std_c__1y)
cpp_opts->ext_numeric_literals = 0;
}
@@ -1578,9 +1578,9 @@
/* Set the C++ 201y draft standard (without GNU extensions if ISO). */
static void
-set_std_cxx1y (int iso)
+set_std_cxx14 (int iso)
{
- cpp_set_lang (parse_in, iso ? CLK_CXX1Y: CLK_GNUCXX1Y);
+ cpp_set_lang (parse_in, iso ? CLK_CXX14: CLK_GNUCXX14);
flag_no_gnu_keywords = iso;
flag_no_nonansi_builtin = iso;
flag_iso = iso;
@@ -1587,7 +1587,7 @@
/* C++11 includes the C99 standard library. */
flag_isoc94 = 1;
flag_isoc99 = 1;
- cxx_dialect = cxx1y;
+ cxx_dialect = cxx14;
}
/* Set the C++ 201z draft standard (without GNU extensions if ISO). */
@@ -1594,7 +1594,7 @@
static void
set_std_cxx1z (int iso)
{
- cpp_set_lang (parse_in, iso ? CLK_CXX1Y: CLK_GNUCXX1Y);
+ cpp_set_lang (parse_in, iso ? CLK_CXX1Z: CLK_GNUCXX1Z);
flag_no_gnu_keywords = iso;
flag_no_nonansi_builtin = iso;
flag_iso = iso;
@@ -1601,6 +1601,7 @@
/* C++11 includes the C99 standard library. */
flag_isoc94 = 1;
flag_isoc99 = 1;
+ flag_isoc11 = 1;
cxx_dialect = cxx1z;
}
===================================================================
@@ -144,12 +144,12 @@
build_int_cst (TREE_TYPE (tt), 0));
}
- /* For signed x << y, in C++11/C++14, the following:
+ /* For signed x << y, in C++11 and later, the following:
x < 0 || ((unsigned) x >> (precm1 - y))
if > 1, is undefined. */
if (code == LSHIFT_EXPR
&& !TYPE_UNSIGNED (TREE_TYPE (op0))
- && (cxx_dialect == cxx11 || cxx_dialect == cxx1y))
+ && (cxx_dialect >= cxx11))
{
tree x = fold_build2 (MINUS_EXPR, integer_type_node, precm1, op1);
tt = fold_convert_loc (loc, unsigned_type_for (type0), op0);
===================================================================
@@ -8385,7 +8385,7 @@
/* We don't allow VLAs at non-function scopes, or during
tentative template substitution. */
|| !at_function_scope_p ()
- || (cxx_dialect < cxx1y && !(complain & tf_error)))
+ || (cxx_dialect < cxx14 && !(complain & tf_error)))
{
if (!(complain & tf_error))
return error_mark_node;
@@ -8397,7 +8397,7 @@
error ("size of array is not an integral constant-expression");
size = integer_one_node;
}
- else if (cxx_dialect < cxx1y && pedantic && warn_vla != 0)
+ else if (cxx_dialect < cxx14 && pedantic && warn_vla != 0)
{
if (name)
pedwarn (input_location, OPT_Wvla, "ISO C++ forbids variable length array %qD", name);
@@ -8455,7 +8455,7 @@
stabilize_vla_size (itype);
- if (cxx_dialect >= cxx1y && flag_exceptions)
+ if (cxx_dialect >= cxx14 && flag_exceptions)
{
/* If the VLA bound is larger than half the address space,
or less than zero, throw std::bad_array_length. */
@@ -8598,7 +8598,7 @@
return error_mark_node;
}
- if (cxx_dialect >= cxx1y && array_of_runtime_bound_p (type)
+ if (cxx_dialect >= cxx14 && array_of_runtime_bound_p (type)
&& (flag_iso || warn_vla > 0))
pedwarn (input_location, OPT_Wvla, "array of array of runtime bound");
@@ -9621,7 +9621,7 @@
if (current_class_type
&& LAMBDA_TYPE_P (current_class_type))
/* OK for C++11 lambdas. */;
- else if (cxx_dialect < cxx1y)
+ else if (cxx_dialect < cxx14)
{
error ("%qs function uses "
"%<auto%> type specifier without trailing "
@@ -9844,7 +9844,7 @@
: G_("cannot declare pointer to qualified function type %qT"),
type);
- if (cxx_dialect >= cxx1y && array_of_runtime_bound_p (type)
+ if (cxx_dialect >= cxx14 && array_of_runtime_bound_p (type)
&& (flag_iso || warn_vla > 0))
pedwarn (input_location, OPT_Wvla,
declarator->kind == cdk_reference
@@ -10193,7 +10193,7 @@
type = error_mark_node;
}
- if (cxx_dialect >= cxx1y && array_of_runtime_bound_p (type)
+ if (cxx_dialect >= cxx14 && array_of_runtime_bound_p (type)
&& (flag_iso || warn_vla > 0))
pedwarn (input_location, OPT_Wvla,
"typedef naming array of runtime bound");
@@ -10439,7 +10439,7 @@
if (type_uses_auto (type))
{
- if (cxx_dialect >= cxx1y)
+ if (cxx_dialect >= cxx14)
error ("%<auto%> parameter not permitted in this context");
else
error ("parameter declared %<auto%>");
@@ -14565,7 +14565,7 @@
bool
undeduced_auto_decl (tree decl)
{
- if (cxx_dialect < cxx1y)
+ if (cxx_dialect < cxx14)
return false;
return type_uses_auto (TREE_TYPE (decl));
}
===================================================================
@@ -4970,7 +4970,7 @@
/* ~auto means the destructor of whatever the object is. */
if (cp_parser_is_keyword (token, RID_AUTO))
{
- if (cxx_dialect < cxx1y)
+ if (cxx_dialect < cxx14)
pedwarn (input_location, 0,
"%<~auto%> only available with "
"-std=c++1y or -std=gnu++1y");
@@ -6819,7 +6819,7 @@
&& cp_lexer_nth_token_is_keyword (parser->lexer, 2, RID_AUTO)
&& !type_dependent_expression_p (object))
{
- if (cxx_dialect < cxx1y)
+ if (cxx_dialect < cxx14)
pedwarn (input_location, 0,
"%<~auto%> only available with "
"-std=c++1y or -std=gnu++1y");
@@ -8975,7 +8975,7 @@
{
bool direct, non_constant;
/* An explicit initializer exists. */
- if (cxx_dialect < cxx1y)
+ if (cxx_dialect < cxx14)
pedwarn (input_location, 0,
"lambda capture initializers "
"only available with -std=c++1y or -std=gnu++1y");
@@ -9101,7 +9101,7 @@
an opening angle if present. */
if (cp_lexer_next_token_is (parser->lexer, CPP_LESS))
{
- if (cxx_dialect < cxx1y)
+ if (cxx_dialect < cxx14)
pedwarn (parser->lexer->next_token->location, 0,
"lambda templates are only available with "
"-std=c++1y or -std=gnu++1y");
@@ -12079,7 +12079,7 @@
return error_mark_node;
/* decltype (auto) */
- if (cxx_dialect >= cxx1y
+ if (cxx_dialect >= cxx14
&& cp_lexer_next_token_is_keyword (parser->lexer, RID_AUTO))
{
cp_lexer_consume_token (parser->lexer);
@@ -12262,7 +12262,7 @@
if (! cp_parser_uncommitted_to_tentative_parse_p (parser)
&& type_uses_auto (type_specified))
{
- if (cxx_dialect < cxx1y)
+ if (cxx_dialect < cxx14)
{
error ("invalid use of %<auto%> in conversion operator");
return error_mark_node;
@@ -14633,13 +14633,13 @@
if (current_class_type && LAMBDA_TYPE_P (current_class_type))
{
- if (cxx_dialect < cxx1y)
+ if (cxx_dialect < cxx14)
pedwarn (location_of (type), 0,
"use of %<auto%> in lambda parameter declaration "
"only available with "
"-std=c++1y or -std=gnu++1y");
}
- else if (cxx_dialect < cxx1y)
+ else if (cxx_dialect < cxx14)
pedwarn (location_of (type), 0,
"use of %<auto%> in parameter declaration "
"only available with "
@@ -18136,7 +18136,7 @@
if (type_specifier_seq.type
/* None of the valid uses of 'auto' in C++14 involve the type-id
nonterminal, but it is valid in a trailing-return-type. */
- && !(cxx_dialect >= cxx1y && is_trailing_return)
+ && !(cxx_dialect >= cxx14 && is_trailing_return)
&& type_uses_auto (type_specifier_seq.type))
{
/* A type-id with type 'auto' is only ok if the abstract declarator
@@ -18169,7 +18169,7 @@
= G_("types may not be defined in template arguments");
r = cp_parser_type_id_1 (parser, true, false);
parser->type_definition_forbidden_message = saved_message;
- if (cxx_dialect >= cxx1y && type_uses_auto (r))
+ if (cxx_dialect >= cxx14 && type_uses_auto (r))
{
error ("invalid use of %<auto%> in template argument");
r = error_mark_node;
@@ -21996,7 +21996,7 @@
if (is_attribute_p ("noreturn", attr_id))
TREE_PURPOSE (TREE_PURPOSE (attribute)) = get_identifier ("gnu");
/* C++14 deprecated attribute is equivalent to GNU's. */
- else if (cxx_dialect >= cxx1y && is_attribute_p ("deprecated", attr_id))
+ else if (cxx_dialect >= cxx14 && is_attribute_p ("deprecated", attr_id))
TREE_PURPOSE (TREE_PURPOSE (attribute)) = get_identifier ("gnu");
}
@@ -23209,7 +23209,7 @@
|| !TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (parm)))
ok = false;
}
- else if (num_parms == 2 && cxx_dialect >= cxx1y)
+ else if (num_parms == 2 && cxx_dialect >= cxx14)
{
tree parm_type = TREE_VEC_ELT (parameter_list, 0);
tree type = INNERMOST_TEMPLATE_PARMS (parm_type);
@@ -23224,7 +23224,7 @@
}
if (!ok)
{
- if (cxx_dialect >= cxx1y)
+ if (cxx_dialect >= cxx14)
error ("literal operator template %qD has invalid parameter list."
" Expected non-type template argument pack <char...>"
" or <typename CharT, CharT...>",
===================================================================
@@ -12043,7 +12043,7 @@
r = cp_build_reference_type (type, TYPE_REF_IS_RVALUE (t));
r = cp_build_qualified_type_real (r, cp_type_quals (t), complain);
- if (cxx_dialect >= cxx1y
+ if (cxx_dialect >= cxx14
&& !(TREE_CODE (t) == REFERENCE_TYPE && REFERENCE_VLA_OK (t))
&& array_of_runtime_bound_p (type)
&& (flag_iso || warn_vla > 0))
===================================================================
@@ -1611,7 +1611,7 @@
force_paren_expr (tree expr)
{
/* This is only needed for decltype(auto) in C++14. */
- if (cxx_dialect < cxx1y)
+ if (cxx_dialect < cxx14)
return expr;
/* If we're in unevaluated context, we can't be deducing a
@@ -7048,7 +7048,7 @@
}
}
- if (cxx_dialect >= cxx1y && array_of_runtime_bound_p (type)
+ if (cxx_dialect >= cxx14 && array_of_runtime_bound_p (type)
&& (flag_iso || warn_vla > 0))
{
if (complain & tf_warning_or_error)
===================================================================
@@ -1148,7 +1148,7 @@
/* In C++14 we can end up comparing 'auto' to a normal template
parameter. Don't confuse them. */
- if (cxx_dialect >= cxx1y && (is_auto (t1) || is_auto (t2)))
+ if (cxx_dialect >= cxx14 && (is_auto (t1) || is_auto (t2)))
return TYPE_IDENTIFIER (t1) == TYPE_IDENTIFIER (t2);
return true;
@@ -1558,7 +1558,7 @@
return value;
}
- if (cxx_dialect >= cxx1y && array_of_runtime_bound_p (type)
+ if (cxx_dialect >= cxx14 && array_of_runtime_bound_p (type)
&& (flag_iso || warn_vla > 0))
{
if (complain & tf_warning_or_error)
@@ -5493,7 +5493,7 @@
if (argtype != error_mark_node)
{
- if (cxx_dialect >= cxx1y && array_of_runtime_bound_p (argtype)
+ if (cxx_dialect >= cxx14 && array_of_runtime_bound_p (argtype)
&& (flag_iso || warn_vla > 0))
{
if (complain & tf_warning_or_error)
@@ -6315,7 +6315,7 @@
/* In C++14 mode, this interacts badly with force_paren_expr. And it
isn't necessary in any mode, because the code below handles
glvalues properly. For 4.9, just skip it in C++14 mode. */
- if (cxx_dialect < cxx1y && REFERENCE_REF_P (expr))
+ if (cxx_dialect < cxx14 && REFERENCE_REF_P (expr))
expr = TREE_OPERAND (expr, 0);
if ((TREE_CODE (type) == REFERENCE_TYPE