summaryrefslogtreecommitdiff
path: root/gdb/cp-support.h
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2011-06-29 22:05:14 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2011-06-29 22:05:14 +0000
commita2fc30e56d89513064cd63b2282caaf32350386c (patch)
treed5041e2022eb6921b729a89ecb81f93b3dadf1ee /gdb/cp-support.h
parenta9132a37b5be7481754e8e6e04c15857fe3edecd (diff)
downloadgdb-a2fc30e56d89513064cd63b2282caaf32350386c.tar.gz
gdb/
Fix non-only rename list for Fortran modules import. * cp-namespace.c (cp_scan_for_anonymous_namespaces): Adjust the cp_add_using_directive caller. (cp_add_using_directive): New parameter excludes, describe it. New variables ix and param. Compare if also excludes match. Allocate NEW with variable size, initialize EXCLUDES there. (cp_lookup_symbol_imports): New variable excludep, test current->EXCLUDES with it. * cp-support.h: Include vec.h. (struct using_direct): New field excludes, describe it. (DEF_VEC_P (const_char_ptr)): New. (cp_add_using_directive): New parameter excludes. * defs.h (const_char_ptr): New typedef. * dwarf2read.c (read_import_statement): New variables child_die, excludes and cleanups, read in excludes. (read_namespace): Adjust the cp_add_using_directive caller. gdb/testsuite/ Fix non-only rename list for Fortran modules import. * gdb.fortran/module.exp (print var_x, print var_y, print var_z): New tests. * gdb.fortran/module.f90 (module moduse): New. (program module): use moduse, test var_x, var_y and var_z.
Diffstat (limited to 'gdb/cp-support.h')
-rw-r--r--gdb/cp-support.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/gdb/cp-support.h b/gdb/cp-support.h
index 52d4cb788b5..d23f19ed0e7 100644
--- a/gdb/cp-support.h
+++ b/gdb/cp-support.h
@@ -27,6 +27,8 @@
#include "symtab.h"
+#include "vec.h"
+
/* Opaque declarations. */
struct symbol;
@@ -60,6 +62,7 @@ struct demangle_component;
import_dest = local scope of the import statement even such as ""
alias = NULL
declaration = NULL
+ excludes = NULL
C++: using A::x;
Fortran: use A, only: x
@@ -67,14 +70,32 @@ struct demangle_component;
import_dest = local scope of the import statement even such as ""
alias = NULL
declaration = "x"
+ excludes = NULL
The declaration will get imported as import_dest::x.
+ C++ has no way to import all names except those listed ones.
+ Fortran: use A, localname => x
+ import_src = "A"
+ import_dest = local scope of the import statement even such as ""
+ alias = "localname"
+ declaration = "x"
+ excludes = NULL
+ +
+ import_src = "A"
+ import_dest = local scope of the import statement even such as ""
+ alias = NULL
+ declaration = NULL
+ excludes = ["x"]
+ All the entries of A get imported except of "x". "x" gets imported as
+ "localname". "x" is not defined as a local name by this statement.
+
C++: namespace LOCALNS = A;
Fortran has no way to address non-local namespace/module.
import_src = "A"
import_dest = local scope of the import statement even such as ""
alias = "LOCALNS"
declaration = NULL
+ excludes = NULL
The namespace will get imported as the import_dest::LOCALNS
namespace.
@@ -85,6 +106,7 @@ struct demangle_component;
import_dest = local scope of the import statement even such as ""
alias = "localname"
declaration = "x"
+ excludes = NULL
The declaration will get imported as localname or
`import_dest`localname. */
@@ -101,6 +123,10 @@ struct using_direct
/* Used during import search to temporarily mark this node as
searched. */
int searched;
+
+ /* USING_DIRECT has variable allocation size according to the number of
+ EXCLUDES entries, the last entry is NULL. */
+ const char *excludes[1];
};
@@ -136,10 +162,13 @@ extern int cp_validate_operator (const char *input);
extern int cp_is_anonymous (const char *namespace);
+DEF_VEC_P (const_char_ptr);
+
extern void cp_add_using_directive (const char *dest,
const char *src,
const char *alias,
const char *declaration,
+ VEC (const_char_ptr) *excludes,
struct obstack *obstack);
extern void cp_initialize_namespace (void);