]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/26195 (pragma interface no longer handles explicit names)
authorJason Merrill <jason@gcc.gnu.org>
Thu, 7 Sep 2006 22:38:03 +0000 (18:38 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 7 Sep 2006 22:38:03 +0000 (18:38 -0400)
        PR c++/26195
        * decl.c (make_rtl_for_nonlocal_decl),
        (start_preparsed_function): Don't use lbasename on
        input_filename when calling get_fileinfo.
        * semantics.c (begin_class_definition): Likewise.
        * lex.c (cxx_make_type): Likewise.
        (handle_pragma_interface): Call get_fileinfo on input_filename,
        not on the parameter to the directive.

        PR c++/26696
        * cvt.c (convert_to_void): Replace a subexpression with no side
        effects with void_zero_node.
        * tree.c (is_overloaded_fn): Look through COMPONENT_REF.
        (get_first_fn): Ditto.
        * decl.c (grokdeclarator): No need to look through COMPONENT_REF.

        PR c++/26571
        * parser.c (cp_parser_diagnose_invalid_type_name): Handle the case
        where the name is a type used incorrectly.

        PR c++/26671
        * typeck.c (maybe_warn_about_returning_address_of_local): Look
        through COMPONENT_REF and ARRAY_REF.

        PR c++/19809
        * pt.c (tsubst_friend_function): Set DECL_INITIAL before pushdecl.

From-SVN: r116764

gcc/cp/ChangeLog
gcc/cp/cvt.c
gcc/cp/decl.c
gcc/cp/lex.c
gcc/cp/parser.c
gcc/cp/pt.c
gcc/cp/semantics.c
gcc/cp/tree.c
gcc/cp/typeck.c

index b8eb591833fdea4b43c1e49bc5b8f398d1de9e61..4fe76499108707037f281379601463b64ae3dcd5 100644 (file)
@@ -1,3 +1,36 @@
+2006-09-06  Zak Kipling  <zak@transversal.com>
+
+        PR c++/26195
+       * decl.c (make_rtl_for_nonlocal_decl),
+       (start_preparsed_function): Don't use lbasename on
+       input_filename when calling get_fileinfo.
+       * semantics.c (begin_class_definition): Likewise.
+       * lex.c (cxx_make_type): Likewise.
+       (handle_pragma_interface): Call get_fileinfo on input_filename,
+       not on the parameter to the directive.
+
+2006-09-06  Jason Merrill  <jason@redhat.com>
+
+       PR c++/26696
+       * cvt.c (convert_to_void): Replace a subexpression with no side 
+       effects with void_zero_node.
+       * tree.c (is_overloaded_fn): Look through COMPONENT_REF.
+       (get_first_fn): Ditto.
+       * decl.c (grokdeclarator): No need to look through COMPONENT_REF.
+
+2006-09-05  Jason Merrill  <jason@redhat.com>
+
+       PR c++/26571
+       * parser.c (cp_parser_diagnose_invalid_type_name): Handle the case
+       where the name is a type used incorrectly.
+
+       PR c++/26671
+       * typeck.c (maybe_warn_about_returning_address_of_local): Look 
+       through COMPONENT_REF and ARRAY_REF.    
+
+       PR c++/19809
+       * pt.c (tsubst_friend_function): Set DECL_INITIAL before pushdecl.
+
 2006-08-28  Jason Merrill  <jason@redhat.com>
 
        PR c++/26577
index 0e1a8431202c96704c30ce5904ce286eafd4b2d9..6b9067600a393c2e42f15f92896f316a344a502c 100644 (file)
@@ -947,6 +947,8 @@ convert_to_void (tree expr, const char *implicit)
        }
       expr = build1 (CONVERT_EXPR, void_type_node, expr);
     }
+  if (! TREE_SIDE_EFFECTS (expr))
+    expr = void_zero_node;
   return expr;
 }
 
index cddfcb2f73892e6d6b3cc91b0eb98152ddddb1a6..61b12863f1a85445510ac3e06ecd466ca8626696 100644 (file)
@@ -4621,7 +4621,7 @@ make_rtl_for_nonlocal_decl (tree decl, tree init, const char* asmspec)
     {
       /* Fool with the linkage of static consts according to #pragma
         interface.  */
-      struct c_fileinfo *finfo = get_fileinfo (lbasename (input_filename));
+      struct c_fileinfo *finfo = get_fileinfo (input_filename);
       if (!finfo->interface_unknown && !TREE_PUBLIC (decl))
        {
          TREE_PUBLIC (decl) = 1;
@@ -6584,8 +6584,6 @@ grokdeclarator (const cp_declarator *declarator,
                  tree fns = TREE_OPERAND (decl, 0);
 
                  dname = fns;
-                 if (TREE_CODE (dname) == COMPONENT_REF)
-                   dname = TREE_OPERAND (dname, 1);
                  if (TREE_CODE (dname) != IDENTIFIER_NODE)
                    {
                      gcc_assert (is_overloaded_fn (dname));
@@ -9915,7 +9913,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
   struct cp_binding_level *bl;
   tree current_function_parms;
   struct c_fileinfo *finfo
-    = get_fileinfo (lbasename (LOCATION_FILE (DECL_SOURCE_LOCATION (decl1))));
+    = get_fileinfo (LOCATION_FILE (DECL_SOURCE_LOCATION (decl1)));
 
   /* Sanity check.  */
   gcc_assert (TREE_CODE (TREE_VALUE (void_list_node)) == VOID_TYPE);
index e0626f7e568204da0535d988a0f91512d8e5d2d6..0a565115df1163f66ca5605cb5f99ce21f26ab80 100644 (file)
@@ -467,7 +467,7 @@ handle_pragma_interface (cpp_reader* dfile ATTRIBUTE_UNUSED )
   else
     filename = ggc_strdup (TREE_STRING_POINTER (fname));
 
-  finfo = get_fileinfo (filename);
+  finfo = get_fileinfo (input_filename);
 
   if (impl_file_chain == 0)
     {
@@ -773,7 +773,7 @@ cxx_make_type (enum tree_code code)
   /* Set up some flags that give proper default behavior.  */
   if (IS_AGGR_TYPE_CODE (code))
     {
-      struct c_fileinfo *finfo = get_fileinfo (lbasename (input_filename));
+      struct c_fileinfo *finfo = get_fileinfo (input_filename);
       SET_CLASSTYPE_INTERFACE_UNKNOWN_X (t, finfo->interface_unknown);
       CLASSTYPE_INTERFACE_ONLY (t) = finfo->interface_only;
     }
index 5d04a2fedadd3b52c869a16509042012a4974841..0d840e7d375e104e0dae9aa20ca5b0f65e301648 100644 (file)
@@ -2052,6 +2052,9 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser, tree scope, tree id)
     error ("invalid use of template-name %qE without an argument list", decl);
   else if (TREE_CODE (id) == BIT_NOT_EXPR)
     error ("invalid use of destructor %qD as a type", id);
+  else if (TREE_CODE (decl) == TYPE_DECL)
+    /* Something like 'unsigned A a;'  */
+    error ("invalid combination of multiple type-specifiers");
   else if (!parser->scope || parser->scope == error_mark_node)
     {
       /* Issue an error message.  */
index 9ae563f50be8002577744c1108096240e2f2ecdc..75b063b75588067e29b0cd9507b907f08a16f8f9 100644 (file)
@@ -5206,6 +5206,10 @@ tsubst_friend_function (tree decl, tree args)
       else
        new_friend_result_template_info = NULL_TREE;
 
+      /* Make the init_value nonzero so pushdecl knows this is a defn.  */
+      if (new_friend_is_defn)
+       DECL_INITIAL (new_friend) = error_mark_node;
+
       /* Inside pushdecl_namespace_level, we will push into the
         current namespace. However, the friend function should go
         into the namespace of the template.  */
index 099f346e20dd79eb7b86555b9de1e629f104c746..4a0acad9bdf6e30d3e5f537d5759d9053b65e70d 100644 (file)
@@ -2123,7 +2123,7 @@ begin_class_definition (tree t)
      before.  */
   if (! TYPE_ANONYMOUS_P (t))
     {
-      struct c_fileinfo *finfo = get_fileinfo (lbasename (input_filename));
+      struct c_fileinfo *finfo = get_fileinfo (input_filename);
       CLASSTYPE_INTERFACE_ONLY (t) = finfo->interface_only;
       SET_CLASSTYPE_INTERFACE_UNKNOWN_X
        (t, finfo->interface_unknown);
index b9b2030584cece88421d900f1d0add72cdd6b4ba..72670c185cd40a38a23327652aa17c7f3af4bf84 100644 (file)
@@ -807,7 +807,8 @@ int
 is_overloaded_fn (tree x)
 {
   /* A baselink is also considered an overloaded function.  */
-  if (TREE_CODE (x) == OFFSET_REF)
+  if (TREE_CODE (x) == OFFSET_REF
+      || TREE_CODE (x) == COMPONENT_REF)
     x = TREE_OPERAND (x, 1);
   if (BASELINK_P (x))
     x = BASELINK_FUNCTIONS (x);
@@ -836,6 +837,8 @@ get_first_fn (tree from)
 {
   gcc_assert (is_overloaded_fn (from));
   /* A baselink is also considered an overloaded function.  */
+  if (TREE_CODE (from) == COMPONENT_REF)
+    from = TREE_OPERAND (from, 1);
   if (BASELINK_P (from))
     from = BASELINK_FUNCTIONS (from);
   return OVL_CURRENT (from);
index a4811546163212a1d42dd4b6c25edfc99f220e10..ed7258399b393b5b9594a94682a2114be269c49a 100644 (file)
@@ -6083,6 +6083,10 @@ maybe_warn_about_returning_address_of_local (tree retval)
        }
     }
 
+  while (TREE_CODE (whats_returned) == COMPONENT_REF
+        || TREE_CODE (whats_returned) == ARRAY_REF)
+    whats_returned = TREE_OPERAND (whats_returned, 0);
+
   if (DECL_P (whats_returned)
       && DECL_NAME (whats_returned)
       && DECL_FUNCTION_SCOPE_P (whats_returned)