This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Fixes to java/3248, java/2603, java/1970, java/2953 and java/1391.



This fixes a couple of PRs:

  http://gcc.gnu.org/ml/java-prs/2001-q2/msg00096.html
  http://gcc.gnu.org/ml/java-prs/2001-q2/msg00011.html
  http://gcc.gnu.org/ml/java-prs/2001-q1/msg00037.html
  http://gcc.gnu.org/ml/java-prs/2001-q2/msg00037.html  
  http://gcc.gnu.org/ml/java-prs/2000-q4/msg00073.html

It's been tested, I'm checking this in.

./A

2001-07-10  Alexandre Petit-Bianco  <apbianco@redhat.com>

	* lang-specs.h: Forbit the use if `-femit-class-file{s}' without
	`-fsyntax-only.' Fixes PR java/3248

2001-07-10  Alexandre Petit-Bianco  <apbianco@redhat.com>

	* jcf-io.c (find_class): Clarified error message. Fixes PR java/2603

2001-07-10  Alexandre Petit-Bianco  <apbianco@redhat.com>

	* parse.h (INNER_ENCLOSING_SCOPE_CHECK): No `this' is fine if the
	current function is static. Fixes PR java/1970

2001-07-09  Alexandre Petit-Bianco  <apbianco@redhat.com>

	* parse.y (patch_method_invocation): Add enclosing context to ctor
	calls if necessary. Fixes PR java/2953

2001-07-09  Alexandre Petit-Bianco  <apbianco@redhat.com>

	* parse.y (resolve_package): Abort if qualified expression member
	isn't right.
	(qualify_ambiguous_name): Don't qualify as type if `this' in use.
	Fixes PR java/1391

Index: jcf-io.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-io.c,v
retrieving revision 1.29
diff -u -p -r1.29 jcf-io.c
--- jcf-io.c	2001/04/29 11:24:37	1.29
+++ jcf-io.c	2001/07/11 05:57:16
@@ -405,16 +405,8 @@ DEFUN(find_class, (classname, classname_
      up no matter what. FIXME. */
   if (! java && ! class && java_buf.st_mtime > class_buf.st_mtime)
     {
-      char *stripped_class_name = xstrdup (classname);
-      int i = strlen (stripped_class_name);
-      
-      while (stripped_class_name [i] != '.')
-	i--;
-      
-      stripped_class_name [i] = '\0';
       if (flag_newer)
-	warning ("Source file for class `%s' is newer than its matching class file. Source file used instead", stripped_class_name);
-      free (stripped_class_name);
+	warning ("Source file for class `%s' is newer than its matching class file. Source file `%s' used instead", classname, java_buffer);
       class = -1;
     }
 
Index: lang-specs.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/lang-specs.h,v
retrieving revision 1.19
diff -u -p -r1.19 lang-specs.h
--- lang-specs.h	2001/03/02 01:03:47	1.19
+++ lang-specs.h	2001/07/11 05:57:16
@@ -1,5 +1,5 @@
 /* Definitions for specs for the GNU compiler for the Java(TM) language.
-   Copyright (C) 1996, 1998, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -32,6 +32,8 @@ The Free Software Foundation is independ
   {"@java",
    "%{fjni:%{femit-class-files:%e-fjni and -femit-class-files are incompatible}}\
     %{fjni:%{femit-class-file:%e-fjni and -femit-class-file are incompatible}}\
+    %{femit-class-file:%{!fsyntax-only:%e-femit-class-file should used along with -fsyntax-only}}\
+    %{femit-class-files:%{!fsyntax-only:%e-femit-class-file should used along with -fsyntax-only}}\
     %{!E:jc1 %i %(jc1) %(cc1_options) %{+e*} %{I*}\
              %{MD} %{MMD} %{M} %{MM} %{MA} %{MT*} %{MF*}\
              %{!fsyntax-only:%(invoke_as)}}", 0},
Index: parse.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.h,v
retrieving revision 1.73
diff -u -p -r1.73 parse.h
--- parse.h	2001/05/26 01:31:47	1.73
+++ parse.h	2001/07/11 05:57:19
@@ -844,8 +844,11 @@ struct parser_ctxt {
 	      (TREE_TYPE (DECL_CONTEXT                                        \
 			  (TYPE_NAME (TREE_TYPE (TREE_TYPE (current_this))))),\
 	       TREE_TYPE (DECL_CONTEXT (TYPE_NAME (T)))))                     \
-       /* We don't have a this. */					      \
-       || !current_this))
+       /* We don't have a this, which is OK if the current function is        \
+	  static. */                                                          \
+       || (!current_this						      \
+	   && current_function_decl                                           \
+           && ! METHOD_STATIC (current_function_decl))))
 
 /* Push macro. First argument to PUSH_CPC is a DECL_TYPE, second
    argument is the unqualified currently parsed class name.  */
Index: parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.293
diff -u -p -r1.293 parse.y
--- parse.y	2001/07/05 22:33:44	1.293
+++ parse.y	2001/07/11 05:57:54
@@ -6818,6 +6818,10 @@ resolve_package (pkg, next)
     for (acc = NULL_TREE, current = EXPR_WFL_QUALIFICATION (pkg); 
 	 current; current = TREE_CHAIN (current))
       {
+	/* If we don't have what we're expecting, exit now. TYPE_NAME
+	   will be null and the error caught later. */
+	if (TREE_CODE (QUAL_WFL (current)) != EXPR_WITH_FILE_LOCATION)
+	  break;
 	acc = merge_qualified_name (acc, EXPR_WFL_NODE (QUAL_WFL (current)));
 	if ((type_name = resolve_no_layout (acc, NULL_TREE)))
 	  {
@@ -10120,7 +10124,9 @@ patch_method_invocation (patch, primary,
      to have an enclosing context passed as a second parameter (the
      constructor is one of an inner class. We extract it from the
      current function.  */
-  if (is_super_init && PURE_INNER_CLASS_TYPE_P (DECL_CONTEXT (list)))
+  if ((is_super_init || 
+       (TREE_CODE (patch) == CALL_EXPR && name == this_identifier_node))
+      && PURE_INNER_CLASS_TYPE_P (DECL_CONTEXT (list)))
     {
       tree enclosing_decl = DECL_CONTEXT (TYPE_NAME (current_class));
       tree extra_arg;
@@ -10986,9 +10992,12 @@ qualify_ambiguous_name (id)
        of the compilation unit containing NAME,
      - NAME is declared by exactly on type-import-on-demand declaration
      of the compilation unit containing NAME. 
-     - NAME is actually a STRING_CST. */
-  else if (TREE_CODE (name) == STRING_CST || TREE_CODE (name) == INTEGER_CST
-	   || (decl = resolve_and_layout (name, NULL_TREE)))
+     - NAME is actually a STRING_CST.
+     This can't happen if the expression was qualified by `this.' */
+  else if (! this_found &&
+	   (TREE_CODE (name) == STRING_CST ||
+	    TREE_CODE (name) == INTEGER_CST ||
+	    (decl = resolve_and_layout (name, NULL_TREE))))
     {
       RESOLVE_TYPE_NAME_P (qual_wfl) = 1;
       QUAL_RESOLUTION (qual) = decl;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]