diff options
author | Alexandre Petit-Bianco <apbianco@cygnus.com> | 1998-12-01 14:28:02 +0000 |
---|---|---|
committer | Alexandre Petit-Bianco <apbianco@gcc.gnu.org> | 1998-12-01 06:28:02 -0800 |
commit | 82371d41c2e0a1e8c68c43748a71bb9deec0ed1a (patch) | |
tree | 009299b3815a338dbba35958d0320cfdada1c86f /gcc/java/lex.c | |
parent | df3ba30ac3667b0ff00d7ae8aa29ffad2d1c68d4 (diff) | |
download | gcc-82371d41c2e0a1e8c68c43748a71bb9deec0ed1a.zip gcc-82371d41c2e0a1e8c68c43748a71bb9deec0ed1a.tar.gz gcc-82371d41c2e0a1e8c68c43748a71bb9deec0ed1a.tar.bz2 |
class.c (layout_class_method): Don't report error on non-static overriding static if the method is private.
Tue Dec 1 13:53:24 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
* class.c (layout_class_method): Don't report error on non-static
overriding static if the method is private.
* java-tree.h (finish_class): Prototype added.
* lex.c (java_get_line_col): Handle col argument -2 value.
* parse.h: All static method declarations moved to parse.y.
* parse.y: Now contains all static method declarations previously
found in parse.h.
(find_expr_with_wfl, missing_return_error,
unreachable_stmt_error): New functions.
(java_get_real_method_name): Identify constructors bearing class
names in source code compiled classes only.
(java_complete_expand_methods): Call missing_return_error.
(invocation_mode): Private methods invoked as static methods.
(java_complete_tree): Call unreachable_stmt_error.
This patch corrects the way unreachable statement and missing return
statement errors are reported. It also fixes random bugs.
From-SVN: r24036
Diffstat (limited to 'gcc/java/lex.c')
-rw-r--r-- | gcc/java/lex.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/gcc/java/lex.c b/gcc/java/lex.c index 946e574..e645b40 100644 --- a/gcc/java/lex.c +++ b/gcc/java/lex.c @@ -1315,11 +1315,14 @@ java_get_line_col (filename, line, col) /* Dumb implementation. Doesn't try to cache or optimize things. */ /* First line of the file is line 1, first column is 1 */ - /* COL <= 0 means, at the CR/LF in LINE */ + /* COL == -1 means, at the CR/LF in LINE */ + /* COL == -2 means, at the first non space char in LINE */ FILE *fp; int c, ccol, cline = 1; int current_line_col = 0; + int first_non_space = 0; + char *base; if (!(fp = fopen (filename, "r"))) fatal ("Can't open file - java_display_line_col"); @@ -1343,6 +1346,8 @@ java_get_line_col (filename, line, col) c = getc (fp); if (c < 0 || java_is_eol (fp, c)) break; + if (!first_non_space && !JAVA_WHITE_SPACE_P (c)) + first_non_space = current_line_col; obstack_1grow (&temporary_obstack, c); current_line_col++; } @@ -1350,12 +1355,25 @@ java_get_line_col (filename, line, col) obstack_1grow (&temporary_obstack, '\n'); - if (col < 0) - col = current_line_col; + if (col == -1) + { + col = current_line_col; + first_non_space = 0; + } + else if (col == -2) + col = first_non_space; + else + first_non_space = 0; /* Place the '^' a the right position */ + base = obstack_base (&temporary_obstack); for (ccol = 1; ccol <= col; ccol++) - obstack_1grow (&temporary_obstack, ' '); + { + /* Compute \t when reaching first_non_space */ + char c = (first_non_space ? + (base [ccol-1] == '\t' ? '\t' : ' ') : ' '); + obstack_1grow (&temporary_obstack, c); + } obstack_grow0 (&temporary_obstack, "^", 1); fclose (fp); |