diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2000-07-25 20:19:24 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2000-07-25 20:19:24 +0000 |
commit | 8b27e9efa02ba012f2dfeb04e88204f38e8517fd (patch) | |
tree | 020a802280b525bb0553d216f4ebb2c6dff1b41c | |
parent | 7b300d1385d166fbb827450f969af269270430d8 (diff) | |
download | gcc-8b27e9efa02ba012f2dfeb04e88204f38e8517fd.zip gcc-8b27e9efa02ba012f2dfeb04e88204f38e8517fd.tar.gz gcc-8b27e9efa02ba012f2dfeb04e88204f38e8517fd.tar.bz2 |
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
-rw-r--r-- | gcc/cp/ChangeLog | 25 | ||||
-rw-r--r-- | gcc/cp/class.c | 8 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 9 | ||||
-rw-r--r-- | gcc/cp/decl.c | 40 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 9 | ||||
-rw-r--r-- | gcc/cp/lex.c | 29 | ||||
-rw-r--r-- | gcc/cp/parse.y | 9 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 9 |
8 files changed, 56 insertions, 82 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a55e7d8..030cce6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,30 @@ 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. (maybe_inject_for_scope_var): Likewise. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 94da8a0..f9c2c9e 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -5690,12 +5690,10 @@ push_lang_context (name) if (name == lang_name_cplusplus) { - strict_prototype = strict_prototypes_lang_cplusplus; current_lang_name = name; } else if (name == lang_name_java) { - strict_prototype = strict_prototypes_lang_cplusplus; current_lang_name = name; /* DECL_IGNORED_P is initially set for these types, to avoid clutter. (See record_builtin_java_type in decl.c.) However, that causes @@ -5712,7 +5710,6 @@ push_lang_context (name) } else if (name == lang_name_c) { - strict_prototype = strict_prototypes_lang_c; current_lang_name = name; } else @@ -5728,11 +5725,6 @@ pop_lang_context () to it. */ *current_lang_stack = NULL_TREE; 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. */ diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 901e749..56798f1 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -1181,10 +1181,6 @@ extern int flag_use_repository; required. */ 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. */ extern int flag_vtable_gc; @@ -3212,11 +3208,6 @@ typedef enum special_function_kind { sfk_conversion /* A conversion operator. */ } 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 applies, use the value of the label. */ extern int flag_labels_ok; diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 6c77b9f..bfcc47e 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -2588,7 +2588,6 @@ maybe_push_to_top_level (pseudo) VARRAY_TREE_INIT (current_lang_base, 10, "current_lang_base"); current_lang_stack = &VARRAY_TREE (current_lang_base, 0); current_lang_name = lang_name_cplusplus; - strict_prototype = strict_prototypes_lang_cplusplus; current_namespace = global_namespace; } @@ -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 state. */ if (s->need_pop_function_context) @@ -3021,22 +3015,31 @@ decls_match (newdecl, olddecl) if (same_type_p (TREE_TYPE (f1), TREE_TYPE (f2))) { - if ((! strict_prototypes_lang_c || DECL_BUILT_IN (olddecl)) - && DECL_EXTERN_C_P (olddecl) - && p2 == NULL_TREE) + if (p2 == NULL_TREE && DECL_EXTERN_C_P (olddecl) + && (DECL_BUILT_IN (olddecl) +#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); if (p1 == void_list_node) TREE_TYPE (newdecl) = TREE_TYPE (olddecl); } - else if (!strict_prototypes_lang_c - && DECL_EXTERN_C_P (olddecl) - && DECL_EXTERN_C_P (newdecl) - && p1 == NULL_TREE) +#ifndef NO_IMPLICIT_EXTERN_C + else if (p1 == NULL_TREE + && (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); } @@ -6287,15 +6290,11 @@ init_decl_processing () current_lang_name = NULL_TREE; /* Adjust various flags based on command-line settings. */ - if (flag_strict_prototype == 2) - flag_strict_prototype = pedantic; if (! flag_permissive && ! pedantic) flag_pedantic_errors = 1; if (!flag_no_inline) flag_inline_trees = 1; - strict_prototypes_lang_c = flag_strict_prototype; - /* Initially, C. */ current_lang_name = lang_name_c; @@ -7986,7 +7985,7 @@ destroy_local_var (decl) 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. - 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. FLAGS is LOOKUP_ONLYCONVERTING if the = init syntax was used, else 0 @@ -10678,10 +10677,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) if (TREE_CODE (declarator) == BIT_NOT_EXPR) declarator = TREE_OPERAND (declarator, 0); - if (strict_prototype == 0 && arg_types == NULL_TREE) - arg_types = void_list_node; - else if (arg_types == NULL_TREE - || arg_types != void_list_node) + if (arg_types != void_list_node) { cp_error ("destructors may not have parameters"); arg_types = void_list_node; diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 64a09c0..3608051 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -360,13 +360,6 @@ int warn_deprecated = 1; #endif 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 */ int flag_labels_ok; @@ -554,7 +547,6 @@ lang_f_options[] = {"rtti", &flag_rtti, 1}, {"squangle", &flag_do_squangling, 1}, {"stats", &flag_detailed_statistics, 1}, - {"strict-prototype", &flag_strict_prototype, 1}, {"use-cxa-atexit", &flag_use_cxa_atexit, 1}, {"vtable-gc", &flag_vtable_gc, 1}, {"vtable-thunks", &flag_vtable_thunks, 1}, @@ -571,6 +563,7 @@ static const char * const unsupported_options[] = { "guiding-decls", "nonnull-objects", "this-is-variable", + "strict-prototype", }; /* Compare two option strings, pointed two by P1 and P2, for use with diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 1bf7953..b29f6d2 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -3114,19 +3114,6 @@ do_identifier (token, parsing, args) cp_error ("`%D' not defined", token); 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) { cp_error ("`%D' was not declared in this scope", token); @@ -3256,17 +3243,11 @@ do_scoped_id (token, parsing) LOOKUP_EXPR_GLOBAL (id) = 1; return id; } - if (parsing && (yychar == '(' || yychar == LEFT_RIGHT) - && ! flag_strict_prototype) - id = implicitly_declare (token); - else - { - 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); - } + 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 { diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y index fde3807..d162a45 100644 --- a/gcc/cp/parse.y +++ b/gcc/cp/parse.y @@ -101,11 +101,12 @@ empty_parms () { tree parms; - if (strict_prototype - || current_class_type != NULL) - parms = void_list_node; - else +#ifndef NO_IMPLICIT_EXTERN_C + if (in_system_header && current_class_type == NULL) parms = NULL_TREE; + else +#endif + parms = void_list_node; return parms; } diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 16a50c3..e7f8d2f 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -1484,13 +1484,8 @@ comp_target_parms (parms1, parms2) if (t1 == 0 && t2 != 0) { - if (! flag_strict_prototype && t2 == void_list_node) - /* t1 might be the arglist of a function pointer in extern "C" - 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); + cp_pedwarn ("ISO C++ prohibits conversion from `%#T' to `(...)'", + parms2); return self_promoting_args_p (t2); } if (t2 == 0) |