switch (str)
{
case CPP0X_INITIALIZER_LISTS:
- pedwarn (input_location, 0,
+ pedwarn (input_location, OPT_Wc__11_extensions,
"extended initializer lists "
"only available with %<-std=c++11%> or %<-std=gnu++11%>");
break;
case CPP0X_EXPLICIT_CONVERSION:
- pedwarn (input_location, 0,
+ pedwarn (input_location, OPT_Wc__11_extensions,
"explicit conversion operators "
"only available with %<-std=c++11%> or %<-std=gnu++11%>");
break;
case CPP0X_VARIADIC_TEMPLATES:
- pedwarn (input_location, 0,
+ pedwarn (input_location, OPT_Wc__11_extensions,
"variadic templates "
"only available with %<-std=c++11%> or %<-std=gnu++11%>");
break;
case CPP0X_LAMBDA_EXPR:
- pedwarn (input_location, 0,
+ pedwarn (input_location, OPT_Wc__11_extensions,
"lambda expressions "
"only available with %<-std=c++11%> or %<-std=gnu++11%>");
break;
case CPP0X_AUTO:
- pedwarn (input_location, 0,
+ pedwarn (input_location, OPT_Wc__11_extensions,
"C++11 auto only available with %<-std=c++11%> or "
"%<-std=gnu++11%>");
break;
case CPP0X_SCOPED_ENUMS:
- pedwarn (input_location, 0,
+ pedwarn (input_location, OPT_Wc__11_extensions,
"scoped enums only available with %<-std=c++11%> or "
"%<-std=gnu++11%>");
break;
case CPP0X_DEFAULTED_DELETED:
- pedwarn (input_location, 0,
+ pedwarn (input_location, OPT_Wc__11_extensions,
"defaulted and deleted functions "
"only available with %<-std=c++11%> or %<-std=gnu++11%>");
break;
case CPP0X_INLINE_NAMESPACES:
- pedwarn (input_location, OPT_Wpedantic,
- "inline namespaces "
- "only available with %<-std=c++11%> or %<-std=gnu++11%>");
+ if (pedantic)
+ pedwarn (input_location, OPT_Wc__11_extensions,
+ "inline namespaces "
+ "only available with %<-std=c++11%> or %<-std=gnu++11%>");
break;
case CPP0X_OVERRIDE_CONTROLS:
- pedwarn (input_location, 0,
+ pedwarn (input_location, OPT_Wc__11_extensions,
"override controls (override/final) "
"only available with %<-std=c++11%> or %<-std=gnu++11%>");
break;
case CPP0X_NSDMI:
- pedwarn (input_location, 0,
+ pedwarn (input_location, OPT_Wc__11_extensions,
"non-static data member initializers "
"only available with %<-std=c++11%> or %<-std=gnu++11%>");
break;
case CPP0X_USER_DEFINED_LITERALS:
- pedwarn (input_location, 0,
+ pedwarn (input_location, OPT_Wc__11_extensions,
"user-defined literals "
"only available with %<-std=c++11%> or %<-std=gnu++11%>");
break;
case CPP0X_DELEGATING_CTORS:
- pedwarn (input_location, 0,
+ pedwarn (input_location, OPT_Wc__11_extensions,
"delegating constructors "
"only available with %<-std=c++11%> or %<-std=gnu++11%>");
break;
case CPP0X_INHERITING_CTORS:
- pedwarn (input_location, 0,
+ pedwarn (input_location, OPT_Wc__11_extensions,
"inheriting constructors "
"only available with %<-std=c++11%> or %<-std=gnu++11%>");
break;
case CPP0X_ATTRIBUTES:
- pedwarn (input_location, 0,
- "c++11 attributes "
+ pedwarn (input_location, OPT_Wc__11_extensions,
+ "C++11 attributes "
"only available with %<-std=c++11%> or %<-std=gnu++11%>");
break;
case CPP0X_REF_QUALIFIER:
- pedwarn (input_location, 0,
+ pedwarn (input_location, OPT_Wc__11_extensions,
"ref-qualifiers "
"only available with %<-std=c++11%> or %<-std=gnu++11%>");
break;
expr = cp_parser_fold_expression (parser, expr);
if (expr != error_mark_node
&& cxx_dialect < cxx17)
- pedwarn (input_location, 0, "fold-expressions only available "
- "with %<-std=c++17%> or %<-std=gnu++17%>");
+ pedwarn (input_location, OPT_Wc__17_extensions,
+ "fold-expressions only available with %<-std=c++17%> "
+ "or %<-std=gnu++17%>");
}
else
/* Let the front end know that this expression was
if (cp_parser_is_keyword (token, RID_AUTO))
{
if (cxx_dialect < cxx14)
- pedwarn (loc, 0,
+ pedwarn (loc, OPT_Wc__14_extensions,
"%<~auto%> only available with "
"%<-std=c++14%> or %<-std=gnu++14%>");
cp_lexer_consume_token (parser->lexer);
&& !type_dependent_expression_p (object))
{
if (cxx_dialect < cxx14)
- pedwarn (input_location, 0,
+ pedwarn (input_location, OPT_Wc__14_extensions,
"%<~auto%> only available with "
"%<-std=c++14%> or %<-std=gnu++14%>");
cp_lexer_consume_token (parser->lexer);
{
location_t loc = cp_lexer_peek_token (parser->lexer)->location;
if (cxx_dialect < cxx17)
- pedwarn (loc, 0, "%<*this%> capture only available with "
- "%<-std=c++17%> or %<-std=gnu++17%>");
+ pedwarn (loc, OPT_Wc__17_extensions,
+ "%<*this%> capture only available with "
+ "%<-std=c++17%> or %<-std=gnu++17%>");
cp_lexer_consume_token (parser->lexer);
cp_lexer_consume_token (parser->lexer);
if (LAMBDA_EXPR_THIS_CAPTURE (lambda_expr))
{
ellipsis_loc = cp_lexer_peek_token (parser->lexer)->location;
if (cxx_dialect < cxx20)
- pedwarn (ellipsis_loc, 0, "pack init-capture only available with "
+ pedwarn (ellipsis_loc, OPT_Wc__20_extensions,
+ "pack init-capture only available with "
"%<-std=c++20%> or %<-std=gnu++20%>");
cp_lexer_consume_token (parser->lexer);
init_pack_expansion = true;
bool direct, non_constant;
/* An explicit initializer exists. */
if (cxx_dialect < cxx14)
- pedwarn (input_location, 0,
+ pedwarn (input_location, OPT_Wc__14_extensions,
"lambda capture initializers "
"only available with %<-std=c++14%> or %<-std=gnu++14%>");
capture_init_expr = cp_parser_initializer (parser, &direct,
if (cp_lexer_next_token_is (parser->lexer, CPP_LESS))
{
if (cxx_dialect < cxx14)
- pedwarn (parser->lexer->next_token->location, 0,
+ pedwarn (parser->lexer->next_token->location, OPT_Wc__14_extensions,
"lambda templates are only available with "
"%<-std=c++14%> or %<-std=gnu++14%>");
- else if (cxx_dialect < cxx20)
- pedwarn (parser->lexer->next_token->location, OPT_Wpedantic,
+ else if (pedantic && cxx_dialect < cxx20)
+ pedwarn (parser->lexer->next_token->location, OPT_Wc__20_extensions,
"lambda templates are only available with "
"%<-std=c++20%> or %<-std=gnu++20%>");
/* Default arguments shall not be specified in the
parameter-declaration-clause of a lambda-declarator. */
- if (cxx_dialect < cxx14)
+ if (pedantic && cxx_dialect < cxx14)
for (tree t = param_list; t; t = TREE_CHAIN (t))
if (TREE_PURPOSE (t) && DECL_P (TREE_VALUE (t)))
- pedwarn (DECL_SOURCE_LOCATION (TREE_VALUE (t)), OPT_Wpedantic,
+ pedwarn (DECL_SOURCE_LOCATION (TREE_VALUE (t)),
+ OPT_Wc__14_extensions,
"default argument specified for lambda parameter");
parens.require_close (parser);
if (omitted_parms_loc && lambda_specs.any_specifiers_p)
{
- pedwarn (omitted_parms_loc, 0,
+ pedwarn (omitted_parms_loc, OPT_Wc__23_extensions,
"parameter declaration before lambda declaration "
"specifiers only optional with %<-std=c++2b%> or "
"%<-std=gnu++2b%>");
tx_qual = cp_parser_tx_qualifier_opt (parser);
if (omitted_parms_loc && tx_qual)
{
- pedwarn (omitted_parms_loc, 0,
+ pedwarn (omitted_parms_loc, OPT_Wc__23_extensions,
"parameter declaration before lambda transaction "
"qualifier only optional with %<-std=c++2b%> or "
"%<-std=gnu++2b%>");
if (omitted_parms_loc && exception_spec)
{
- pedwarn (omitted_parms_loc, 0,
+ pedwarn (omitted_parms_loc, OPT_Wc__23_extensions,
"parameter declaration before lambda exception "
"specification only optional with %<-std=c++2b%> or "
"%<-std=gnu++2b%>");
if (cp_lexer_next_token_is (parser->lexer, CPP_DEREF))
{
if (omitted_parms_loc)
- pedwarn (omitted_parms_loc, 0,
+ pedwarn (omitted_parms_loc, OPT_Wc__23_extensions,
"parameter declaration before lambda trailing "
"return type only optional with %<-std=c++2b%> or "
"%<-std=gnu++2b%>");
cx = true;
cp_token *tok = cp_lexer_consume_token (parser->lexer);
if (cxx_dialect < cxx17)
- pedwarn (tok->location, 0, "%<if constexpr%> only available "
- "with %<-std=c++17%> or %<-std=gnu++17%>");
+ pedwarn (tok->location, OPT_Wc__17_extensions,
+ "%<if constexpr%> only available with "
+ "%<-std=c++17%> or %<-std=gnu++17%>");
}
/* Look for the `('. */
{
tree decl;
if (cxx_dialect < cxx17)
- pedwarn (cp_lexer_peek_token (parser->lexer)->location, 0,
+ pedwarn (cp_lexer_peek_token (parser->lexer)->location,
+ OPT_Wc__17_extensions,
"init-statement in selection statements only available "
"with %<-std=c++17%> or %<-std=gnu++17%>");
if (cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON))
if (cxx_dialect < cxx20)
{
- pedwarn (cp_lexer_peek_token (parser->lexer)->location, 0,
+ pedwarn (cp_lexer_peek_token (parser->lexer)->location,
+ OPT_Wc__20_extensions,
"range-based %<for%> loops with initializer only "
"available with %<-std=c++20%> or %<-std=gnu++20%>");
*decl = error_mark_node;
cp_lexer_consume_token (parser->lexer);
is_range_for = true;
if (cxx_dialect < cxx11)
- pedwarn (cp_lexer_peek_token (parser->lexer)->location, 0,
+ pedwarn (cp_lexer_peek_token (parser->lexer)->location,
+ OPT_Wc__11_extensions,
"range-based %<for%> loops only available with "
"%<-std=c++11%> or %<-std=gnu++11%>");
}
}
if (cxx_dialect < cxx17)
- pedwarn (loc, 0, "structured bindings only available with "
- "%<-std=c++17%> or %<-std=gnu++17%>");
+ pedwarn (loc, OPT_Wc__17_extensions,
+ "structured bindings only available with "
+ "%<-std=c++17%> or %<-std=gnu++17%>");
tree pushed_scope;
cp_declarator *declarator = make_declarator (cdk_decomp);
= G_("types may not be defined in explicit-specifier");
if (cxx_dialect < cxx20)
- pedwarn (token->location, 0,
+ pedwarn (token->location, OPT_Wc__20_extensions,
"%<explicit(bool)%> only available with %<-std=c++20%> "
"or %<-std=gnu++20%>");
if (cp_lexer_peek_token (parser->lexer)->type == CPP_CLOSE_PAREN)
{
- if (cxx_dialect < cxx17)
- pedwarn (input_location, OPT_Wpedantic,
+ if (pedantic && cxx_dialect < cxx17)
+ pedwarn (input_location, OPT_Wc__17_extensions,
"%<static_assert%> without a message "
"only available with %<-std=c++17%> or %<-std=gnu++17%>");
/* Eat the ')' */
RID_INLINE);
if (nested_inline_p && nested_definition_count != 0)
{
- if (cxx_dialect < cxx20)
+ if (pedantic && cxx_dialect < cxx20)
pedwarn (cp_lexer_peek_token (parser->lexer)->location,
- OPT_Wpedantic, "nested inline namespace definitions only "
- "available with %<-std=c++20%> or %<-std=gnu++20%>");
+ OPT_Wc__20_extensions, "nested inline namespace "
+ "definitions only available with %<-std=c++20%> or "
+ "%<-std=gnu++20%>");
cp_lexer_consume_token (parser->lexer);
}
break;
}
- if (!nested_definition_count && cxx_dialect < cxx17)
- pedwarn (input_location, OPT_Wpedantic,
+ if (!nested_definition_count && pedantic && cxx_dialect < cxx17)
+ pedwarn (input_location, OPT_Wc__17_extensions,
"nested namespace definitions only available with "
"%<-std=c++17%> or %<-std=gnu++17%>");
{
cp_token *ell = cp_lexer_consume_token (parser->lexer);
if (cxx_dialect < cxx17)
- pedwarn (ell->location, 0,
+ pedwarn (ell->location, OPT_Wc__17_extensions,
"pack expansion in using-declaration only available "
"with %<-std=c++17%> or %<-std=gnu++17%>");
qscope = make_pack_expansion (qscope);
{
cp_token *comma = cp_lexer_consume_token (parser->lexer);
if (cxx_dialect < cxx17)
- pedwarn (comma->location, 0,
+ pedwarn (comma->location, OPT_Wc__17_extensions,
"comma-separated list in using-declaration only available "
"with %<-std=c++17%> or %<-std=gnu++17%>");
goto again;
functions. */
if (parser->in_function_body
&& DECL_DECLARED_CONSTEXPR_P (current_function_decl)
- && (cxx_dialect < cxx20))
- pedwarn (asm_loc, 0, "%<asm%> in %<constexpr%> function only available "
- "with %<-std=c++20%> or %<-std=gnu++20%>");
+ && cxx_dialect < cxx20)
+ pedwarn (asm_loc, OPT_Wc__20_extensions, "%<asm%> in %<constexpr%> "
+ "function only available with %<-std=c++20%> or "
+ "%<-std=gnu++20%>");
/* Handle the asm-qualifier-list. */
location_t volatile_loc = UNKNOWN_LOCATION;
&& cxx_dialect < cxx20)
{
if (DECL_CONSTRUCTOR_P (current_function_decl))
- pedwarn (input_location, 0,
+ pedwarn (input_location, OPT_Wc__20_extensions,
"function-try-block body of %<constexpr%> constructor only "
"available with %<-std=c++20%> or %<-std=gnu++20%>");
else
- pedwarn (input_location, 0,
+ pedwarn (input_location, OPT_Wc__20_extensions,
"function-try-block body of %<constexpr%> function only "
"available with %<-std=c++20%> or %<-std=gnu++20%>");
}
|| (cp_lexer_peek_nth_token (parser->lexer, 3)->type
== CPP_OPEN_BRACE)))
{
- if (cxx_dialect < cxx20)
- pedwarn (loc, OPT_Wpedantic,
+ if (pedantic && cxx_dialect < cxx20)
+ pedwarn (loc, OPT_Wc__20_extensions,
"C++ designated initializers only available with "
"%<-std=c++20%> or %<-std=gnu++20%>");
/* Consume the `.'. */
if ((tag_type = cp_parser_token_is_type_parameter_key (token)) != none_type)
{
cp_lexer_consume_token (parser->lexer);
- if (pedantic && tag_type == typename_type && cxx_dialect < cxx17)
+ if (pedantic && tag_type == typename_type
+ && cxx_dialect < cxx17)
/* typename is not allowed in a template template parameter
by the standard until C++17. */
- pedwarn (token->location, OPT_Wpedantic,
+ pedwarn (token->location, OPT_Wc__17_extensions,
"ISO C++ forbids typename key in template template parameter;"
" use %<-std=c++17%> or %<-std=gnu++17%>");
}
= cp_lexer_peek_token (parser->lexer)->location;
if (cxx_dialect < cxx20
&& identifier != NULL_TREE)
- pedwarn (loc, 0,
+ pedwarn (loc, OPT_Wc__20_extensions,
"default member initializers for bit-fields "
"only available with %<-std=c++20%> or "
"%<-std=gnu++20%>");
if (parser->in_function_body
&& DECL_DECLARED_CONSTEXPR_P (current_function_decl)
&& cxx_dialect < cxx20)
- pedwarn (input_location, 0,
+ pedwarn (input_location, OPT_Wc__20_extensions,
"%<try%> in %<constexpr%> function only "
"available with %<-std=c++20%> or %<-std=gnu++20%>");
&& cp_lexer_nth_token_is (parser->lexer, 3, CPP_COLON))
{
if (cxx_dialect < cxx17)
- pedwarn (input_location, 0,
+ pedwarn (input_location, OPT_Wc__17_extensions,
"attribute using prefix only available "
"with %<-std=c++17%> or %<-std=gnu++17%>");