aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2018-08-31 11:19:33 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2018-08-31 11:19:33 +0000
commit5020c88e539e0212beec3568fb088ab95f484022 (patch)
treec75d0f1844e0d348ab762f048d09ca137a0aaec1 /gcc
parent553bb257848e469053abe84abf8987f0bdbe315a (diff)
downloadgcc-5020c88e539e0212beec3568fb088ab95f484022.zip
gcc-5020c88e539e0212beec3568fb088ab95f484022.tar.gz
gcc-5020c88e539e0212beec3568fb088ab95f484022.tar.bz2
[C++ PATCH] Remove K&R declaration hack.
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01885.html gcc/ * doc/extend.texi (Backwards Compatibility): Remove implicit extern C leeway of () being (...). gcc/cp/ * decl.c (decls_match): Remove SYSTEM_IMPLICIT_EXTERN_C matching of return types and parms. * parser.c (cp_parser_parameter_declaration_clause): Likewise, '()' always means '(void)'. From-SVN: r264013
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/decl.c20
-rw-r--r--gcc/cp/parser.c11
-rw-r--r--gcc/doc/extend.texi6
5 files changed, 17 insertions, 32 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 05ccec3..1fbcbd5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2018-08-31 Nathan Sidwell <nathan@acm.org>
+
+ * doc/extend.texi (Backwards Compatibility): Remove implicit
+ extern C leeway of () being (...).
+
2018-08-31 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* ipa-inline.c (can_inline_edge_by_limits_p): Fix typos in comment.
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 6ecd48d..0c5a4bf 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2018-08-31 Nathan Sidwell <nathan@acm.org>
+
+ * decl.c (decls_match): Remove SYSTEM_IMPLICIT_EXTERN_C matching
+ of return types and parms.
+ * parser.c (cp_parser_parameter_declaration_clause): Likewise,
+ '()' always means '(void)'.
+
2018-08-29 Jakub Jelinek <jakub@redhat.com>
PR c++/87095
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index c6711f7..d743e6f 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -968,30 +968,12 @@ decls_match (tree newdecl, tree olddecl, bool record_versions /* = true */)
if (same_type_p (TREE_TYPE (f1), r2))
{
if (!prototype_p (f2) && DECL_EXTERN_C_P (olddecl)
- && (fndecl_built_in_p (olddecl)
-#ifdef SYSTEM_IMPLICIT_EXTERN_C
- || (DECL_IN_SYSTEM_HEADER (newdecl) && !DECL_CLASS_SCOPE_P (newdecl))
- || (DECL_IN_SYSTEM_HEADER (olddecl) && !DECL_CLASS_SCOPE_P (olddecl))
-#endif
- ))
+ && fndecl_built_in_p (olddecl))
{
types_match = self_promoting_args_p (p1);
if (p1 == void_list_node)
TREE_TYPE (newdecl) = TREE_TYPE (olddecl);
}
-#ifdef SYSTEM_IMPLICIT_EXTERN_C
- else if (!prototype_p (f1)
- && (DECL_EXTERN_C_P (olddecl)
- && DECL_IN_SYSTEM_HEADER (olddecl)
- && !DECL_CLASS_SCOPE_P (olddecl))
- && (DECL_EXTERN_C_P (newdecl)
- && DECL_IN_SYSTEM_HEADER (newdecl)
- && !DECL_CLASS_SCOPE_P (newdecl)))
- {
- types_match = self_promoting_args_p (p2);
- TREE_TYPE (newdecl) = TREE_TYPE (olddecl);
- }
-#endif
else
types_match =
compparms (p1, p2)
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 92e6b40..f5e4fa4 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -21378,16 +21378,7 @@ cp_parser_parameter_declaration_clause (cp_parser* parser)
}
else if (token->type == CPP_CLOSE_PAREN)
/* There are no parameters. */
- {
-#ifdef SYSTEM_IMPLICIT_EXTERN_C
- if (in_system_header_at (input_location)
- && current_class_type == NULL
- && current_lang_name == lang_name_c)
- return NULL_TREE;
- else
-#endif
- return void_list_node;
- }
+ return void_list_node;
/* Check for `(void)', too, which is a special case. */
else if (token->keyword == RID_VOID
&& (cp_lexer_peek_nth_token (parser->lexer, 2)->type
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index e3312aa..9c3cfdb 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -23685,9 +23685,9 @@ deprecated. @xref{Deprecated Features}.
@item Implicit C language
Old C system header files did not contain an @code{extern "C" @{@dots{}@}}
scope to set the language. On such systems, all system header files are
-implicitly scoped inside a C language scope. Also, an empty prototype
-@code{()} is treated as an unspecified number of arguments, rather
-than no arguments, as C++ demands.
+implicitly scoped inside a C language scope. Such headers must
+correctly prototype function argument types, there is no leeway for
+@code{()} to indicate an unspecified set of arguments.
@end table