expr.c (build_jni_stub): Ensure storage for `meth' is generated.
authorTom Tromey <tromey@redhat.com>
Mon, 28 Jan 2002 16:52:27 +0000 (16:52 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Mon, 28 Jan 2002 16:52:27 +0000 (16:52 +0000)
* expr.c (build_jni_stub): Ensure storage for `meth' is
generated.
* parse.y (java_complete_expand_methods): Set
current_function_decl before building JNI stub.

From-SVN: r49286

gcc/java/ChangeLog
gcc/java/expr.c
gcc/java/parse.y

index 14274b19a9f7af063aa78bc499218999e9fbdcf9..8e434f25afd9d3e89caa77121d7f4d20e3a03e05 100644 (file)
@@ -1,3 +1,10 @@
+2002-01-28  Tom Tromey  <tromey@redhat.com>
+
+       * expr.c (build_jni_stub): Ensure storage for `meth' is
+       generated.
+       * parse.y (java_complete_expand_methods): Set
+       current_function_decl before building JNI stub.
+
 2002-01-26 Andreas Tobler <a.tobler@schweiz.ch>
        
        * gcc/java/builtins.c (sqrt_builtin): Use BUILT_IN_SQRT, not
index e3eaf3525514195606822d02676d4cb7f8ff4446..a7cb59efcc590f9a942d4d4183342712afcfee98 100644 (file)
@@ -2168,8 +2168,13 @@ build_jni_stub (method)
   TREE_PUBLIC (meth_var) = 0;
   DECL_EXTERNAL (meth_var) = 0;
   DECL_CONTEXT (meth_var) = method;
+  DECL_ARTIFICIAL (meth_var) = 1;
+  DECL_INITIAL (meth_var) = null_pointer_node;
+  TREE_USED (meth_var) = 1;
+  chainon (env_var, meth_var);
+  layout_decl (meth_var, 0);
   make_decl_rtl (meth_var, NULL);
-  meth_var = pushdecl_top_level (meth_var);
+  rest_of_decl_compilation (meth_var, NULL, 0, 0);
 
   /* One strange way that the front ends are different is that they
      store arguments differently.  */
index a75e3f97ecc859e4eacb0b1c660fc86505b0d308..8b33fadf85c0399e22985e341b3e0adf8502bbfd 100644 (file)
@@ -1,6 +1,6 @@
 /* Source code parsing and tree node generation for the GNU compiler
    for the Java(TM) language.
-   Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
    Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
 
 This file is part of GNU CC.
@@ -7723,7 +7723,9 @@ java_complete_expand_methods (class_decl)
 
       if (METHOD_NATIVE (decl))
        {
-         tree body = build_jni_stub (decl);
+         tree body;
+         current_function_decl = decl;
+         body = build_jni_stub (decl);
          BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (decl)) = body;
        }