Commit 8b27e9ef by Nathan Sidwell Committed by Nathan Sidwell

Kill strict_prototype.

	Kill strict_prototype. Backwards compatibility only for
	non NO_IMPLICIT_EXTERN_C systems.
	* cp-tree.h (flag_strict_prototype): Remove.
	(strict_prototype): Remove.
	(strict_prototypes_lang_c, strict_prototypes_lang_cplusplus): Remove.
	* decl.c (maybe_push_to_top_level): Adjust.
	(pop_from_top_level): Adjust.
	(decls_match): Only allow sloppy parm matching for ancient
	system headers.
	(init_decl_processing): Adjust.
	(grokdeclarator): Adjust.
	* decl2.c (flag_strict_prototype): Remove.
	(strict_prototype): Remove.
	(strict_prototypes_lang_c, strict_prototypes_lang_cplusplus): Remove.
	(lang_f_options): Remove "strict-prototype".
	(unsupported-options): Add "strict-prototype".
	* lex.c (do_identifier): Adjust.
	(do_scoped_id): Adjust.
	* parse.y (empty_parms): Adjust.
	* class.c (push_lang_context): Adjust.
	(pop_lang_context): Adjust.
	* typeck.c (comp_target_parms): Adjust.

From-SVN: r35254
parent 7b300d13
2000-07-25 Nathan Sidwell <nathan@codesourcery.com> 2000-07-25 Nathan Sidwell <nathan@codesourcery.com>
Kill strict_prototype. Backwards compatibility only for
non NO_IMPLICIT_EXTERN_C systems.
* cp-tree.h (flag_strict_prototype): Remove.
(strict_prototype): Remove.
(strict_prototypes_lang_c, strict_prototypes_lang_cplusplus): Remove.
* decl.c (maybe_push_to_top_level): Adjust.
(pop_from_top_level): Adjust.
(decls_match): Only allow sloppy parm matching for ancient
system headers.
(init_decl_processing): Adjust.
(grokdeclarator): Adjust.
* decl2.c (flag_strict_prototype): Remove.
(strict_prototype): Remove.
(strict_prototypes_lang_c, strict_prototypes_lang_cplusplus): Remove.
(lang_f_options): Remove "strict-prototype".
(unsupported-options): Add "strict-prototype".
* lex.c (do_identifier): Adjust.
(do_scoped_id): Adjust.
* parse.y (empty_parms): Adjust.
* class.c (push_lang_context): Adjust.
(pop_lang_context): Adjust.
* typeck.c (comp_target_parms): Adjust.
2000-07-25 Nathan Sidwell <nathan@codesourcery.com>
* decl.c (poplevel): Deal with anonymous variables at for scope. * decl.c (poplevel): Deal with anonymous variables at for scope.
(maybe_inject_for_scope_var): Likewise. (maybe_inject_for_scope_var): Likewise.
......
...@@ -5690,12 +5690,10 @@ push_lang_context (name) ...@@ -5690,12 +5690,10 @@ push_lang_context (name)
if (name == lang_name_cplusplus) if (name == lang_name_cplusplus)
{ {
strict_prototype = strict_prototypes_lang_cplusplus;
current_lang_name = name; current_lang_name = name;
} }
else if (name == lang_name_java) else if (name == lang_name_java)
{ {
strict_prototype = strict_prototypes_lang_cplusplus;
current_lang_name = name; current_lang_name = name;
/* DECL_IGNORED_P is initially set for these types, to avoid clutter. /* DECL_IGNORED_P is initially set for these types, to avoid clutter.
(See record_builtin_java_type in decl.c.) However, that causes (See record_builtin_java_type in decl.c.) However, that causes
...@@ -5712,7 +5710,6 @@ push_lang_context (name) ...@@ -5712,7 +5710,6 @@ push_lang_context (name)
} }
else if (name == lang_name_c) else if (name == lang_name_c)
{ {
strict_prototype = strict_prototypes_lang_c;
current_lang_name = name; current_lang_name = name;
} }
else else
...@@ -5728,11 +5725,6 @@ pop_lang_context () ...@@ -5728,11 +5725,6 @@ pop_lang_context ()
to it. */ to it. */
*current_lang_stack = NULL_TREE; *current_lang_stack = NULL_TREE;
current_lang_name = *--current_lang_stack; current_lang_name = *--current_lang_stack;
if (current_lang_name == lang_name_cplusplus
|| current_lang_name == lang_name_java)
strict_prototype = strict_prototypes_lang_cplusplus;
else if (current_lang_name == lang_name_c)
strict_prototype = strict_prototypes_lang_c;
} }
/* Type instantiation routines. */ /* Type instantiation routines. */
......
...@@ -1181,10 +1181,6 @@ extern int flag_use_repository; ...@@ -1181,10 +1181,6 @@ extern int flag_use_repository;
required. */ required. */
extern int flag_optional_diags; extern int flag_optional_diags;
/* Nonzero means do not consider empty argument prototype to mean function
takes no arguments. */
extern int flag_strict_prototype;
/* Nonzero means output .vtable_{entry,inherit} for use in doing vtable gc. */ /* Nonzero means output .vtable_{entry,inherit} for use in doing vtable gc. */
extern int flag_vtable_gc; extern int flag_vtable_gc;
...@@ -3212,11 +3208,6 @@ typedef enum special_function_kind { ...@@ -3212,11 +3208,6 @@ typedef enum special_function_kind {
sfk_conversion /* A conversion operator. */ sfk_conversion /* A conversion operator. */
} special_function_kind; } special_function_kind;
/* Zero means prototype weakly, as in ANSI C (no args means nothing).
Each language context defines how this variable should be set. */
extern int strict_prototype;
extern int strict_prototypes_lang_c, strict_prototypes_lang_cplusplus;
/* Non-zero means that if a label exists, and no other identifier /* Non-zero means that if a label exists, and no other identifier
applies, use the value of the label. */ applies, use the value of the label. */
extern int flag_labels_ok; extern int flag_labels_ok;
......
...@@ -2588,7 +2588,6 @@ maybe_push_to_top_level (pseudo) ...@@ -2588,7 +2588,6 @@ maybe_push_to_top_level (pseudo)
VARRAY_TREE_INIT (current_lang_base, 10, "current_lang_base"); VARRAY_TREE_INIT (current_lang_base, 10, "current_lang_base");
current_lang_stack = &VARRAY_TREE (current_lang_base, 0); current_lang_stack = &VARRAY_TREE (current_lang_base, 0);
current_lang_name = lang_name_cplusplus; current_lang_name = lang_name_cplusplus;
strict_prototype = strict_prototypes_lang_cplusplus;
current_namespace = global_namespace; current_namespace = global_namespace;
} }
...@@ -2622,11 +2621,6 @@ pop_from_top_level () ...@@ -2622,11 +2621,6 @@ pop_from_top_level ()
} }
} }
if (current_lang_name == lang_name_cplusplus)
strict_prototype = strict_prototypes_lang_cplusplus;
else if (current_lang_name == lang_name_c)
strict_prototype = strict_prototypes_lang_c;
/* If we were in the middle of compiling a function, restore our /* If we were in the middle of compiling a function, restore our
state. */ state. */
if (s->need_pop_function_context) if (s->need_pop_function_context)
...@@ -3021,22 +3015,31 @@ decls_match (newdecl, olddecl) ...@@ -3021,22 +3015,31 @@ decls_match (newdecl, olddecl)
if (same_type_p (TREE_TYPE (f1), TREE_TYPE (f2))) if (same_type_p (TREE_TYPE (f1), TREE_TYPE (f2)))
{ {
if ((! strict_prototypes_lang_c || DECL_BUILT_IN (olddecl)) if (p2 == NULL_TREE && DECL_EXTERN_C_P (olddecl)
&& DECL_EXTERN_C_P (olddecl) && (DECL_BUILT_IN (olddecl)
&& p2 == NULL_TREE) #ifndef NO_IMPLICIT_EXTERN_C
|| (DECL_IN_SYSTEM_HEADER (newdecl) && !DECL_CLASS_SCOPE_P (newdecl))
|| (DECL_IN_SYSTEM_HEADER (olddecl) && !DECL_CLASS_SCOPE_P (olddecl))
#endif
))
{ {
types_match = self_promoting_args_p (p1); types_match = self_promoting_args_p (p1);
if (p1 == void_list_node) if (p1 == void_list_node)
TREE_TYPE (newdecl) = TREE_TYPE (olddecl); TREE_TYPE (newdecl) = TREE_TYPE (olddecl);
} }
else if (!strict_prototypes_lang_c #ifndef NO_IMPLICIT_EXTERN_C
&& DECL_EXTERN_C_P (olddecl) else if (p1 == NULL_TREE
&& DECL_EXTERN_C_P (newdecl) && (DECL_EXTERN_C_P (olddecl)
&& p1 == NULL_TREE) && 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); types_match = self_promoting_args_p (p2);
TREE_TYPE (newdecl) = TREE_TYPE (olddecl); TREE_TYPE (newdecl) = TREE_TYPE (olddecl);
} }
#endif
else else
types_match = compparms (p1, p2); types_match = compparms (p1, p2);
} }
...@@ -6287,15 +6290,11 @@ init_decl_processing () ...@@ -6287,15 +6290,11 @@ init_decl_processing ()
current_lang_name = NULL_TREE; current_lang_name = NULL_TREE;
/* Adjust various flags based on command-line settings. */ /* Adjust various flags based on command-line settings. */
if (flag_strict_prototype == 2)
flag_strict_prototype = pedantic;
if (! flag_permissive && ! pedantic) if (! flag_permissive && ! pedantic)
flag_pedantic_errors = 1; flag_pedantic_errors = 1;
if (!flag_no_inline) if (!flag_no_inline)
flag_inline_trees = 1; flag_inline_trees = 1;
strict_prototypes_lang_c = flag_strict_prototype;
/* Initially, C. */ /* Initially, C. */
current_lang_name = lang_name_c; current_lang_name = lang_name_c;
...@@ -7986,7 +7985,7 @@ destroy_local_var (decl) ...@@ -7986,7 +7985,7 @@ destroy_local_var (decl)
If the length of an array type is not known before, If the length of an array type is not known before,
it must be determined now, from the initial value, or it is an error. it must be determined now, from the initial value, or it is an error.
INIT0 holds the value of an initializer that should be allowed to escape INIT holds the value of an initializer that should be allowed to escape
the normal rules. the normal rules.
FLAGS is LOOKUP_ONLYCONVERTING if the = init syntax was used, else 0 FLAGS is LOOKUP_ONLYCONVERTING if the = init syntax was used, else 0
...@@ -10678,10 +10677,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) ...@@ -10678,10 +10677,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (TREE_CODE (declarator) == BIT_NOT_EXPR) if (TREE_CODE (declarator) == BIT_NOT_EXPR)
declarator = TREE_OPERAND (declarator, 0); declarator = TREE_OPERAND (declarator, 0);
if (strict_prototype == 0 && arg_types == NULL_TREE) if (arg_types != void_list_node)
arg_types = void_list_node;
else if (arg_types == NULL_TREE
|| arg_types != void_list_node)
{ {
cp_error ("destructors may not have parameters"); cp_error ("destructors may not have parameters");
arg_types = void_list_node; arg_types = void_list_node;
......
...@@ -360,13 +360,6 @@ int warn_deprecated = 1; ...@@ -360,13 +360,6 @@ int warn_deprecated = 1;
#endif #endif
int dollars_in_ident = DOLLARS_IN_IDENTIFIERS; int dollars_in_ident = DOLLARS_IN_IDENTIFIERS;
/* Nonzero for -fno-strict-prototype switch: do not consider empty
argument prototype to mean function takes no arguments. */
int flag_strict_prototype = 2;
int strict_prototype = 1;
int strict_prototypes_lang_c, strict_prototypes_lang_cplusplus = 1;
/* Nonzero means that labels can be used as first-class objects */ /* Nonzero means that labels can be used as first-class objects */
int flag_labels_ok; int flag_labels_ok;
...@@ -554,7 +547,6 @@ lang_f_options[] = ...@@ -554,7 +547,6 @@ lang_f_options[] =
{"rtti", &flag_rtti, 1}, {"rtti", &flag_rtti, 1},
{"squangle", &flag_do_squangling, 1}, {"squangle", &flag_do_squangling, 1},
{"stats", &flag_detailed_statistics, 1}, {"stats", &flag_detailed_statistics, 1},
{"strict-prototype", &flag_strict_prototype, 1},
{"use-cxa-atexit", &flag_use_cxa_atexit, 1}, {"use-cxa-atexit", &flag_use_cxa_atexit, 1},
{"vtable-gc", &flag_vtable_gc, 1}, {"vtable-gc", &flag_vtable_gc, 1},
{"vtable-thunks", &flag_vtable_thunks, 1}, {"vtable-thunks", &flag_vtable_thunks, 1},
...@@ -571,6 +563,7 @@ static const char * const unsupported_options[] = { ...@@ -571,6 +563,7 @@ static const char * const unsupported_options[] = {
"guiding-decls", "guiding-decls",
"nonnull-objects", "nonnull-objects",
"this-is-variable", "this-is-variable",
"strict-prototype",
}; };
/* Compare two option strings, pointed two by P1 and P2, for use with /* Compare two option strings, pointed two by P1 and P2, for use with
......
...@@ -3114,19 +3114,6 @@ do_identifier (token, parsing, args) ...@@ -3114,19 +3114,6 @@ do_identifier (token, parsing, args)
cp_error ("`%D' not defined", token); cp_error ("`%D' not defined", token);
id = error_mark_node; id = error_mark_node;
} }
else if (in_call && ! flag_strict_prototype)
{
if (!id)
id = implicitly_declare (token);
else
{
/* Implicit declaration of built-in function. Don't
change the built-in declaration, but don't let this
go by silently, either. */
cp_pedwarn ("implicit declaration of function `%D'", token);
DECL_ANTICIPATED (id) = 0; /* only issue this warning once */
}
}
else if (current_function_decl == 0) else if (current_function_decl == 0)
{ {
cp_error ("`%D' was not declared in this scope", token); cp_error ("`%D' was not declared in this scope", token);
...@@ -3256,17 +3243,11 @@ do_scoped_id (token, parsing) ...@@ -3256,17 +3243,11 @@ do_scoped_id (token, parsing)
LOOKUP_EXPR_GLOBAL (id) = 1; LOOKUP_EXPR_GLOBAL (id) = 1;
return id; return id;
} }
if (parsing && (yychar == '(' || yychar == LEFT_RIGHT) if (IDENTIFIER_NAMESPACE_VALUE (token) != error_mark_node)
&& ! flag_strict_prototype) cp_error ("`::%D' undeclared (first use here)", token);
id = implicitly_declare (token); id = error_mark_node;
else /* Prevent repeated error messages. */
{ SET_IDENTIFIER_NAMESPACE_VALUE (token, error_mark_node);
if (IDENTIFIER_NAMESPACE_VALUE (token) != error_mark_node)
cp_error ("`::%D' undeclared (first use here)", token);
id = error_mark_node;
/* Prevent repeated error messages. */
SET_IDENTIFIER_NAMESPACE_VALUE (token, error_mark_node);
}
} }
else else
{ {
......
...@@ -101,11 +101,12 @@ empty_parms () ...@@ -101,11 +101,12 @@ empty_parms ()
{ {
tree parms; tree parms;
if (strict_prototype #ifndef NO_IMPLICIT_EXTERN_C
|| current_class_type != NULL) if (in_system_header && current_class_type == NULL)
parms = void_list_node;
else
parms = NULL_TREE; parms = NULL_TREE;
else
#endif
parms = void_list_node;
return parms; return parms;
} }
......
...@@ -1484,13 +1484,8 @@ comp_target_parms (parms1, parms2) ...@@ -1484,13 +1484,8 @@ comp_target_parms (parms1, parms2)
if (t1 == 0 && t2 != 0) if (t1 == 0 && t2 != 0)
{ {
if (! flag_strict_prototype && t2 == void_list_node) cp_pedwarn ("ISO C++ prohibits conversion from `%#T' to `(...)'",
/* t1 might be the arglist of a function pointer in extern "C" parms2);
declared to take (), which we fudged to (...). Don't make the
user pay for our mistake. */;
else
cp_pedwarn ("ISO C++ prohibits conversion from `%#T' to `(...)'",
parms2);
return self_promoting_args_p (t2); return self_promoting_args_p (t2);
} }
if (t2 == 0) if (t2 == 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment