/* True if we're processing a pragma, and shouldn't automatically
consume CPP_PRAGMA_EOL. */
BOOL_BITFIELD in_pragma : 1;
+ /* True if we're parsing the outermost block of an if statement. */
+ BOOL_BITFIELD in_if_block : 1;
/* True if we want to lex an untranslated string. */
BOOL_BITFIELD lex_untranslated_string : 1;
/* Objective-C specific parser/lexer information. */
if (c_parser_next_token_is (parser, CPP_EOF))
{
if (pedantic)
- pedwarn ("ISO C forbids an empty source file");
+ pedwarn ("%HISO C forbids an empty source file",
+ &c_parser_peek_token (parser)->location);
}
else
{
break;
case CPP_SEMICOLON:
if (pedantic)
- pedwarn ("ISO C does not allow extra %<;%> outside of a function");
+ pedwarn ("%HISO C does not allow extra %<;%> outside of a function",
+ &c_parser_peek_token (parser)->location);
c_parser_consume_token (parser);
break;
case CPP_PRAGMA:
tree prefix_attrs;
tree all_prefix_attrs;
bool diagnosed_no_specs = false;
+ location_t here = c_parser_peek_token (parser)->location;
specs = build_null_declspecs ();
c_parser_declspecs (parser, specs, true, true, start_attr_ok);
else
{
shadow_tag_warned (specs, 1);
- pedwarn ("empty declaration");
+ pedwarn ("%Hempty declaration", &here);
}
c_parser_consume_token (parser);
return;
if (!diagnosed_no_specs && !specs->declspecs_seen_p)
{
diagnosed_no_specs = true;
- pedwarn ("data definition has no type or storage class");
+ pedwarn ("%Hdata definition has no type or storage class",
+ &here);
}
/* Having seen a data definition, there cannot now be a
function definition. */
if (nested)
{
if (pedantic)
- pedwarn ("ISO C forbids nested functions");
+ pedwarn ("%HISO C forbids nested functions", &here);
push_function_context ();
}
if (!start_function (specs, declarator, all_prefix_attrs))
struct c_typespec ret;
tree attrs;
tree ident = NULL_TREE;
+ location_t ident_loc;
gcc_assert (c_parser_next_token_is_keyword (parser, RID_ENUM));
c_parser_consume_token (parser);
attrs = c_parser_attributes (parser);
+ /* Set the location in case we create a decl now. */
+ c_parser_set_source_position_from_token (c_parser_peek_token (parser));
if (c_parser_next_token_is (parser, CPP_NAME))
{
ident = c_parser_peek_token (parser)->value;
+ ident_loc = c_parser_peek_token (parser)->location;
c_parser_consume_token (parser);
}
if (c_parser_next_token_is (parser, CPP_OPEN_BRACE))
tree enum_value;
tree enum_decl;
bool seen_comma;
+ c_token *token;
+ location_t comma_loc;
if (c_parser_next_token_is_not (parser, CPP_NAME))
{
c_parser_error (parser, "expected identifier");
values = error_mark_node;
break;
}
- enum_id = c_parser_peek_token (parser)->value;
+ token = c_parser_peek_token (parser);
+ enum_id = token->value;
+ /* Set the location in case we create a decl now. */
+ c_parser_set_source_position_from_token (token);
c_parser_consume_token (parser);
if (c_parser_next_token_is (parser, CPP_EQ))
{
seen_comma = false;
if (c_parser_next_token_is (parser, CPP_COMMA))
{
+ comma_loc = c_parser_peek_token (parser)->location;
seen_comma = true;
c_parser_consume_token (parser);
}
if (c_parser_next_token_is (parser, CPP_CLOSE_BRACE))
{
if (seen_comma && pedantic && !flag_isoc99)
- pedwarn ("comma at end of enumerator list");
+ pedwarn ("%Hcomma at end of enumerator list", &comma_loc);
c_parser_consume_token (parser);
break;
}
/* In ISO C, enumerated types can be referred to only if already
defined. */
if (pedantic && !COMPLETE_TYPE_P (ret.spec))
- pedwarn ("ISO C forbids forward references to %<enum%> types");
+ {
+ gcc_assert (ident);
+ pedwarn ("%HISO C forbids forward references to %<enum%> types",
+ &ident_loc);
+ }
return ret;
}
}
c_parser_consume_token (parser);
attrs = c_parser_attributes (parser);
+ /* Set the location in case we create a decl now. */
+ c_parser_set_source_position_from_token (c_parser_peek_token (parser));
if (c_parser_next_token_is (parser, CPP_NAME))
{
ident = c_parser_peek_token (parser)->value;
if (c_parser_next_token_is (parser, CPP_SEMICOLON))
{
if (pedantic)
- pedwarn ("extra semicolon in struct or union specified");
+ pedwarn ("%Hextra semicolon in struct or union specified",
+ &c_parser_peek_token (parser)->location);
c_parser_consume_token (parser);
continue;
}
else
{
if (c_parser_next_token_is (parser, CPP_CLOSE_BRACE))
- pedwarn ("no semicolon at end of struct or union");
+ pedwarn ("%Hno semicolon at end of struct or union",
+ &c_parser_peek_token (parser)->location);
else
{
c_parser_error (parser, "expected %<;%>");
tree prefix_attrs;
tree all_prefix_attrs;
tree decls;
+ location_t decl_loc;
if (c_parser_next_token_is_keyword (parser, RID_EXTENSION))
{
int ext;
return decl;
}
specs = build_null_declspecs ();
+ decl_loc = c_parser_peek_token (parser)->location;
c_parser_declspecs (parser, specs, false, true, true);
if (parser->error)
return NULL_TREE;
if (!specs->type_seen_p)
{
if (pedantic)
- pedwarn ("ISO C forbids member declarations with no members");
+ pedwarn ("%HISO C forbids member declarations with no members",
+ &decl_loc);
shadow_tag_warned (specs, pedantic);
ret = NULL_TREE;
}
else
{
bool was_vm;
+ location_t here = c_parser_peek_token (parser)->location;
struct c_expr expr = c_parser_expression (parser);
skip_evaluation--;
in_typeof--;
if (TREE_CODE (expr.value) == COMPONENT_REF
&& DECL_C_BIT_FIELD (TREE_OPERAND (expr.value, 1)))
- error ("%<typeof%> applied to a bit-field");
+ error ("%H%<typeof%> applied to a bit-field", &here);
ret.spec = TREE_TYPE (expr.value);
was_vm = variably_modified_type_p (ret.spec, NULL_TREE);
/* This should be returned with the type so that when the type
star_seen);
if (declarator == NULL)
return NULL;
- inner = set_array_declarator_inner (declarator, inner, !id_present);
+ inner = set_array_declarator_inner (declarator, inner);
return c_parser_direct_declarator_inner (parser, id_present, inner);
}
else if (c_parser_next_token_is (parser, CPP_OPEN_PAREN))
ret->had_vla_unspec = 0;
/* Suppress -Wold-style-definition for this case. */
ret->types = error_mark_node;
- error ("ISO C requires a named argument before %<...%>");
+ error ("%HISO C requires a named argument before %<...%>",
+ &c_parser_peek_token (parser)->location);
c_parser_consume_token (parser);
if (c_parser_next_token_is (parser, CPP_CLOSE_PAREN))
{
}
else if (c_parser_next_token_is (parser, CPP_WSTRING))
{
- error ("wide string literal in %<asm%>");
+ error ("%Hwide string literal in %<asm%>",
+ &c_parser_peek_token (parser)->location);
str = build_string (1, "");
c_parser_consume_token (parser);
}
static struct c_expr
c_parser_braced_init (c_parser *parser, tree type, bool nested_p)
{
+ location_t brace_loc = c_parser_peek_token (parser)->location;
gcc_assert (c_parser_next_token_is (parser, CPP_OPEN_BRACE));
c_parser_consume_token (parser);
if (nested_p)
if (c_parser_next_token_is (parser, CPP_CLOSE_BRACE))
{
if (pedantic)
- pedwarn ("ISO C forbids empty initializer braces");
+ pedwarn ("%HISO C forbids empty initializer braces", &brace_loc);
}
else
{
/* Old-style structure member designator. */
set_init_label (c_parser_peek_token (parser)->value);
if (pedantic)
- pedwarn ("obsolete use of designated initializer with %<:%>");
+ {
+ /* Use the colon as the error location. */
+ pedwarn ("%Hobsolete use of designated initializer with %<:%>",
+ &c_parser_peek_2nd_token (parser)->location);
+ }
c_parser_consume_token (parser);
c_parser_consume_token (parser);
}
/* des_seen is 0 if there have been no designators, 1 if there
has been a single array designator and 2 otherwise. */
int des_seen = 0;
+ /* Location of a designator. */
+ location_t des_loc;
while (c_parser_next_token_is (parser, CPP_OPEN_SQUARE)
|| c_parser_next_token_is (parser, CPP_DOT))
{
int des_prev = des_seen;
+ if (!des_seen)
+ des_loc = c_parser_peek_token (parser)->location;
if (des_seen < 2)
des_seen++;
if (c_parser_next_token_is (parser, CPP_DOT))
else
{
tree first, second;
+ location_t ellipsis_loc;
/* ??? Following the old parser, [ objc-receiver
objc-message-args ] is accepted as an initializer,
being distinguished from a designator by what follows
array_desig_after_first:
if (c_parser_next_token_is (parser, CPP_ELLIPSIS))
{
+ ellipsis_loc = c_parser_peek_token (parser)->location;
c_parser_consume_token (parser);
second = c_parser_expr_no_commas (parser, NULL).value;
}
c_parser_consume_token (parser);
set_init_index (first, second);
if (pedantic && second)
- pedwarn ("ISO C forbids specifying range of "
- "elements to initialize");
+ pedwarn ("%HISO C forbids specifying range of "
+ "elements to initialize", &ellipsis_loc);
}
else
c_parser_skip_until_found (parser, CPP_CLOSE_SQUARE,
if (c_parser_next_token_is (parser, CPP_EQ))
{
if (pedantic && !flag_isoc99)
- pedwarn ("ISO C90 forbids specifying subobject to initialize");
+ pedwarn ("%HISO C90 forbids specifying subobject "
+ "to initialize", &des_loc);
c_parser_consume_token (parser);
}
else
if (des_seen == 1)
{
if (pedantic)
- pedwarn ("obsolete use of designated initializer "
- "without %<=%>");
+ pedwarn ("%Hobsolete use of designated initializer "
+ "without %<=%>",
+ &c_parser_peek_token (parser)->location);
}
else
{
{
bool last_stmt = false;
bool last_label = false;
+ location_t label_loc;
if (c_parser_next_token_is (parser, CPP_CLOSE_BRACE))
{
c_parser_consume_token (parser);
}
if (c_parser_next_token_is_keyword (parser, RID_LABEL))
{
+ location_t err_loc = c_parser_peek_token (parser)->location;
/* Read zero or more forward-declarations for labels that nested
functions can jump to. */
while (c_parser_next_token_is_keyword (parser, RID_LABEL))
}
c_parser_skip_until_found (parser, CPP_SEMICOLON, "expected %<;%>");
}
- /* ??? Locating this diagnostic on the token after the
- declarations end follows the old parser, but it might be
- better to locate it where the declarations start instead. */
if (pedantic)
- pedwarn ("ISO C forbids label declarations");
+ pedwarn ("%HISO C forbids label declarations", &err_loc);
}
/* We must now have at least one statement, label or declaration. */
if (c_parser_next_token_is (parser, CPP_CLOSE_BRACE))
|| (c_parser_next_token_is (parser, CPP_NAME)
&& c_parser_peek_2nd_token (parser)->type == CPP_COLON))
{
+ if (c_parser_next_token_is_keyword (parser, RID_CASE))
+ label_loc = c_parser_peek_2nd_token (parser)->location;
+ else
+ label_loc = c_parser_peek_token (parser)->location;
last_label = true;
last_stmt = false;
c_parser_label (parser);
c_parser_error (parser, "expected declaration or statement");
return;
}
+ else if (c_parser_next_token_is_keyword (parser, RID_ELSE))
+ {
+ if (parser->in_if_block)
+ {
+ error ("%H""expected %<}%> before %<else%>", &loc);
+ return;
+ }
+ else
+ {
+ error ("%H%<else%> without a previous %<if%>", &loc);
+ c_parser_consume_token (parser);
+ continue;
+ }
+ }
else
{
statement:
parser->error = false;
}
if (last_label)
- error ("label at end of compound statement");
+ error ("%Hlabel at end of compound statement", &label_loc);
c_parser_consume_token (parser);
}
{
tree name = c_parser_peek_token (parser)->value;
tree tlab;
- location_t loc2;
tree attrs;
+ location_t loc2 = c_parser_peek_token (parser)->location;
gcc_assert (c_parser_next_token_is (parser, CPP_NAME));
c_parser_consume_token (parser);
gcc_assert (c_parser_next_token_is (parser, CPP_COLON));
- loc2 = c_parser_peek_token (parser)->location;
c_parser_consume_token (parser);
attrs = c_parser_attributes (parser);
tlab = define_label (loc2, name);
}
}
if (label)
- SET_EXPR_LOCATION (label, loc1);
+ {
+ SET_EXPR_LOCATION (label, loc1);
+ if (c_parser_next_token_starts_declspecs (parser)
+ && !(c_parser_next_token_is (parser, CPP_NAME)
+ && c_parser_peek_2nd_token (parser)->type == CPP_COLON))
+ {
+ error ("%Ha label can only be part of a statement and "
+ "a declaration is not a statement",
+ &c_parser_peek_token (parser)->location);
+ c_parser_declaration_or_fndef (parser, /*fndef_ok*/ false,
+ /*nested*/ true, /*empty_ok*/ false,
+ /*start_attr_ok*/ true);
+ }
+ }
}
/* Parse a statement (C90 6.6, C99 6.8).
{
location_t loc = c_parser_peek_token (parser)->location;
tree stmt = NULL_TREE;
+ bool in_if_block = parser->in_if_block;
+ parser->in_if_block = false;
switch (c_parser_peek_token (parser)->type)
{
case CPP_OPEN_BRACE:
earlier? */
if (stmt && CAN_HAVE_LOCATION_P (stmt))
SET_EXPR_LOCATION (stmt, loc);
+
+ parser->in_if_block = in_if_block;
}
/* Parse a parenthesized condition from an if, do or while statement.
return c_end_compound_stmt (block, flag_isoc99);
}
-/* Parse the body of an if statement or the else half thereof. This
- is just parsing a statement but (a) it is a block in C99, (b) we
- track whether the body is an if statement for the sake of
- -Wparentheses warnings, (c) we handle an empty body specially for
- the sake of -Wempty-body warnings. */
+/* Parse the body of an if statement. This is just parsing a
+ statement but (a) it is a block in C99, (b) we track whether the
+ body is an if statement for the sake of -Wparentheses warnings, (c)
+ we handle an empty body specially for the sake of -Wempty-body
+ warnings, and (d) we call parser_compound_statement directly
+ because c_parser_statement_after_labels resets
+ parser->in_if_block. */
static tree
c_parser_if_body (c_parser *parser, bool *if_p)
c_parser_label (parser);
*if_p = c_parser_next_token_is_keyword (parser, RID_IF);
if (c_parser_next_token_is (parser, CPP_SEMICOLON))
- add_stmt (build_empty_stmt ());
- c_parser_statement_after_labels (parser);
+ {
+ add_stmt (build_empty_stmt ());
+ c_parser_consume_token (parser);
+ }
+ else if (c_parser_next_token_is (parser, CPP_OPEN_BRACE))
+ add_stmt (c_parser_compound_statement (parser));
+ else
+ c_parser_statement_after_labels (parser);
+ return c_end_compound_stmt (block, flag_isoc99);
+}
+
+/* Parse the else body of an if statement. This is just parsing a
+ statement but (a) it is a block in C99, (b) we handle an empty body
+ specially for the sake of -Wempty-body warnings. */
+
+static tree
+c_parser_else_body (c_parser *parser)
+{
+ tree block = c_begin_compound_stmt (flag_isoc99);
+ while (c_parser_next_token_is_keyword (parser, RID_CASE)
+ || c_parser_next_token_is_keyword (parser, RID_DEFAULT)
+ || (c_parser_next_token_is (parser, CPP_NAME)
+ && c_parser_peek_2nd_token (parser)->type == CPP_COLON))
+ c_parser_label (parser);
+ if (c_parser_next_token_is (parser, CPP_SEMICOLON))
+ {
+ add_stmt (build_empty_stmt ());
+ c_parser_consume_token (parser);
+ }
+ else
+ c_parser_statement_after_labels (parser);
return c_end_compound_stmt (block, flag_isoc99);
}
tree block;
location_t loc;
tree cond;
- bool first_if = false, second_if = false;
+ bool first_if = false;
tree first_body, second_body;
+ bool in_if_block;
+
gcc_assert (c_parser_next_token_is_keyword (parser, RID_IF));
c_parser_consume_token (parser);
block = c_begin_compound_stmt (flag_isoc99);
loc = c_parser_peek_token (parser)->location;
cond = c_parser_paren_condition (parser);
+ in_if_block = parser->in_if_block;
+ parser->in_if_block = true;
first_body = c_parser_if_body (parser, &first_if);
+ parser->in_if_block = in_if_block;
if (c_parser_next_token_is_keyword (parser, RID_ELSE))
{
c_parser_consume_token (parser);
- second_body = c_parser_if_body (parser, &second_if);
+ second_body = c_parser_else_body (parser);
}
else
second_body = NULL_TREE;
c_parser_consume_token (parser);
if (c_parser_next_token_is (parser, CPP_SEMICOLON))
warning (OPT_Wempty_body,
- "suggest braces around empty body in %<do%> statement");
+ "%Hsuggest braces around empty body in %<do%> statement",
+ &c_parser_peek_token (parser)->location);
block = c_begin_compound_stmt (flag_isoc99);
loc = c_parser_peek_token (parser)->location;
save_break = c_break_label;
else if (c_parser_next_token_is_keyword (parser, RID_CONST)
|| c_parser_next_token_is_keyword (parser, RID_RESTRICT))
{
- warning (0, "%E qualifier ignored on asm",
+ warning (0, "%H%E qualifier ignored on asm",
+ &c_parser_peek_token (parser)->location,
c_parser_peek_token (parser)->value);
quals = NULL_TREE;
c_parser_consume_token (parser);
if (c_parser_next_token_is (parser, CPP_COLON))
{
if (pedantic)
- pedwarn ("ISO C forbids omitting the middle term of a ?: expression");
+ pedwarn ("%HISO C forbids omitting the middle term of a ?: expression",
+ &c_parser_peek_token (parser)->location);
/* Make sure first operand is calculated only once. */
exp1.value = save_expr (default_conversion (cond.value));
cond.value = c_objc_common_truthvalue_conversion (exp1.value);
ret.original_code = ERROR_MARK;
return ret;
case CPP_PLUS:
- c_parser_consume_token (parser);
if (!c_dialect_objc () && !in_system_header)
warning (OPT_Wtraditional,
- "traditional C rejects the unary plus operator");
+ "%Htraditional C rejects the unary plus operator",
+ &c_parser_peek_token (parser)->location);
+ c_parser_consume_token (parser);
op = c_parser_cast_expression (parser, NULL);
op = default_function_array_conversion (op);
return parser_build_unary_op (CONVERT_EXPR, op);
c_parser_sizeof_expression (c_parser *parser)
{
struct c_expr expr;
+ location_t expr_loc;
gcc_assert (c_parser_next_token_is_keyword (parser, RID_SIZEOF));
c_parser_consume_token (parser);
skip_evaluation++;
starting with a compound literal. */
struct c_type_name *type_name;
c_parser_consume_token (parser);
+ expr_loc = c_parser_peek_token (parser)->location;
type_name = c_parser_type_name (parser);
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>");
if (type_name == NULL)
&& type_name->declarator->u.array.vla_unspec_p)
{
/* C99 6.7.5.2p4 */
- error ("%<[*]%> not allowed in other than a declaration");
+ error ("%H%<[*]%> not allowed in other than a declaration",
+ &expr_loc);
}
return c_expr_sizeof_type (type_name);
}
else
{
+ expr_loc = c_parser_peek_token (parser)->location;
expr = c_parser_unary_expression (parser);
sizeof_expr:
skip_evaluation--;
in_sizeof--;
if (TREE_CODE (expr.value) == COMPONENT_REF
&& DECL_C_BIT_FIELD (TREE_OPERAND (expr.value, 1)))
- error ("%<sizeof%> applied to a bit-field");
+ error ("%H%<sizeof%> applied to a bit-field", &expr_loc);
return c_expr_sizeof_expr (expr);
}
}
{
struct c_expr expr, e1, e2, e3;
struct c_type_name *t1, *t2;
+ location_t loc;
switch (c_parser_peek_token (parser)->type)
{
case CPP_NUMBER:
{
/* A statement expression. */
tree stmt;
+ location_t here = c_parser_peek_token (parser)->location;
c_parser_consume_token (parser);
c_parser_consume_token (parser);
if (cur_stmt_list == NULL)
{
- error ("braced-group within expression allowed "
- "only inside a function");
+ error ("%Hbraced-group within expression allowed "
+ "only inside a function", &here);
parser->error = true;
c_parser_skip_until_found (parser, CPP_CLOSE_BRACE, NULL);
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, NULL);
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
"expected %<)%>");
if (pedantic)
- pedwarn ("ISO C forbids braced-groups within expressions");
+ pedwarn ("%HISO C forbids braced-groups within expressions",
+ &here);
expr.value = c_finish_stmt_expr (stmt);
expr.original_code = ERROR_MARK;
}
expr.original_code = ERROR_MARK;
break;
}
+ loc = c_parser_peek_token (parser)->location;
e1 = c_parser_expr_no_commas (parser, NULL);
if (!c_parser_require (parser, CPP_COMMA, "expected %<,%>"))
{
c = fold (e1.value);
if (TREE_CODE (c) != INTEGER_CST)
- error ("first argument to %<__builtin_choose_expr%> not"
- " a constant");
+ error ("%Hfirst argument to %<__builtin_choose_expr%> not"
+ " a constant", &loc);
expr = integer_zerop (c) ? e3 : e2;
}
break;
tree type;
struct c_expr init;
struct c_expr expr;
+ location_t start_loc;
start_init (NULL_TREE, NULL, 0);
type = groktypename (type_name);
+ start_loc = c_parser_peek_token (parser)->location;
if (type != error_mark_node && C_TYPE_VARIABLE_SIZE (type))
{
- error ("compound literal has variable size");
+ error ("%Hcompound literal has variable size", &start_loc);
type = error_mark_node;
}
init = c_parser_braced_init (parser, type, false);
maybe_warn_string_init (type, init);
if (pedantic && !flag_isoc99)
- pedwarn ("ISO C90 forbids compound literals");
+ pedwarn ("%HISO C90 forbids compound literals", &start_loc);
expr.value = build_compound_literal (type, init.value);
expr.original_code = ERROR_MARK;
return c_parser_postfix_expression_after_primary (parser, expr);
if (c_parser_next_token_is (parser, CPP_SEMICOLON))
{
if (pedantic)
- pedwarn ("extra semicolon in struct or union specified");
+ pedwarn ("%Hextra semicolon in struct or union specified",
+ &c_parser_peek_token (parser)->location);
c_parser_consume_token (parser);
continue;
}
{
c_parser_consume_token (parser);
if (pedantic)
- pedwarn ("extra semicolon in method definition specified");
+ pedwarn ("%Hextra semicolon in method definition specified",
+ &c_parser_peek_token (parser)->location);
}
if (!c_parser_next_token_is (parser, CPP_OPEN_BRACE))
{
{
case CPP_SEMICOLON:
if (pedantic)
- pedwarn ("ISO C does not allow extra %<;%> outside of a function");
+ pedwarn ("%HISO C does not allow extra %<;%> "
+ "outside of a function",
+ &c_parser_peek_token (parser)->location);
c_parser_consume_token (parser);
break;
case CPP_PLUS:
return false;
case PRAGMA_OMP_SECTION:
- error ("%<#pragma omp section%> may only be used in "
- "%<#pragma omp sections%> construct");
+ error ("%H%<#pragma omp section%> may only be used in "
+ "%<#pragma omp sections%> construct",
+ &c_parser_peek_token (parser)->location);
c_parser_skip_until_found (parser, CPP_PRAGMA_EOL, NULL);
return false;
{
if (c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
{
+ location_t expr_loc = c_parser_peek_token (parser)->location;
tree c, t = c_parser_expression (parser).value;
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>");
build_int_cst (TREE_TYPE (t), 0));
if (c == boolean_true_node)
{
- warning (0, "%<num_threads%> value must be positive");
+ warning (0, "%H%<num_threads%> value must be positive", &expr_loc);
t = integer_one_node;
}
c_parser_consume_token (parser);
if (c_parser_next_token_is (parser, CPP_COMMA))
{
+ location_t here;
c_parser_consume_token (parser);
+ here = c_parser_peek_token (parser)->location;
t = c_parser_expr_no_commas (parser, NULL).value;
if (OMP_CLAUSE_SCHEDULE_KIND (c) == OMP_CLAUSE_SCHEDULE_RUNTIME)
- error ("schedule %<runtime%> does not take "
- "a %<chunk_size%> parameter");
+ error ("%Hschedule %<runtime%> does not take "
+ "a %<chunk_size%> parameter", &here);
else if (TREE_CODE (TREE_TYPE (t)) == INTEGER_TYPE)
OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (c) = t;
else
while (c_parser_next_token_is_not (parser, CPP_PRAGMA_EOL))
{
+ location_t here = c_parser_peek_token (parser)->location;
const pragma_omp_clause c_kind = c_parser_omp_clause_name (parser);
const char *c_name;
tree prev = clauses;
/* Remove the invalid clause(s) from the list to avoid
confusing the rest of the compiler. */
clauses = prev;
- error ("%qs is not valid for %qs", c_name, where);
+ error ("%H%qs is not valid for %qs", &here, c_name, where);
}
}
}
else if (!error_suppress)
{
- error ("expected %<#pragma omp section%> or %<}%>");
+ error ("%Hexpected %<#pragma omp section%> or %<}%>",
+ &loc);
error_suppress = true;
}