aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tiemann <tiemann@axon.cygnus.com>1998-03-04 12:13:02 +0000
committerJason Merrill <jason@gcc.gnu.org>1998-03-04 07:13:02 -0500
commit5427d758ddd8257a5f24408e036e062c51607972 (patch)
treedeb5a0d852a03ca7f0c85ee68e929773bc431402
parent8f279ed7be97a4cafd8701062618fb06068793a1 (diff)
downloadgcc-5427d758ddd8257a5f24408e036e062c51607972.zip
gcc-5427d758ddd8257a5f24408e036e062c51607972.tar.gz
gcc-5427d758ddd8257a5f24408e036e062c51607972.tar.bz2
rtti.c (get_tinfo_fn_dynamic): If this function is called an FLAG_RTTI is unset...
* rtti.c (get_tinfo_fn_dynamic): If this function is called an FLAG_RTTI is unset, initialize type info machinery and continue with FLAG_RTTI enabled. (get_typeid): Ditto. From-SVN: r18401
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/gxxint.texi28
-rw-r--r--gcc/cp/lex.c1
-rw-r--r--gcc/cp/rtti.c17
4 files changed, 52 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 582567a..c088b9b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+Wed Mar 4 12:11:53 1998 Michael Tiemann <tiemann@axon.cygnus.com>
+
+ * rtti.c (get_tinfo_fn_dynamic): If this function is called an
+ FLAG_RTTI is unset, initialize type info machinery and continue
+ with FLAG_RTTI enabled.
+ (get_typeid): Ditto.
+
Wed Mar 4 11:47:55 1998 Jason Merrill <jason@yorick.cygnus.com>
* typeck.c (unary_complex_lvalue): &D::i has type B::* if i comes
diff --git a/gcc/cp/gxxint.texi b/gcc/cp/gxxint.texi
index cf9aaa9..84f0395 100644
--- a/gcc/cp/gxxint.texi
+++ b/gcc/cp/gxxint.texi
@@ -1578,6 +1578,11 @@ we are concerned here about a lower-level interface primarily
intended for methods written in Java, but that can also be used for C++
(and less easily C).
+Note that on systems that follow BSD tradition, a C identifier @code{var}
+would get "mangled" into the assembler name @samp{_var}. On such
+systems, all other mangled names are also prefixed by a @samp{_}
+which is not shown in the following examples.
+
@subsection Method name mangling
C++ mangles a method by emitting the function name, followed by @code{__},
@@ -1646,6 +1651,7 @@ entire mangled method name is followed by a @samp{U}.
For example, the method @code{X\u0319::M\u002B(int)} is encoded as
@samp{M_002b__U6X_0319iU}.
+
@subsection Pointer and reference types
A C++ pointer type is mangled as @samp{P} followed by the
@@ -1706,6 +1712,28 @@ as if it were the C++ type @code{JArray<T>}.
For example @code{java.lang.String[]} is encoded as
@samp{Pt6JArray1ZPQ34java4lang6String}.
+@subsection Static fields
+
+Both C++ and Java classes can have static fields.
+These are allocated statically, and are shared among all instances.
+
+The mangling starts with a prefix (@samp{_} in most systems), which is
+followed by the mangling
+of the class name, followed by the "joiner" and finally the field name.
+The joiner (see @code{JOINER} in @code{cp-tree.h}) is a special
+separator character. For historical reasons (and idiosyncracies
+of assembler syntax) it can @samp{$} or @samp{.} (or even
+@samp{_} on a few systems). If the joiner is @samp{_} then the prefix
+is @samp{__static_} instead of just @samp{_}.
+
+For example @code{Foo::Bar::var} (or @code{Foo.Bar.var} in Java syntax)
+would be encoded as @samp{_Q23Foo3Bar$var} or @samp{_Q23Foo3Bar.var}
+(or rarely @samp{__static_Q23Foo3Bar_var}).
+
+If the name of a static variable needs Unicode escapes,
+the Unicode indicator @samp{U} comes before the "joiner".
+This @code{\u1234Foo::var\u3445} becomes @code{_U8_1234FooU.var_3445}.
+
@subsection Table of demangling code characters
The following special characters are used in mangling:
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index 7dfcc1f..90d4280 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -846,6 +846,7 @@ init_lex ()
UNSET_RESERVED_WORD ("classof");
UNSET_RESERVED_WORD ("headof");
}
+
if (! flag_handle_signatures || flag_no_gnu_keywords)
{
/* Easiest way to not recognize signature
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index d01077c..e866e3c 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -205,7 +205,13 @@ get_tinfo_fn_dynamic (exp)
tree t;
if (! flag_rtti)
- warning ("taking dynamic typeid of object without -frtti");
+ {
+ warning ("taking dynamic typeid of object without -frtti");
+ push_obstacks (&permanent_obstack, &permanent_obstack);
+ init_rtti_processing ();
+ pop_obstacks ();
+ flag_rtti = 1;
+ }
/* If we don't have rtti stuff, get to a sub-object that does. */
if (! CLASSTYPE_VFIELDS (type))
@@ -387,6 +393,15 @@ get_typeid (type)
if (type == error_mark_node)
return error_mark_node;
+ if (! flag_rtti)
+ {
+ warning ("requesting typeid of object without -frtti");
+ push_obstacks (&permanent_obstack, &permanent_obstack);
+ init_rtti_processing ();
+ pop_obstacks ();
+ flag_rtti = 1;
+ }
+
if (processing_template_decl)
return build_min_nt (TYPEID_EXPR, type);