lex.c (handle_generic_pragma): Use token_buffer.
* lex.c (handle_generic_pragma): Use token_buffer. * decl.c (check_tag_decl): Don't complain about null friend decl. * Make-lang.in (DEMANGLER_PROG): Move the output argumnts to the first position. * lex.c (check_newline): Use ISALPHA. (readescape): Use ISGRAPH. (yyerror): Use ISGRAPH. * search.c (get_abstract_virtuals): Do not use initial CLASSTYPE_ABSTRACT_VIRTUALS. * typeck2.c (abstract_virtuals_error): Show location of abstract declaration. * call.c (build_new_method_call): Use CLASSTYPE_ABSTRACT_VIRTUAL, rather than recalculate. * class.c (finish_struct_bits): Don't bother working out whether get_abstract_virtuals will do anything, just do it. From-SVN: r23836
This commit is contained in:
parent
d1be3be367
commit
83f660b758
@ -1,3 +1,28 @@
|
||||
1998-11-24 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* lex.c (handle_generic_pragma): Use token_buffer.
|
||||
|
||||
* decl.c (check_tag_decl): Don't complain about null friend decl.
|
||||
|
||||
1998-11-24 Dave Pitts <dpitts@cozx.com>
|
||||
|
||||
* Make-lang.in (DEMANGLER_PROG): Move the output argumnts to the
|
||||
first position.
|
||||
* lex.c (check_newline): Use ISALPHA.
|
||||
(readescape): Use ISGRAPH.
|
||||
(yyerror): Use ISGRAPH.
|
||||
|
||||
1998-11-24 Nathan Sidwell <nathan@acm.org>
|
||||
|
||||
* search.c (get_abstract_virtuals): Do not use initial
|
||||
CLASSTYPE_ABSTRACT_VIRTUALS.
|
||||
* typeck2.c (abstract_virtuals_error): Show location of abstract
|
||||
declaration.
|
||||
* call.c (build_new_method_call): Use
|
||||
CLASSTYPE_ABSTRACT_VIRTUAL, rather than recalculate.
|
||||
* class.c (finish_struct_bits): Don't bother working out whether
|
||||
get_abstract_virtuals will do anything, just do it.
|
||||
|
||||
1998-11-24 Graham <grahams@rcp.co.uk>
|
||||
|
||||
* typeck.c (build_component_ref): Remove unused statement.
|
||||
|
@ -109,8 +109,9 @@ cxxmain.o: $(srcdir)/../libiberty/cplus-dem.c demangle.h
|
||||
$(CC) -c -DMAIN $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
|
||||
-DVERSION=\"$(version)\" cxxmain.c
|
||||
|
||||
# Apparently OpenVM needs the -o to be at the beginning of the link line.
|
||||
$(DEMANGLER_PROG): cxxmain.o underscore.o getopt.o getopt1.o $(LIBDEPS)
|
||||
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
|
||||
$(CC) -o $@ $(ALL_CFLAGS) $(LDFLAGS) \
|
||||
cxxmain.o underscore.o getopt.o getopt1.o $(LIBS)
|
||||
|
||||
CXX_SRCS = $(srcdir)/cp/call.c $(srcdir)/cp/decl2.c \
|
||||
|
@ -3671,7 +3671,7 @@ build_new_method_call (instance, name, args, basetype_path, flags)
|
||||
&& instance == current_class_ref
|
||||
&& DECL_CONSTRUCTOR_P (current_function_decl)
|
||||
&& ! (flags & LOOKUP_NONVIRTUAL)
|
||||
&& value_member (cand->fn, get_abstract_virtuals (basetype)))
|
||||
&& value_member (cand->fn, CLASSTYPE_ABSTRACT_VIRTUALS (basetype)))
|
||||
cp_error ("abstract virtual `%#D' called from constructor", cand->fn);
|
||||
if (TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE
|
||||
&& is_dummy_object (instance_ptr))
|
||||
|
@ -1964,24 +1964,15 @@ finish_struct_bits (t, max_has_virtual)
|
||||
|
||||
if (n_baseclasses && max_has_virtual)
|
||||
{
|
||||
/* Done by `finish_struct' for classes without baseclasses. */
|
||||
int might_have_abstract_virtuals = CLASSTYPE_ABSTRACT_VIRTUALS (t) != 0;
|
||||
tree binfos = TYPE_BINFO_BASETYPES (t);
|
||||
for (i = n_baseclasses-1; i >= 0; i--)
|
||||
{
|
||||
might_have_abstract_virtuals
|
||||
|= (CLASSTYPE_ABSTRACT_VIRTUALS (BINFO_TYPE (TREE_VEC_ELT (binfos, i))) != 0);
|
||||
if (might_have_abstract_virtuals)
|
||||
break;
|
||||
}
|
||||
if (might_have_abstract_virtuals)
|
||||
{
|
||||
/* We use error_mark_node from override_one_vtable to signal
|
||||
an artificial abstract. */
|
||||
if (CLASSTYPE_ABSTRACT_VIRTUALS (t) == error_mark_node)
|
||||
CLASSTYPE_ABSTRACT_VIRTUALS (t) = NULL_TREE;
|
||||
CLASSTYPE_ABSTRACT_VIRTUALS (t) = get_abstract_virtuals (t);
|
||||
}
|
||||
/* for a class w/o baseclasses, `finish_struct' has set
|
||||
* CLASS_TYPE_ABSTRACT_VIRTUALS correctly (by definition). Similarly
|
||||
* for a class who's base classes do not have vtables. When neither of
|
||||
* these is true, we might have removed abstract virtuals (by
|
||||
* providing a definition), added some (by declaring new ones), or
|
||||
* redeclared ones from a base class. We need to recalculate what's
|
||||
* really an abstract virtual at this point (by looking in the vtables).
|
||||
*/
|
||||
CLASSTYPE_ABSTRACT_VIRTUALS (t) = get_abstract_virtuals (t);
|
||||
}
|
||||
|
||||
if (n_baseclasses)
|
||||
|
@ -6462,6 +6462,7 @@ check_tag_decl (declspecs)
|
||||
tree declspecs;
|
||||
{
|
||||
int found_type = 0;
|
||||
int friendp = 0;
|
||||
tree ob_modifier = NULL_TREE;
|
||||
register tree link;
|
||||
register tree t = NULL_TREE;
|
||||
@ -6480,15 +6481,19 @@ check_tag_decl (declspecs)
|
||||
t = value;
|
||||
}
|
||||
}
|
||||
else if (value == ridpointers[(int) RID_FRIEND])
|
||||
{
|
||||
friendp = 1;
|
||||
if (current_class_type == NULL_TREE
|
||||
|| current_scope () != current_class_type)
|
||||
ob_modifier = value;
|
||||
}
|
||||
else if (value == ridpointers[(int) RID_STATIC]
|
||||
|| value == ridpointers[(int) RID_EXTERN]
|
||||
|| value == ridpointers[(int) RID_AUTO]
|
||||
|| value == ridpointers[(int) RID_REGISTER]
|
||||
|| value == ridpointers[(int) RID_INLINE]
|
||||
|| value == ridpointers[(int) RID_VIRTUAL]
|
||||
|| (value == ridpointers[(int) RID_FRIEND]
|
||||
&& (current_class_type == NULL_TREE
|
||||
|| current_scope () != current_class_type))
|
||||
|| value == ridpointers[(int) RID_CONST]
|
||||
|| value == ridpointers[(int) RID_VOLATILE]
|
||||
|| value == ridpointers[(int) RID_EXPLICIT])
|
||||
@ -6499,28 +6504,25 @@ check_tag_decl (declspecs)
|
||||
error ("multiple types in one declaration");
|
||||
|
||||
if (t == NULL_TREE)
|
||||
pedwarn ("declaration does not declare anything");
|
||||
else if (ANON_UNION_TYPE_P (t))
|
||||
return t;
|
||||
else
|
||||
{
|
||||
/* Anonymous unions are objects, that's why we only check for
|
||||
inappropriate specifiers in this branch. */
|
||||
|
||||
if (ob_modifier)
|
||||
{
|
||||
if (ob_modifier == ridpointers[(int) RID_INLINE]
|
||||
|| ob_modifier == ridpointers[(int) RID_VIRTUAL])
|
||||
cp_error ("`%D' can only be specified for functions", ob_modifier);
|
||||
else if (ob_modifier == ridpointers[(int) RID_FRIEND])
|
||||
cp_error ("`%D' can only be specified inside a class", ob_modifier);
|
||||
else if (ob_modifier == ridpointers[(int) RID_EXPLICIT])
|
||||
cp_error ("`%D' can only be specified for constructors",
|
||||
ob_modifier);
|
||||
else
|
||||
cp_error ("`%D' can only be specified for objects and functions",
|
||||
ob_modifier);
|
||||
}
|
||||
if (! friendp)
|
||||
pedwarn ("declaration does not declare anything");
|
||||
}
|
||||
else if (ANON_UNION_TYPE_P (t))
|
||||
/* Anonymous unions are objects, so they can have specifiers. */;
|
||||
else if (ob_modifier)
|
||||
{
|
||||
if (ob_modifier == ridpointers[(int) RID_INLINE]
|
||||
|| ob_modifier == ridpointers[(int) RID_VIRTUAL])
|
||||
cp_error ("`%D' can only be specified for functions", ob_modifier);
|
||||
else if (ob_modifier == ridpointers[(int) RID_FRIEND])
|
||||
cp_error ("`%D' can only be specified inside a class", ob_modifier);
|
||||
else if (ob_modifier == ridpointers[(int) RID_EXPLICIT])
|
||||
cp_error ("`%D' can only be specified for constructors",
|
||||
ob_modifier);
|
||||
else
|
||||
cp_error ("`%D' can only be specified for objects and functions",
|
||||
ob_modifier);
|
||||
}
|
||||
|
||||
return t;
|
||||
|
30
gcc/cp/lex.c
30
gcc/cp/lex.c
@ -2295,7 +2295,7 @@ check_newline ()
|
||||
it and ignore it; otherwise, ignore the line, with an error
|
||||
if the word isn't `pragma'. */
|
||||
|
||||
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
|
||||
if (ISALPHA (c))
|
||||
{
|
||||
if (c == 'p')
|
||||
{
|
||||
@ -2780,7 +2780,7 @@ readescape (ignore_ptr)
|
||||
pedwarn ("unknown escape sequence `\\%c'", c);
|
||||
return c;
|
||||
}
|
||||
if (c >= 040 && c < 0177)
|
||||
if (ISGRAPH (c))
|
||||
pedwarn ("unknown escape sequence `\\%c'", c);
|
||||
else
|
||||
pedwarn ("unknown escape sequence: `\\' followed by char code 0x%x", c);
|
||||
@ -4776,7 +4776,7 @@ yyerror (string)
|
||||
strcat (buf, " before string constant");
|
||||
else if (token_buffer[0] == '\'')
|
||||
strcat (buf, " before character constant");
|
||||
else if (token_buffer[0] < 040 || (unsigned char) token_buffer[0] >= 0177)
|
||||
else if (!ISGRAPH (token_buffer[0]))
|
||||
sprintf (buf + strlen (buf), " before character 0%o",
|
||||
(unsigned char) token_buffer[0]);
|
||||
else
|
||||
@ -4999,29 +4999,21 @@ handle_generic_pragma (token)
|
||||
{
|
||||
case IDENTIFIER:
|
||||
case TYPENAME:
|
||||
case STRING:
|
||||
case CONSTANT:
|
||||
handle_pragma_token (IDENTIFIER_POINTER(yylval.ttype), yylval.ttype);
|
||||
break;
|
||||
case '(':
|
||||
handle_pragma_token ("(", NULL_TREE);
|
||||
break;
|
||||
case ')':
|
||||
handle_pragma_token (")", NULL_TREE);
|
||||
break;
|
||||
case ',':
|
||||
handle_pragma_token (",", NULL_TREE);
|
||||
break;
|
||||
case '=':
|
||||
handle_pragma_token ("=", NULL_TREE);
|
||||
case STRING:
|
||||
case CONSTANT:
|
||||
handle_pragma_token (token_buffer, yylval.ttype);
|
||||
break;
|
||||
|
||||
case LEFT_RIGHT:
|
||||
handle_pragma_token ("(", NULL_TREE);
|
||||
handle_pragma_token (")", NULL_TREE);
|
||||
break;
|
||||
|
||||
case END_OF_LINE:
|
||||
default:
|
||||
return handle_pragma_token (NULL_PTR, NULL_TREE);
|
||||
|
||||
default:
|
||||
handle_pragma_token (token_buffer, NULL);
|
||||
}
|
||||
|
||||
token = real_yylex ();
|
||||
|
@ -1952,7 +1952,7 @@ get_abstract_virtuals (type)
|
||||
tree type;
|
||||
{
|
||||
tree vbases;
|
||||
tree abstract_virtuals = CLASSTYPE_ABSTRACT_VIRTUALS (type);
|
||||
tree abstract_virtuals = NULL;
|
||||
|
||||
/* First get all from non-virtual bases. */
|
||||
abstract_virtuals
|
||||
|
@ -165,7 +165,7 @@ abstract_virtuals_error (decl, type)
|
||||
|
||||
error (" since the following virtual functions are abstract:");
|
||||
for (tu = u; tu; tu = TREE_CHAIN (tu))
|
||||
cp_error ("\t%#D", TREE_VALUE (tu));
|
||||
cp_error_at ("\t%#D", TREE_VALUE (tu));
|
||||
}
|
||||
else
|
||||
cp_error (" since type `%T' has abstract virtual functions", type);
|
||||
|
Loading…
Reference in New Issue
Block a user