public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-jankratochvil-misc: Fixup the Fortran common blocks support to not to break Fortran modules.
@ 2009-05-04 18:11 jkratoch
  0 siblings, 0 replies; only message in thread
From: jkratoch @ 2009-05-04 18:11 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-misc has been updated
       via  89932f29d9bcb05c1cb74fc91856adb7b771d4a8 (commit)
       via  7e288482d9ea299b18d1b9d8d770958389187f90 (commit)
       via  26518ede93207182b6dbbcf58feb94b9b7027b50 (commit)
       via  9075fb58169d65dcafb641a51173c49ba487ec10 (commit)
       via  36a28bb198ce3790b4e2e39f83d366f80e264fdc (commit)
       via  95a24aa691987f164cb74122edb1efce81339724 (commit)
      from  051a16b86b015b4dabba1acd2415f3170ece0076 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 89932f29d9bcb05c1cb74fc91856adb7b771d4a8
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Mon May 4 10:26:41 2009 +0200

    Fixup the Fortran common blocks support to not to break Fortran modules.

commit 7e288482d9ea299b18d1b9d8d770958389187f90
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Mon May 4 10:10:56 2009 +0200

    Revert the Fortran patches.

commit 26518ede93207182b6dbbcf58feb94b9b7027b50
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Mon May 4 10:08:05 2009 +0200

    Update the Fortran testcase.

commit 9075fb58169d65dcafb641a51173c49ba487ec10
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Sun May 3 23:08:43 2009 +0200

    More safe Fortran test.

commit 36a28bb198ce3790b4e2e39f83d366f80e264fdc
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Sun May 3 22:47:33 2009 +0200

    Implement Fortran modules from shared libraries.

commit 95a24aa691987f164cb74122edb1efce81339724
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Sun May 3 15:31:19 2009 +0200

    Improve the in-file module Fortran testcase.

-----------------------------------------------------------------------

Summary of changes:
 gdb/dwarf2read.c                     |  115 +++++-----------------------------
 gdb/gdbtypes.h                       |    6 --
 gdb/testsuite/gdb.fortran/module.f90 |   12 +---
 3 files changed, 18 insertions(+), 115 deletions(-)

First 500 lines of diff:
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 25396fb..d034710 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -48,8 +48,6 @@
 #include "gdbcmd.h"
 #include "addrmap.h"
 #include "f-lang.h"
-#include "dictionary.h"
-#include "block.h"
 
 #include <fcntl.h>
 #include "gdb_string.h"
@@ -972,7 +970,7 @@ static void read_common_block (struct die_info *, struct dwarf2_cu *);
 
 static void read_namespace (struct die_info *die, struct dwarf2_cu *);
 
-static void read_imported_module (struct die_info *die, struct dwarf2_cu *cu);
+static void read_module (struct die_info *die, struct dwarf2_cu *cu);
 
 static const char *namespace_name (struct die_info *die,
 				   int *is_anonymous, struct dwarf2_cu *);
@@ -2860,7 +2858,6 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
     case DW_TAG_ptr_to_member_type:
     case DW_TAG_reference_type:
     case DW_TAG_string_type:
-    case DW_TAG_module:
       break;
 
     case DW_TAG_base_type:
@@ -2879,10 +2876,11 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
       processing_has_namespace_info = 1;
       read_namespace (die, cu);
       break;
-    case DW_TAG_imported_module:
-      read_imported_module (die, cu);
+    case DW_TAG_module:
+      read_module (die, cu);
       break;
     case DW_TAG_imported_declaration:
+    case DW_TAG_imported_module:
       /* FIXME: carlton/2002-10-16: Eventually, we should use the
 	 information contained in these.  DW_TAG_imported_declaration
 	 dies shouldn't have children; DW_TAG_imported_module dies
@@ -4940,98 +4938,18 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
 
 /* Read a Fortran module.  */
 
-static struct type *
-read_module_type (struct die_info *die, struct dwarf2_cu *cu)
+static void
+read_module (struct die_info *die, struct dwarf2_cu *cu)
 {
-  struct objfile *objfile = cu->objfile;
-  struct die_info *child_die;
-  struct type *type;
-  char *module_name;
-  struct context_stack *new;
-  struct pending *save_file_symbols;
-  struct pending *save_global_symbols;
-  struct pending **save_list_in_scope;
-
-  module_name = dwarf2_name (die, cu);
-  if (!module_name)
-    complaint (&symfile_complaints, _("DW_TAG_module has no name, offset 0x%x"),
-               die->offset);
-  type = init_type (TYPE_CODE_MODULE, 0, 0, module_name, objfile);
-
-  /* Create a context for reading the module variables.  */
-
-  new = push_context (0, 0);
-
-  save_file_symbols = file_symbols;
-  file_symbols = NULL;
-  save_global_symbols = global_symbols;
-  global_symbols = NULL;
-  save_list_in_scope = cu->list_in_scope;
-  cu->list_in_scope = &global_symbols;
+  struct die_info *child_die = die->child;
 
-  /* Process the child DIEs.  */
+  /* FIXME: Support the separate Fortran module namespaces.  */
 
-  child_die = die->child;
   while (child_die && child_die->tag)
     {
       process_die (child_die, cu);
       child_die = sibling_die (child_die);
     }
-
-  /* Finish this module and restore the context.  */
-
-  TYPE_MODULE_BLOCK (type) = finish_block (NULL, &global_symbols,
-                                           new->old_blocks, 0, 0, objfile);
-
-  if (file_symbols)
-    complaint (&symfile_complaints, _("DW_TAG_module contains static symbols"));
-  if (local_symbols)
-    complaint (&symfile_complaints, _("DW_TAG_module contains local symbols"));
-  if (param_symbols)
-    complaint (&symfile_complaints, _("DW_TAG_module contains function "
-				      "parameters"));
-
-  file_symbols = save_file_symbols;
-  global_symbols = save_global_symbols;
-  cu->list_in_scope = save_list_in_scope;
-
-  pop_context ();
-
-  set_die_type (die, type, cu);
-
-  return type;
-}
-
-/* Import a Fortran module.  */
-
-static void
-read_imported_module (struct die_info *die, struct dwarf2_cu *cu)
-{
-  struct attribute *attr;
-  struct die_info *module_die;
-  struct type *type;
-  struct block *block;
-  struct dict_iterator iter;
-  struct symbol *sym;
-
-  attr = dwarf2_attr (die, DW_AT_import, cu);
-  if (attr == NULL)
-    return;
-
-  module_die = follow_die_ref (die, attr, &cu);
-  type = tag_type_to_type (module_die, cu);
-  if (TYPE_CODE (type) != TYPE_CODE_MODULE)
-    {
-      complaint (&symfile_complaints,
-		 _("Imported DIE at offset 0x%x is not DW_TAG_module"),
-		 die->offset);
-      return;
-    }
-  block = TYPE_MODULE_BLOCK (type);
-  gdb_assert (block);
-
-  ALL_BLOCK_SYMBOLS (block, iter, sym)
-    add_symbol_to_list (sym, cu->list_in_scope);
 }
 
 /* Return the name of the namespace represented by DIE.  Set
@@ -7895,14 +7813,14 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
 	    {
 	      var_decode_location (attr, sym, cu);
 
+	      attr2 = dwarf2_attr (die, DW_AT_external, cu);
+
 	      /* Fortran explicitely imports any global symbols to the local
-		 scope by DW_TAG_common_block.  DW_AT_external means for
-		 Fortran the variable is importable versus it is automatically
-		 imported.  */
-	      if (cu->language == language_fortran)
-	      	attr2 = NULL;
-	      else
-		attr2 = dwarf2_attr (die, DW_AT_external, cu);
+		 scope by DW_TAG_common_block.  */
+	      if (cu->language == language_fortran && die->parent
+		  && die->parent->tag == DW_TAG_common_block)
+		attr2 = NULL;
+
 	      if (attr2 && (DW_UNSND (attr2) != 0))
 		add_symbol_to_list (sym, &global_symbols);
 	      else
@@ -8318,9 +8236,6 @@ read_type_die (struct die_info *die, struct dwarf2_cu *cu)
     case DW_TAG_namespace:
       this_type = read_namespace_type (die, cu);
       break;
-    case DW_TAG_module:
-      this_type = read_module_type (die, cu);
-      break;
     default:
       complaint (&symfile_complaints, _("unexpected tag in read_type_die: '%s'"),
 		 dwarf_tag_name (die->tag));
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index f0f5aeb..fc54acc 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -136,8 +136,6 @@ enum type_code
 
     TYPE_CODE_DECFLOAT,		/* Decimal floating point.  */
 
-    TYPE_CODE_MODULE,		/* Fortran module.  */
-
     /* Internal function type.  */
     TYPE_CODE_INTERNAL_FUNCTION
   };
@@ -526,9 +524,6 @@ struct main_type
        supporting multiple ABIs.  Right now this is only fetched from
        the Dwarf-2 DW_AT_calling_convention attribute.  */
     unsigned calling_convention;
-
-    /* For TYPE_CODE_MODULE, the list of symbols contained in the module.  */
-    struct block *module_block;
   } type_specific;
 };
 
@@ -847,7 +842,6 @@ extern void allocate_cplus_struct_type (struct type *);
 #define TYPE_CPLUS_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff
 #define TYPE_FLOATFORMAT(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.floatformat
 #define TYPE_CALLING_CONVENTION(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.calling_convention
-#define TYPE_MODULE_BLOCK(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.module_block
 #define TYPE_BASECLASS(thistype,index) TYPE_MAIN_TYPE(thistype)->fields[index].type
 #define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses
 #define TYPE_BASECLASS_NAME(thistype,index) TYPE_MAIN_TYPE(thistype)->fields[index].name
diff --git a/gdb/testsuite/gdb.fortran/module.f90 b/gdb/testsuite/gdb.fortran/module.f90
index 92aacf3..501ccc8 100644
--- a/gdb/testsuite/gdb.fortran/module.f90
+++ b/gdb/testsuite/gdb.fortran/module.f90
@@ -13,16 +13,10 @@
 ! You should have received a copy of the GNU General Public License
 ! along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-module mxd
+module mod
         integer :: i = 42
-end module mxd
+end module mod
 
-        subroutine sub
-        use mxd
-        print *, i
-        end
-
-        use mxd
-        call sub
+        use mod
         print *, i
 end


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-05-04 18:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-04 18:11 [SCM] archer-jankratochvil-misc: Fixup the Fortran common blocks support to not to break Fortran modules jkratoch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).