parse.y (process_imports): Save the original name of the import for better error...
authorAlexandre Petit-Bianco <apbianco@cygnus.com>
Mon, 5 Feb 2001 18:09:45 +0000 (18:09 +0000)
committerAlexandre Petit-Bianco <apbianco@gcc.gnu.org>
Mon, 5 Feb 2001 18:09:45 +0000 (10:09 -0800)
2001-02-05  Alexandre Petit-Bianco  <apbianco@cygnus.com>

        * parse.y (process_imports): Save the original name of the import
        for better error report.

(http://gcc.gnu.org/ml/gcc-patches/2001-02/msg00250.html)

From-SVN: r39461

gcc/java/ChangeLog
gcc/java/parse.y

index 7b22997d46d1f7c9f7c284e22911479e4bd523eb..23f5c307e194714669ba601ce707253b5365b031 100644 (file)
@@ -1,3 +1,8 @@
+2001-02-05  Alexandre Petit-Bianco  <apbianco@cygnus.com>
+
+       * parse.y (process_imports): Save the original name of the import
+       for better error report.
+
 2001-02-04  Bryce McKinlay  <bryce@albatross.co.nz>
 
        * Make-lang.in (jvspec.o): Add DRIVER_DEFINES to the list
index 33c868c22264280b17e029f7efbacb08b74f36f8..6ffa3357c77d5b32397996ef8204e02ff9329ac7 100644 (file)
@@ -6411,6 +6411,12 @@ process_imports ()
   for (import = ctxp->import_list; import; import = TREE_CHAIN (import))
     {
       tree to_be_found = EXPR_WFL_NODE (TREE_PURPOSE (import));
+      char *original_name;
+
+      obstack_grow0 (&temporary_obstack,
+                    IDENTIFIER_POINTER (to_be_found),
+                    IDENTIFIER_LENGTH (to_be_found));
+      original_name = obstack_finish (&temporary_obstack);
 
       /* Don't load twice something already defined. */
       if (IDENTIFIER_CLASS_VALUE (to_be_found))
@@ -6442,9 +6448,11 @@ process_imports ()
        {
          parse_error_context (TREE_PURPOSE (import),
                               "Class or interface `%s' not found in import",
-                              IDENTIFIER_POINTER (to_be_found));
-         return 1;
+                              original_name);
+         error_found = 1;
        }
+
+      obstack_free (&temporary_obstack, original_name);
       if (error_found)
        return 1;
     }