+2019-10-17 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * decl.c (grokfndecl): Remove redundant use of in_system_header_at.
+ (compute_array_index_type_loc): Likewise.
+ (grokdeclarator): Likewise.
+ * error.c (cp_printer): Likewise.
+ * lambda.c (add_default_capture): Likewise.
+ * parser.c (cp_parser_primary_expression): Likewise.
+ (cp_parser_selection_statement): Likewise.
+ (cp_parser_toplevel_declaration): Likewise.
+ (cp_parser_enumerator_list): Likewise.
+ (cp_parser_using_declaration): Likewise.
+ (cp_parser_member_declaration): Likewise.
+ (cp_parser_exception_specification_opt): Likewise.
+ (cp_parser_std_attribute_spec): Likewise.
+ * pt.c (do_decl_instantiation): Likewise.
+ (do_type_instantiation): Likewise.
+ * typeck.c (cp_build_unary_op): Likewise.
+
+ * decl.c (check_tag_decl): Pass to in_system_header_at the same
+ location used for the permerror.
+ (grokdeclarator): Likewise.
+
+ * decl.c (check_tag_decl): Use locations[ds_typedef] in error_at.
+
2019-10-17 Jason Merrill <jason@redhat.com>
* cp-gimplify.c (cp_gimplify_expr): Use get_initialized_tmp_var.
"multiple types in one declaration");
else if (declspecs->redefined_builtin_type)
{
- if (!in_system_header_at (input_location))
- permerror (declspecs->locations[ds_redefined_builtin_type_spec],
- "redeclaration of C++ built-in type %qT",
+ location_t loc = declspecs->locations[ds_redefined_builtin_type_spec];
+ if (!in_system_header_at (loc))
+ permerror (loc, "redeclaration of C++ built-in type %qT",
declspecs->redefined_builtin_type);
return NULL_TREE;
}
--end example] */
if (saw_typedef)
{
- error ("missing type-name in typedef-declaration");
+ error_at (declspecs->locations[ds_typedef],
+ "missing type-name in typedef-declaration");
return NULL_TREE;
}
/* Anonymous unions are objects, so they can have specifiers. */;
}
/* 17.6.3.3.5 */
if (suffix[0] != '_'
- && !in_system_header_at (location)
&& !current_function_decl && !(friendp && !funcdef_flag))
warning_at (location, OPT_Wliteral_suffix,
"literal operator suffixes not preceded by %<_%>"
indicated by the state of complain), so that
another substitution can be found. */
return error_mark_node;
- else if (in_system_header_at (input_location))
- /* Allow them in system headers because glibc uses them. */;
else if (name)
pedwarn (loc, OPT_Wpedantic,
"ISO C++ forbids zero-size array %qD", name);
if (type_was_error_mark_node)
/* We've already issued an error, don't complain more. */;
- else if (in_system_header_at (input_location) || flag_ms_extensions)
+ else if (in_system_header_at (id_loc) || flag_ms_extensions)
/* Allow it, sigh. */;
else if (! is_main)
permerror (id_loc, "ISO C++ forbids declaration of %qs with no type",
}
/* Don't pedwarn if the alternate "__intN__" form has been used instead
of "__intN". */
- else if (!int_n_alt && pedantic && ! in_system_header_at (input_location))
+ else if (!int_n_alt && pedantic)
pedwarn (declspecs->locations[ds_type_spec], OPT_Wpedantic,
"ISO C++ does not support %<__int%d%> for %qs",
int_n_data[declspecs->int_n_idx].bitsize, name);
else
{
/* Array is a flexible member. */
- if (in_system_header_at (input_location))
- /* Do not warn on flexible array members in system
- headers because glibc uses them. */;
- else if (name)
+ if (name)
pedwarn (id_loc, OPT_Wpedantic,
"ISO C++ forbids flexible array member %qs", name);
else
void
maybe_warn_cpp0x (cpp0x_warn_str str)
{
- if ((cxx_dialect == cxx98) && !in_system_header_at (input_location))
- /* We really want to suppress this warning in system headers,
- because libstdc++ uses variadic templates even when we aren't
- in C++0x mode. */
+ if (cxx_dialect == cxx98)
switch (str)
{
case CPP0X_INITIALIZER_LISTS:
/* Warn about deprecated implicit capture of this via [=]. */
if (cxx_dialect >= cxx2a
&& this_capture_p
- && LAMBDA_EXPR_DEFAULT_CAPTURE_MODE (lambda) == CPLD_COPY
- && !in_system_header_at (LAMBDA_EXPR_LOCATION (lambda)))
+ && LAMBDA_EXPR_DEFAULT_CAPTURE_MODE (lambda) == CPLD_COPY)
{
if (warning_at (LAMBDA_EXPR_LOCATION (lambda), OPT_Wdeprecated,
"implicit capture of %qE via %<[=]%> is deprecated "
{
expr = cp_parser_fold_expression (parser, expr);
if (expr != error_mark_node
- && cxx_dialect < cxx17
- && !in_system_header_at (input_location))
+ && cxx_dialect < cxx17)
pedwarn (input_location, 0, "fold-expressions only available "
"with %<-std=c++17%> or %<-std=gnu++17%>");
}
{
cx = true;
cp_token *tok = cp_lexer_consume_token (parser->lexer);
- if (cxx_dialect < cxx17 && !in_system_header_at (tok->location))
+ if (cxx_dialect < cxx17)
pedwarn (tok->location, 0, "%<if constexpr%> only available "
"with %<-std=c++17%> or %<-std=gnu++17%>");
}
/* A declaration consisting of a single semicolon is
invalid. Allow it unless we're being pedantic. */
cp_lexer_consume_token (parser->lexer);
- if (!in_system_header_at (input_location))
- pedwarn (input_location, OPT_Wpedantic, "extra %<;%>");
+ pedwarn (input_location, OPT_Wpedantic, "extra %<;%>");
}
else
/* Parse the declaration itself. */
/* If the next token is a `}', there is a trailing comma. */
if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_BRACE))
{
- if (cxx_dialect < cxx11 && !in_system_header_at (input_location))
+ if (cxx_dialect < cxx11)
pedwarn (input_location, OPT_Wpedantic,
"comma at end of enumerator list");
break;
else if (cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS))
{
cp_token *ell = cp_lexer_consume_token (parser->lexer);
- if (cxx_dialect < cxx17
- && !in_system_header_at (ell->location))
+ if (cxx_dialect < cxx17)
pedwarn (ell->location, 0,
"pack expansion in using-declaration only available "
"with %<-std=c++17%> or %<-std=gnu++17%>");
location_t loc
= cp_lexer_peek_token (parser->lexer)->location;
if (cxx_dialect < cxx2a
- && !in_system_header_at (loc)
&& identifier != NULL_TREE)
pedwarn (loc, 0,
"default member initializers for bit-fields "
"specifications");
type_id_list = NULL_TREE;
}
- else if (cxx_dialect >= cxx11 && !in_system_header_at (loc))
+ else if (cxx_dialect >= cxx11)
warning_at (loc, OPT_Wdeprecated,
"dynamic exception specifications are deprecated in "
"C++11");
if (attr_ns
&& cp_lexer_nth_token_is (parser->lexer, 3, CPP_COLON))
{
- if (cxx_dialect < cxx17
- && !in_system_header_at (input_location))
+ if (cxx_dialect < cxx17)
pedwarn (input_location, 0,
"attribute using prefix only available "
"with %<-std=c++17%> or %<-std=gnu++17%>");
;
else if (storage == ridpointers[(int) RID_EXTERN])
{
- if (!in_system_header_at (input_location) && (cxx_dialect == cxx98))
+ if (cxx_dialect == cxx98)
pedwarn (input_location, OPT_Wpedantic,
"ISO C++ 1998 forbids the use of %<extern%> on explicit "
"instantiations");
if (storage != NULL_TREE)
{
- if (!in_system_header_at (input_location))
+ if (storage == ridpointers[(int) RID_EXTERN])
{
- if (storage == ridpointers[(int) RID_EXTERN])
- {
- if (cxx_dialect == cxx98)
- pedwarn (input_location, OPT_Wpedantic,
- "ISO C++ 1998 forbids the use of %<extern%> on "
- "explicit instantiations");
- }
- else
+ if (cxx_dialect == cxx98)
pedwarn (input_location, OPT_Wpedantic,
- "ISO C++ forbids the use of %qE"
- " on explicit instantiations", storage);
+ "ISO C++ 1998 forbids the use of %<extern%> on "
+ "explicit instantiations");
}
+ else
+ pedwarn (input_location, OPT_Wpedantic,
+ "ISO C++ forbids the use of %qE"
+ " on explicit instantiations", storage);
if (storage == ridpointers[(int) RID_INLINE])
nomem_p = 1;
return error_mark_node;
}
/* Otherwise, [depr.incr.bool] says this is deprecated. */
- else if (!in_system_header_at (input_location))
+ else
warning (OPT_Wdeprecated, "use of an operand of type %qT "
"in %<operator++%> is deprecated",
boolean_type_node);
+2019-10-17 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * g++.old-deja/g++.other/decl9.C: Check locations too.
+
2019-10-17 Yuliang Wang <yuliang.wang@arm.com>
* gcc.target/aarch64/sve2/eor3_1.c: New test.
// Contributed by Gabriel Dos Reis <gdr@codesourcery.com>
typedef struct { } S; // OK
-typedef struct { }; // { dg-error "" } Missing type-name
+typedef struct { }; // { dg-error "1:missing type-name" } Missing type-name
typedef union { } U; // OK
-typedef union { }; // { dg-error "" } Missing type-name
+typedef union { }; // { dg-error "1:missing type-name" } Missing type-name