shift-reduce conflicts.
(decl.o): Depend on diagnostic.h.
* decl.c: Include diagnostic.h.
(grokdeclarator): Check for null pointer.
(finish_function): Don't abort when
current_binding_level->parm_flag != 1, if errors have
occurred; throw away the statement tree and extra binding
levels, and continue.
* lex.c (note_list_got_semicolon): Check for null pointer.
* method.c (hack_identifier): Just return error_mark_node if
value is error_mark_node.
* parse.y (primary: TYPEID(type_id)): No need to use
TYPE_MAIN_VARIANT here.
(handler_seq): Accept an empty list of catch clauses and
generate a fake handler block to avoid later crashes.
(ansi_raise_identifier): Accept the error token too.
* semantics.c (begin_class_definition,
finish_class_definition): Check for error_mark_node.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49163
138bc75d-0d04-0410-961f-
82ee72b054a4
2002-01-23 Zack Weinberg <zack@codesourcery.com>
+ * Make-lang.in (parse.c): Adjust expected number of
+ shift-reduce conflicts.
+ (decl.o): Depend on diagnostic.h.
+ * decl.c: Include diagnostic.h.
+ (grokdeclarator): Check for null pointer.
+ (finish_function): Don't abort when
+ current_binding_level->parm_flag != 1, if errors have
+ occurred; throw away the statement tree and extra binding
+ levels, and continue.
+ * lex.c (note_list_got_semicolon): Check for null pointer.
+ * method.c (hack_identifier): Just return error_mark_node if
+ value is error_mark_node.
+ * parse.y (primary: TYPEID(type_id)): No need to use
+ TYPE_MAIN_VARIANT here.
+ (handler_seq): Accept an empty list of catch clauses and
+ generate a fake handler block to avoid later crashes.
+ (ansi_raise_identifier): Accept the error token too.
+ * semantics.c (begin_class_definition,
+ finish_class_definition): Check for error_mark_node.
+
+2002-01-23 Zack Weinberg <zack@codesourcery.com>
+
* typeck2.c (friendly_abort): Delete definition.
* cp-tree.h (friendly_abort): Don't prototype.
(my_friendly_assert): Use fancy_abort.
$(srcdir)/cp/parse.h: $(srcdir)/cp/parse.c
$(srcdir)/cp/parse.c: $(srcdir)/cp/parse.y
- @echo "Expect 34 shift/reduce conflicts and 58 reduce/reduce conflicts."
+ @echo "Expect 36 shift/reduce conflicts and 58 reduce/reduce conflicts."
cd $(srcdir)/cp; $(BISON) $(BISONFLAGS) -d -o p$$$$.c parse.y ; \
grep '^#define[ ]*YYEMPTY' p$$$$.c >> p$$$$.h ; \
mv -f p$$$$.c parse.c ; mv -f p$$$$.h parse.h
c-common.h
cp/decl.o: cp/decl.c $(CXX_TREE_H) flags.h cp/lex.h cp/decl.h stack.h \
output.h $(EXPR_H) except.h toplev.h hash.h $(GGC_H) $(RTL_H) \
- cp/operators.def $(TM_P_H) tree-inline.h
+ cp/operators.def $(TM_P_H) tree-inline.h diagnostic.h
cp/decl2.o: cp/decl2.c $(CXX_TREE_H) flags.h cp/lex.h cp/decl.h $(EXPR_H) \
output.h except.h toplev.h $(GGC_H) $(RTL_H)
cp/typeck2.o: cp/typeck2.c $(CXX_TREE_H) flags.h toplev.h output.h $(TM_P_H) \
#include "tm_p.h"
#include "target.h"
#include "c-common.h"
+#include "diagnostic.h"
extern const struct attribute_spec *lang_attribute_table;
common. With no options, it is allowed. With -Wreturn-type,
it is a warning. It is only an error with -pedantic-errors. */
is_main = (funcdef_flag
- && MAIN_NAME_P (dname)
+ && dname && MAIN_NAME_P (dname)
&& ctype == NULL_TREE
&& in_namespace == NULL_TREE
&& current_namespace == global_namespace);
/* This must come after expand_function_end because cleanups might
have declarations (from inline functions) that need to go into
this function's blocks. */
+
+ /* If the current binding level isn't the outermost binding level
+ for this function, either there is a bug, or we have experienced
+ syntax errors and the statement tree is malformed. */
if (current_binding_level->parm_flag != 1)
- abort ();
+ {
+ /* Make sure we have already experienced errors. */
+ if (errorcount == 0)
+ abort ();
+
+ /* Throw away the broken statement tree and extra binding
+ levels. */
+ DECL_SAVED_TREE (fndecl) = build_stmt (COMPOUND_STMT, NULL_TREE);
+
+ while (current_binding_level->parm_flag != 1)
+ {
+ if (current_binding_level->parm_flag == 2)
+ pop_nested_class ();
+ else
+ poplevel (0, 0, 0);
+ }
+ }
poplevel (1, 0, 1);
/* Set up the named return value optimization, if we can. Here, we
for (link = declspecs; link; link = TREE_CHAIN (link))
{
tree type = TREE_VALUE (link);
- if (TYPE_P (type))
+ if (type && TYPE_P (type))
note_got_semicolon (type);
}
clear_anon_tags ();
tree type;
if (value == error_mark_node)
- {
- if (current_class_name)
- {
- tree fields = lookup_fnfields (TYPE_BINFO (current_class_type),
- name, 1);
- if (fields == error_mark_node)
- return error_mark_node;
- if (fields)
- {
- tree fndecl;
-
- fndecl = TREE_VALUE (fields);
- my_friendly_assert (TREE_CODE (fndecl) == FUNCTION_DECL, 251);
- /* I could not trigger this code. MvL */
- abort ();
-#ifdef DEAD
- if (DECL_CHAIN (fndecl) == NULL_TREE)
- {
- warning ("methods cannot be converted to function pointers");
- return fndecl;
- }
- else
- {
- error ("ambiguous request for method pointer `%s'",
- IDENTIFIER_POINTER (name));
- return error_mark_node;
- }
-#endif
- }
- }
- return error_mark_node;
- }
+ return error_mark_node;
type = TREE_TYPE (value);
if (TREE_CODE (value) == FIELD_DECL)
| TYPEID '(' type_id ')'
{ tree type = groktypename ($3.t);
check_for_new_type ("typeid", $3);
- $$ = get_typeid (TYPE_MAIN_VARIANT (type)); }
+ $$ = get_typeid (type); }
| global_scope IDENTIFIER
{ $$ = do_scoped_id ($2, 1); }
| global_scope template_id
handler_seq:
handler
| handler_seq handler
+ | /* empty */
+ { /* Generate a fake handler block to avoid later aborts. */
+ tree fake_handler = begin_handler ();
+ finish_handler_parms (NULL_TREE, fake_handler);
+ finish_handler (fake_handler);
+ $<ttype>$ = fake_handler;
+
+ error ("must have at least one catch per try block");
+ }
;
handler:
check_for_new_type ("exception specifier", $1);
$$ = groktypename ($1.t);
}
+ | error
+ { $$ = error_mark_node; }
;
ansi_raise_identifiers:
begin_class_definition (t)
tree t;
{
+ if (t == error_mark_node)
+ return error_mark_node;
+
/* Check the bases are accessible. */
decl_type_access_control (TYPE_NAME (t));
reset_type_access_control ();
int semi;
int pop_scope_p;
{
+ if (t == error_mark_node)
+ return error_mark_node;
+
/* finish_struct nukes this anyway; if finish_exception does too,
then it can go. */
if (semi)