lex.c (handle_generic_pragma): Use token_buffer.
authorJason Merrill <jason@gcc.gnu.org>
Tue, 24 Nov 1998 21:28:47 +0000 (16:28 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 24 Nov 1998 21:28:47 +0000 (16:28 -0500)
* 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

gcc/cp/ChangeLog
gcc/cp/Make-lang.in
gcc/cp/call.c
gcc/cp/class.c
gcc/cp/decl.c
gcc/cp/lex.c
gcc/cp/search.c
gcc/cp/typeck2.c

index 07ebc11833cb1d3eaaddbd4e77279d9f9beda3eb..8a8c1696e5bf6f5104d92b4382f8bd72105b6544 100644 (file)
@@ -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.
index 1d40af6273f20e75dc8ef7bbb3cce4e149a579c0..47b32d29599936c8fe93b2736df0e9dcd2595da7 100644 (file)
@@ -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 \
index 8904aa1ccc9de4988ec352350f7bf1a403fc5790..ef636e80210204e213683e0190dbabb695c7af73 100644 (file)
@@ -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))
index 8c098f03d2feaade1c36682cefb928249fe570e7..a2e824478e812c39707c90c862ef77009cecff38 100644 (file)
@@ -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)
index 93be36019e8125e9b7c17867770fca3ccf6a2477..b21a7a9015627b9af8b30bfd06fe57a5798fb943 100644 (file)
@@ -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;
index d20a44d9f280ba9771adf13951384621bf58192d..461f73ea4bf1f2562cdf355c415a0889d277e4db 100644 (file)
@@ -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 ();
index d0ae536ea7aee03be65ff0a91eb73dbd189f96bd..94fdbc28cee311ec63b38f85e12ec4fae0671aa5 100644 (file)
@@ -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
index e11bde2d3b291fa172ec850f12430ba59bb742eb..b638f40ee19238027a67e85fcba88dcc9af5878f 100644 (file)
@@ -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);