{
if (!LEXER_DEBUGGING_ENABLED_P)
fatal_error (input_location,
- "LEXER_DEBUGGING_ENABLED_P is not set to true");
+ "%<LEXER_DEBUGGING_ENABLED_P%> is not set to true");
lexer->debugging_p = true;
cp_lexer_debug_stream = stderr;
{
if (!LEXER_DEBUGGING_ENABLED_P)
fatal_error (input_location,
- "LEXER_DEBUGGING_ENABLED_P is not set to true");
+ "%<LEXER_DEBUGGING_ENABLED_P%> is not set to true");
lexer->debugging_p = false;
cp_lexer_debug_stream = NULL;
else if (i14)
{
inform (token->location, "add %<using namespace std::complex_literals%> "
- "(from <complex>) to enable the C++14 user-defined literal "
+ "(from %<<complex>%>) to enable the C++14 user-defined literal "
"suffixes");
if (ext)
inform (token->location, "or use %<j%> instead of %<i%> for the "
== CPP_SCOPE))
{
token = cp_lexer_consume_token (parser->lexer);
- error_at (token->location, "decltype evaluates to %qT, "
+ error_at (token->location, "%<decltype%> evaluates to %qT, "
"which is not a class or enumeration type",
token->u.tree_check_value->value);
parser->scope = error_mark_node;
&& token->type == CPP_COLON)
{
pedwarn (token->location, OPT_Wpedantic,
- "ISO C++ does not allow ?: with omitted middle operand");
+ "ISO C++ does not allow %<?:%> with omitted middle operand");
/* Implicit true clause. */
expr = NULL_TREE;
c_inhibit_evaluation_warnings +=
{
if (cxx_dialect < cxx17)
pedwarn (input_location, OPT_Wpedantic,
- "static_assert without a message "
+ "%<static_assert%> without a message "
"only available with %<-std=c++17%> or %<-std=gnu++17%>");
/* Eat the ')' */
cp_lexer_consume_token (parser->lexer);
{
/* If it's not a class-template or a template-template, it should be
a function-template. */
- gcc_assert ((DECL_FUNCTION_TEMPLATE_P (templ)
- || TREE_CODE (templ) == OVERLOAD
- || TREE_CODE (templ) == FUNCTION_DECL
- || BASELINK_P (templ)));
+ gcc_assert (OVL_P (templ) || BASELINK_P (templ));
template_id = lookup_template_function (templ, arguments);
if (TREE_CODE (template_id) == TEMPLATE_ID_EXPR)
attribs = cp_parser_attributes_opt (parser);
/* Update the symbol table. */
- if (namespace_bindings_p ())
- finish_namespace_using_directive (namespace_decl, attribs);
- else
- finish_local_using_directive (namespace_decl, attribs);
+ finish_using_directive (namespace_decl, attribs);
/* Look for the final `;'. */
cp_parser_require (parser, CPP_SEMICOLON, RT_SEMICOLON);
case RID_VOLATILE:
if (volatile_loc)
{
- error_at (loc, "duplicate asm qualifier %qT", token->u.value);
+ error_at (loc, "duplicate %<asm%> qualifier %qT",
+ token->u.value);
inform (volatile_loc, "first seen here");
}
else
{
if (!parser->in_function_body)
- warning_at (loc, 0, "asm qualifier %qT ignored outside of "
- "function body", token->u.value);
+ warning_at (loc, 0, "%<asm%> qualifier %qT ignored "
+ "outside of function body", token->u.value);
volatile_loc = loc;
}
cp_lexer_consume_token (parser->lexer);
case RID_INLINE:
if (inline_loc)
{
- error_at (loc, "duplicate asm qualifier %qT", token->u.value);
+ error_at (loc, "duplicate %<asm%> qualifier %qT",
+ token->u.value);
inform (inline_loc, "first seen here");
}
else
case RID_GOTO:
if (goto_loc)
{
- error_at (loc, "duplicate asm qualifier %qT", token->u.value);
+ error_at (loc, "duplicate %<asm%> qualifier %qT",
+ token->u.value);
inform (goto_loc, "first seen here");
}
else
case RID_CONST:
case RID_RESTRICT:
- error_at (loc, "%qT is not an asm qualifier", token->u.value);
+ error_at (loc, "%qT is not an %<asm%> qualifier", token->u.value);
cp_lexer_consume_token (parser->lexer);
continue;
if (!parser->in_function_body && (inline_p || goto_p))
{
- error_at (first_loc, "asm qualifier outside of function body");
+ error_at (first_loc, "%<asm%> qualifier outside of function body");
inline_p = goto_p = false;
}
on a function-definition. */
if (asm_specification)
error_at (asm_spec_start_token->location,
- "an asm-specification is not allowed "
+ "an %<asm%> specification is not allowed "
"on a function-definition");
if (attributes)
error_at (attributes_start_token->location,
{
if (cxx_dialect > cxx17)
error ("literal operator template %qD has invalid parameter list;"
- " Expected non-type template parameter pack <char...> "
+ " expected non-type template parameter pack %<<char...>%> "
"or single non-type parameter of class type",
decl);
else
- error ("literal operator template %qD has invalid parameter list."
- " Expected non-type template parameter pack <char...>",
+ error ("literal operator template %qD has invalid parameter list;"
+ " expected non-type template parameter pack %<<char...>%>",
decl);
}
}
error_at (loc, "reference type %qT in "
"%<#pragma omp declare reduction%>", type);
else if (TYPE_QUALS_NO_ADDR_SPACE (type))
- error_at (loc, "const, volatile or __restrict qualified type %qT in "
- "%<#pragma omp declare reduction%>", type);
+ error_at (loc, "%<const%>, %<volatile%> or %<__restrict%>-qualified "
+ "type %qT in %<#pragma omp declare reduction%>", type);
else
types.safe_push (type);
= cp_parser_oacc_all_clauses (parser, OACC_ROUTINE_CLAUSE_MASK,
"#pragma acc routine",
cp_lexer_peek_token (parser->lexer));
+ /* The clauses are in reverse order; fix that to make later diagnostic
+ emission easier. */
+ data.clauses = nreverse (data.clauses);
if (decl && is_overloaded_fn (decl)
&& (TREE_CODE (decl) != FUNCTION_DECL
parser->oacc_routine->clauses
= cp_parser_oacc_all_clauses (parser, OACC_ROUTINE_CLAUSE_MASK,
"#pragma acc routine", pragma_tok);
+ /* The clauses are in reverse order; fix that to make later diagnostic
+ emission easier. */
+ parser->oacc_routine->clauses = nreverse (parser->oacc_routine->clauses);
cp_parser_pop_lexer (parser);
/* Later, cp_finalize_oacc_routine will process the clauses, and then set
fndecl_seen. */
return;
}
- if (oacc_get_fn_attrib (fndecl))
+ int compatible
+ = oacc_verify_routine_clauses (fndecl, &parser->oacc_routine->clauses,
+ parser->oacc_routine->loc,
+ "#pragma acc routine");
+ if (compatible < 0)
{
- error_at (parser->oacc_routine->loc,
- "%<#pragma acc routine%> already applied to %qD", fndecl);
parser->oacc_routine = NULL;
return;
}
-
- if (TREE_USED (fndecl) || (!is_defn && DECL_SAVED_TREE (fndecl)))
+ if (compatible > 0)
{
- error_at (parser->oacc_routine->loc,
- TREE_USED (fndecl)
- ? G_("%<#pragma acc routine%> must be applied before use")
- : G_("%<#pragma acc routine%> must be applied before "
- "definition"));
- parser->oacc_routine = NULL;
- return;
}
+ else
+ {
+ if (TREE_USED (fndecl) || (!is_defn && DECL_SAVED_TREE (fndecl)))
+ {
+ error_at (parser->oacc_routine->loc,
+ TREE_USED (fndecl)
+ ? G_("%<#pragma acc routine%> must be applied before"
+ " use")
+ : G_("%<#pragma acc routine%> must be applied before"
+ " definition"));
+ parser->oacc_routine = NULL;
+ return;
+ }
- /* Process the routine's dimension clauses. */
- tree dims = oacc_build_routine_dims (parser->oacc_routine->clauses);
- oacc_replace_fn_attrib (fndecl, dims);
+ /* Set the routine's level of parallelism. */
+ tree dims = oacc_build_routine_dims (parser->oacc_routine->clauses);
+ oacc_replace_fn_attrib (fndecl, dims);
- /* Add an "omp declare target" attribute. */
- DECL_ATTRIBUTES (fndecl)
- = tree_cons (get_identifier ("omp declare target"),
- NULL_TREE, DECL_ATTRIBUTES (fndecl));
+ /* Add an "omp declare target" attribute. */
+ DECL_ATTRIBUTES (fndecl)
+ = tree_cons (get_identifier ("omp declare target"),
+ parser->oacc_routine->clauses,
+ DECL_ATTRIBUTES (fndecl));
+ }
/* Don't unset parser->oacc_routine here: we may still need it to
diagnose wrong usage. But, remember that we've used this "#pragma acc
else if (keyword == RID_ATOMIC_CANCEL)
{
/* cancel-and-throw is unimplemented. */
- sorry ("atomic_cancel");
+ sorry ("%<atomic_cancel%>");
noex = NULL_TREE;
}
else