aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1999-02-11 00:00:28 +0000
committerJason Merrill <jason@gcc.gnu.org>1999-02-10 19:00:28 -0500
commitefe38fabaecffd988b7ed5a2240d54fce1cbdd4a (patch)
treeffd4fc96a00a14361b8892083f11396b1cf43fcd
parentd16790f212312ea395cb1d2a4f9641dea9892c64 (diff)
downloadgcc-efe38fabaecffd988b7ed5a2240d54fce1cbdd4a.zip
gcc-efe38fabaecffd988b7ed5a2240d54fce1cbdd4a.tar.gz
gcc-efe38fabaecffd988b7ed5a2240d54fce1cbdd4a.tar.bz2
decl.c (grokdeclarator): Catch wierd declarators.
* decl.c (grokdeclarator): Catch wierd declarators. * decl2.c (finish_file): Don't abort because of namespace parsing failure. (check_decl_namespace): Remove. From-SVN: r25144
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/decl.c14
-rw-r--r--gcc/cp/decl2.c11
3 files changed, 22 insertions, 10 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1eb28f0..dd1612d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+1999-02-10 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (grokdeclarator): Catch wierd declarators.
+ * decl2.c (finish_file): Don't abort because of namespace parsing
+ failure.
+ (check_decl_namespace): Remove.
+
1999-02-09 Mark Mitchell <mark@markmitchell.com>
* cp-tree.h (get_template_base): Don't declare.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index b206fd6..2547ddf 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -10574,6 +10574,20 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
}
}
+ if (declarator == NULL_TREE
+ || TREE_CODE (declarator) == IDENTIFIER_NODE
+ || (TREE_CODE (declarator) == TEMPLATE_ID_EXPR
+ && (TREE_CODE (type) == FUNCTION_TYPE
+ || TREE_CODE (type) == METHOD_TYPE)))
+ /* OK */;
+ else if (TREE_CODE (declarator) == TEMPLATE_ID_EXPR)
+ {
+ cp_error ("template-id `%D' used as a declarator", declarator);
+ declarator = dname;
+ }
+ else
+ my_friendly_abort (990210);
+
if (RIDBIT_SETP (RID_TYPEDEF, specbits) && decl_context != TYPENAME)
{
tree decl;
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 87a2577..1039747 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -58,7 +58,6 @@ static int is_namespace_ancestor PROTO((tree, tree));
static void add_using_namespace PROTO((tree, tree, int));
static tree ambiguous_decl PROTO((tree, tree, tree,int));
static tree build_anon_union_vars PROTO((tree, tree*, int, int));
-static void check_decl_namespace PROTO((void));
extern int current_class_depth;
@@ -3228,11 +3227,9 @@ finish_file ()
at_eof = 1;
/* Bad parse errors. Just forget about it. */
- if (! global_bindings_p () || current_class_type)
+ if (! global_bindings_p () || current_class_type || decl_namespace_list)
return;
- check_decl_namespace ();
-
start_time = get_run_time ();
/* Otherwise, GDB can get confused, because in only knows
@@ -4288,12 +4285,6 @@ pop_decl_namespace ()
decl_namespace_list = TREE_CHAIN (decl_namespace_list);
}
-static void
-check_decl_namespace ()
-{
- my_friendly_assert (decl_namespace_list == NULL_TREE, 980711);
-}
-
/* Enter a class or namespace scope. */
void