diff options
author | Neil Booth <neil@daikokuya.demon.co.uk> | 2002-04-18 17:54:11 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2002-04-18 17:54:11 +0000 |
commit | 7a2289181e4c4c86c82ed0ce21b34bf985a46091 (patch) | |
tree | 2c3060e80ce73a06bb75372ce3f7e774c0ad1716 /gcc | |
parent | f18664c1527ff43689bd98c594ce67a1a5d5840a (diff) | |
download | gcc-7a2289181e4c4c86c82ed0ce21b34bf985a46091.zip gcc-7a2289181e4c4c86c82ed0ce21b34bf985a46091.tar.gz gcc-7a2289181e4c4c86c82ed0ce21b34bf985a46091.tar.bz2 |
c-lang.c (LANG_HOOKS_INCOMPLETE_TYPE_ERROR): Redefine.
* c-lang.c (LANG_HOOKS_INCOMPLETE_TYPE_ERROR): Redefine.
* c-tree.h (c_incomplete_type_error): New.
* c-typeck.c (require_complete_type, build_component_ref): Update.
(incomplete_type_error): Rename.
* langhooks-def.h (lhd_incomplete_type_error): New.
(LANG_HOOKS_INCOMPLETE_TYPE_ERROR): New.
(LANG_HOOKS_FOR_TYPES_INITIALIZER): Update.
* langhooks.c (lhd_incomplete_type_error): New.
* langhooks.h (struct lang_hooks_for_types): New hook.
* tree.c (size_in_bytes): Use new hook.
* tree.h (incomplete_type_error): Remove.
ada: * gigi.h (incomplete_type_error): Remove.
* utils.c (incomplete_type_error): Remove.
cp:
* call.c (build_new_method_call): Update.
* cp-lang.c (LANG_HOOKS_INCOMPLETE_TYPE_ERROR): Redefine.
* cp-tree.h (cxx_incomplete_type_error): New.
* decl.c (grokdeclarator, grokparms): Update.
* decl2.c (check_classfn): Update.
* pt.c (tsubst): Update.
* typeck.c (complete_type_or_else, expr_sizeof,
decay_conversion): Update.
* typeck2.c (incomplete_type_error): Rename.
(add_exception_specifier): Update.
f:
* com.c (incomplete_type_error): Remove.
java:
* typeck.c (incomplete_type_error): Remove.
objc:
* objc-lang.c (LANG_HOOKS_INCOMPLETE_TYPE_ERROR): Redefine.
From-SVN: r52480
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 16 | ||||
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/gigi.h | 4 | ||||
-rw-r--r-- | gcc/ada/utils.c | 11 | ||||
-rw-r--r-- | gcc/c-lang.c | 2 | ||||
-rw-r--r-- | gcc/c-tree.h | 1 | ||||
-rw-r--r-- | gcc/c-typeck.c | 6 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/cp/call.c | 2 | ||||
-rw-r--r-- | gcc/cp/cp-lang.c | 2 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 1 | ||||
-rw-r--r-- | gcc/cp/decl.c | 4 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 2 | ||||
-rw-r--r-- | gcc/cp/pt.c | 2 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 6 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 4 | ||||
-rw-r--r-- | gcc/f/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/f/com.c | 15 | ||||
-rw-r--r-- | gcc/java/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/java/typeck.c | 12 | ||||
-rw-r--r-- | gcc/langhooks-def.h | 5 | ||||
-rw-r--r-- | gcc/langhooks.c | 11 | ||||
-rw-r--r-- | gcc/langhooks.h | 6 | ||||
-rw-r--r-- | gcc/objc/objc-lang.c | 2 | ||||
-rw-r--r-- | gcc/tree.c | 2 | ||||
-rw-r--r-- | gcc/tree.h | 4 |
26 files changed, 85 insertions, 61 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d37b372..eeed93e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2002-04-18 Neil Booth <neil@daikokuya.demon.co.uk> + + * c-lang.c (LANG_HOOKS_INCOMPLETE_TYPE_ERROR): Redefine. + * c-tree.h (c_incomplete_type_error): New. + * c-typeck.c (require_complete_type, build_component_ref): Update. + (incomplete_type_error): Rename. + * langhooks-def.h (lhd_incomplete_type_error): New. + (LANG_HOOKS_INCOMPLETE_TYPE_ERROR): New. + (LANG_HOOKS_FOR_TYPES_INITIALIZER): Update. + * langhooks.c (lhd_incomplete_type_error): New. + * langhooks.h (struct lang_hooks_for_types): New hook. + * tree.c (size_in_bytes): Use new hook. + * tree.h (incomplete_type_error): Remove. +objc: + * objc-lang.c (LANG_HOOKS_INCOMPLETE_TYPE_ERROR): Redefine. + 2002-04-18 Zack Weinberg <zack@codesourcery.com> * config/arc/arc.md: Remove #if HOST_FLOAT_FORMAT != diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index ebea507..fbcdc53 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2002-04-18 Neil Booth <neil@daikokuya.demon.co.uk> + + * gigi.h (incomplete_type_error): Remove. + * utils.c (incomplete_type_error): Remove. + 2002-04-16 Mark Mitchell <mark@codesourcery.com> * trans.c (tree_transform): Add has_scope argument to diff --git a/gcc/ada/gigi.h b/gcc/ada/gigi.h index 4819ac9..44b5937 100644 --- a/gcc/ada/gigi.h +++ b/gcc/ada/gigi.h @@ -439,10 +439,6 @@ extern tree gnat_signed_type PARAMS ((tree)); UNSIGNEDP. */ extern tree gnat_signed_or_unsigned_type PARAMS ((int, tree)); -/* This routine is called in tree.c to print an error message for invalid use - of an incomplete type. */ -extern void incomplete_type_error PARAMS ((tree, tree)); - /* This function is called indirectly from toplev.c to handle incomplete declarations, i.e. VAR_DECL nodes whose DECL_SIZE is zero. To be precise, compile_file in toplev.c makes an indirect call through the function pointer diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c index b346487..70e2dc7 100644 --- a/gcc/ada/utils.c +++ b/gcc/ada/utils.c @@ -685,17 +685,6 @@ init_gigi_decls (long_long_float_type, exception_type) ggc_add_tree_root (gnat_raise_decls, ARRAY_SIZE (gnat_raise_decls)); } -/* This routine is called in tree.c to print an error message for invalid use - of an incomplete type. */ - -void -incomplete_type_error (dont_care_1, dont_care_2) - tree dont_care_1 ATTRIBUTE_UNUSED; - tree dont_care_2 ATTRIBUTE_UNUSED; -{ - gigi_abort (404); -} - /* This function is called indirectly from toplev.c to handle incomplete declarations, i.e. VAR_DECL nodes whose DECL_SIZE is zero. To be precise, compile_file in toplev.c makes an indirect call through the function pointer diff --git a/gcc/c-lang.c b/gcc/c-lang.c index 57d8196..741aa1d 100644 --- a/gcc/c-lang.c +++ b/gcc/c-lang.c @@ -100,6 +100,8 @@ static void c_post_options PARAMS ((void)); #define LANG_HOOKS_UNSIGNED_TYPE c_common_unsigned_type #undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE #define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE c_common_signed_or_unsigned_type +#undef LANG_HOOKS_INCOMPLETE_TYPE_ERROR +#define LANG_HOOKS_INCOMPLETE_TYPE_ERROR c_incomplete_type_error /* ### When changing hooks, consider if ObjC needs changing too!! ### */ diff --git a/gcc/c-tree.h b/gcc/c-tree.h index eef5742..3d152fb 100644 --- a/gcc/c-tree.h +++ b/gcc/c-tree.h @@ -250,6 +250,7 @@ extern int comptypes PARAMS ((tree, tree)); extern tree c_sizeof_nowarn PARAMS ((tree)); extern tree c_size_in_bytes PARAMS ((tree)); extern bool c_mark_addressable PARAMS ((tree)); +extern void c_incomplete_type_error PARAMS ((tree, tree)); extern tree build_component_ref PARAMS ((tree, tree)); extern tree build_indirect_ref PARAMS ((tree, const char *)); extern tree build_array_ref PARAMS ((tree, tree)); diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 91abd80..6b198f9 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -99,7 +99,7 @@ require_complete_type (value) if (COMPLETE_TYPE_P (type)) return value; - incomplete_type_error (value, type); + c_incomplete_type_error (value, type); return error_mark_node; } @@ -108,7 +108,7 @@ require_complete_type (value) and TYPE is the type that was invalid. */ void -incomplete_type_error (value, type) +c_incomplete_type_error (value, type) tree value; tree type; { @@ -1163,7 +1163,7 @@ build_component_ref (datum, component) { if (!COMPLETE_TYPE_P (type)) { - incomplete_type_error (NULL_TREE, type); + c_incomplete_type_error (NULL_TREE, type); return error_mark_node; } diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c5c097d..a9b6023 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,16 @@ +2002-04-18 Neil Booth <neil@daikokuya.demon.co.uk> + + * call.c (build_new_method_call): Update. + * cp-lang.c (LANG_HOOKS_INCOMPLETE_TYPE_ERROR): Redefine. + * cp-tree.h (cxx_incomplete_type_error): New. + * decl.c (grokdeclarator, grokparms): Update. + * decl2.c (check_classfn): Update. + * pt.c (tsubst): Update. + * typeck.c (complete_type_or_else, expr_sizeof, + decay_conversion): Update. + * typeck2.c (incomplete_type_error): Rename. + (add_exception_specifier): Update. + 2002-04-18 Jason Merrill <jason@redhat.com> PR c++/5658 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 12832cb..f9ca9a0 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4636,7 +4636,7 @@ build_new_method_call (instance, name, args, basetype_path, flags) if (flags & LOOKUP_SPECULATIVELY) return NULL_TREE; if (!COMPLETE_TYPE_P (basetype)) - incomplete_type_error (instance_ptr, basetype); + cxx_incomplete_type_error (instance_ptr, basetype); else error ("no matching function for call to `%T::%D(%A)%#V'", basetype, pretty_name, user_args, diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c index 0292719..1ac3122 100644 --- a/gcc/cp/cp-lang.c +++ b/gcc/cp/cp-lang.c @@ -134,6 +134,8 @@ static bool cxx_warn_unused_global_decl PARAMS ((tree)); #define LANG_HOOKS_UNSIGNED_TYPE c_common_unsigned_type #undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE #define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE c_common_signed_or_unsigned_type +#undef LANG_HOOKS_INCOMPLETE_TYPE_ERROR +#define LANG_HOOKS_INCOMPLETE_TYPE_ERROR cxx_incomplete_type_error /* Each front end provides its own hooks, for toplev.c. */ const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 1cd7d4a..41bde38 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -4373,6 +4373,7 @@ extern tree check_return_expr PARAMS ((tree)); build_binary_op(code, arg1, arg2, 1) /* in typeck2.c */ +extern void cxx_incomplete_type_error PARAMS ((tree, tree)); extern tree error_not_base_type PARAMS ((tree, tree)); extern tree binfo_or_else PARAMS ((tree, tree)); extern void readonly_error PARAMS ((tree, const char *, int)); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 04c9799..51efa35 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -11115,7 +11115,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) } else { - incomplete_type_error (NULL_TREE, ctype); + cxx_incomplete_type_error (NULL_TREE, ctype); return error_mark_node; } @@ -12136,7 +12136,7 @@ grokparms (first_parm) && !DECL_NAME (decl) && !result && !chain && !ellipsis) /* this is a parmlist of `(void)', which is ok. */ break; - incomplete_type_error (decl, type); + cxx_incomplete_type_error (decl, type); /* It's not a good idea to actually create parameters of type `void'; other parts of the compiler assume that a void type terminates the parameter list. */ diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 1b4daa1..a904c0d 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1353,7 +1353,7 @@ check_classfn (ctype, function) { methods = 0; if (!COMPLETE_TYPE_P (ctype)) - incomplete_type_error (function, ctype); + cxx_incomplete_type_error (function, ctype); else error ("no `%#D' member function declared in class `%T'", function, ctype); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 30a6ddb..aa198a6 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -6810,7 +6810,7 @@ tsubst (t, args, complain, in_decl) if (!COMPLETE_TYPE_P (ctx)) { if (complain & tf_error) - incomplete_type_error (NULL_TREE, ctx); + cxx_incomplete_type_error (NULL_TREE, ctx); return error_mark_node; } } diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 060097ab..a928135 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -171,7 +171,7 @@ complete_type_or_else (type, value) return NULL_TREE; else if (!COMPLETE_TYPE_P (type)) { - incomplete_type_error (value, type); + cxx_incomplete_type_error (value, type); return NULL_TREE; } else @@ -1566,7 +1566,7 @@ expr_sizeof (e) } else if (type_unknown_p (e)) { - incomplete_type_error (e, TREE_TYPE (e)); + cxx_incomplete_type_error (e, TREE_TYPE (e)); return c_sizeof (char_type_node); } /* It's illegal to say `sizeof (X::i)' for `i' a non-static data @@ -1648,7 +1648,7 @@ decay_conversion (exp) if (type_unknown_p (exp)) { - incomplete_type_error (exp, TREE_TYPE (exp)); + cxx_incomplete_type_error (exp, TREE_TYPE (exp)); return error_mark_node; } diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index d7ac3d7..38daa08 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -185,7 +185,7 @@ abstract_virtuals_error (decl, type) and TYPE is the type that was invalid. */ void -incomplete_type_error (value, type) +cxx_incomplete_type_error (value, type) tree value; tree type; { @@ -1326,7 +1326,7 @@ add_exception_specifier (list, spec, complain) } } else if (complain) - incomplete_type_error (NULL_TREE, core); + cxx_incomplete_type_error (NULL_TREE, core); return list; } diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index f8eedeb..ead0a58 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -1,3 +1,7 @@ +Thu Apr 18 19:10:44 2002 Neil Booth <neil@daikokuya.demon.co.uk> + + * com.c (incomplete_type_error): Remove. + Tue Apr 16 14:55:47 2002 Mark Mitchell <mark@codesourcery.com> * com.c (ffecom_expr_power_integer): Add has_scope argument to diff --git a/gcc/f/com.c b/gcc/f/com.c index d025785..c100c2a 100644 --- a/gcc/f/com.c +++ b/gcc/f/com.c @@ -14077,21 +14077,6 @@ global_bindings_p () return current_binding_level == global_binding_level; } -/* Print an error message for invalid use of an incomplete type. - VALUE is the expression that was used (or 0 if that isn't known) - and TYPE is the type that was invalid. */ - -void -incomplete_type_error (value, type) - tree value UNUSED; - tree type; -{ - if (TREE_CODE (type) == ERROR_MARK) - return; - - assert ("incomplete type?!?" == NULL); -} - /* Mark ARG for GC. */ static void mark_binding_level (void *arg) diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index db10f95..48884bb 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,7 @@ +2002-04-18 Neil Booth <neil@daikokuya.demon.co.uk> + + * typeck.c (incomplete_type_error): Remove. + 2002-04-18 Bryce McKinlay <bryce@waitaki.otago.ac.nz> * class.c (make_class_data): Set DECL_ALIGN on static class data, diff --git a/gcc/java/typeck.c b/gcc/java/typeck.c index 108f3fb..f452543 100644 --- a/gcc/java/typeck.c +++ b/gcc/java/typeck.c @@ -166,18 +166,6 @@ convert_to_boolean (type, expr) return build1 (NOP_EXPR, type, expr); } -/* Print an error message for invalid use of an incomplete type. - VALUE is the expression that was used (or 0 if that isn't known) - and TYPE is the type that was invalid. */ - -void -incomplete_type_error (value, type) - tree value ATTRIBUTE_UNUSED; - tree type ATTRIBUTE_UNUSED; -{ - error ("internal error - use of undefined type"); -} - /* Return a data type that has machine mode MODE. If the mode is an integer, then UNSIGNEDP selects between signed and unsigned types. */ diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h index 3ad37f8..0f08524 100644 --- a/gcc/langhooks-def.h +++ b/gcc/langhooks-def.h @@ -57,6 +57,7 @@ extern void lhd_print_error_function PARAMS ((struct diagnostic_context *, const char *)); extern void lhd_set_decl_assembler_name PARAMS ((tree)); extern bool lhd_warn_unused_global_decl PARAMS ((tree)); +extern void lhd_incomplete_type_error PARAMS ((tree, tree)); /* Declarations of default tree inlining hooks. */ tree lhd_tree_inlining_walk_subtrees PARAMS ((tree *, int *, @@ -159,6 +160,7 @@ int lhd_tree_dump_type_quals PARAMS ((tree)); /* Types hooks. There are no reasonable defaults for most of them, so we create a compile-time error instead. */ #define LANG_HOOKS_MAKE_TYPE make_node +#define LANG_HOOKS_INCOMPLETE_TYPE_ERROR lhd_incomplete_type_error #define LANG_HOOKS_FOR_TYPES_INITIALIZER { \ LANG_HOOKS_MAKE_TYPE, \ @@ -166,7 +168,8 @@ int lhd_tree_dump_type_quals PARAMS ((tree)); LANG_HOOKS_TYPE_FOR_SIZE, \ LANG_HOOKS_UNSIGNED_TYPE, \ LANG_HOOKS_SIGNED_TYPE, \ - LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE \ + LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE, \ + LANG_HOOKS_INCOMPLETE_TYPE_ERROR \ } /* Declaration hooks. */ diff --git a/gcc/langhooks.c b/gcc/langhooks.c index 128e6de..c48ea2c 100644 --- a/gcc/langhooks.c +++ b/gcc/langhooks.c @@ -178,6 +178,17 @@ lhd_clear_binding_stack () poplevel (0, 0, 0); } +/* Invalid use of an incomplete type. */ +void +lhd_incomplete_type_error (value, type) + tree value ATTRIBUTE_UNUSED, type; +{ + if (TREE_CODE (type) == ERROR_MARK) + return; + + abort (); +} + /* Provide a default routine for alias sets that always returns -1. This is used by languages that don't need to do anything special. */ diff --git a/gcc/langhooks.h b/gcc/langhooks.h index 2a50aa7..a2069d6 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -96,6 +96,12 @@ struct lang_hooks_for_types /* Return a type the same as TYPE except unsigned or signed according to UNSIGNEDP. */ tree (*signed_or_unsigned_type) PARAMS ((int, tree)); + + /* This routine is called in tree.c to print an error message for + invalid use of an incomplete type. VALUE is the expression that + was used (or 0 if that isn't known) and TYPE is the type that was + invalid. */ + void (*incomplete_type_error) PARAMS ((tree value, tree type)); }; /* Language hooks related to decls and the symbol table. */ diff --git a/gcc/objc/objc-lang.c b/gcc/objc/objc-lang.c index 6649d72..2472803 100644 --- a/gcc/objc/objc-lang.c +++ b/gcc/objc/objc-lang.c @@ -97,6 +97,8 @@ static void objc_post_options PARAMS ((void)); #define LANG_HOOKS_UNSIGNED_TYPE c_common_unsigned_type #undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE #define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE c_common_signed_or_unsigned_type +#undef LANG_HOOKS_INCOMPLETE_TYPE_ERROR +#define LANG_HOOKS_INCOMPLETE_TYPE_ERROR c_incomplete_type_error /* Each front end provides its own hooks, for toplev.c. */ const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; @@ -1187,7 +1187,7 @@ size_in_bytes (type) if (t == 0) { - incomplete_type_error (NULL_TREE, type); + (*lang_hooks.types.incomplete_type_error) (NULL_TREE, type); return size_zero_node; } @@ -2943,10 +2943,6 @@ extern const struct attribute_spec *lang_attribute_table; /* Flag saying whether common language attributes are to be supported. */ extern int lang_attribute_common; -/* In front end. */ - -extern void incomplete_type_error PARAMS ((tree, tree)); - /* In integrate.c */ extern void save_for_inline PARAMS ((tree)); extern void set_decl_abstract_flags PARAMS ((tree, int)); |