aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>2005-02-12 06:12:40 +0000
committerPer Bothner <per@bothner.com>2005-02-12 06:12:40 +0000
commit6a1f1cf0acfde2cfe13a5e90e19abce0afa0d1c4 (patch)
tree8d7d8e61dc84237fee9ab7693129f6afe61f17c6
parent6dec5a45b38a818a28a4d94ff0d9bc077581bd99 (diff)
PR java/15543
* parse-scan.y (input_location): Remove variable. (main_input_filename): New - replaces input_filename, which isn't settable if USE_MAPPED_LOCATION. * lex.c (java_init_lex): Wrap some more places in #ifndef JC1-LITE, so we don't reference input_location or wfl_operator in that case. * jv-scan.c (expand_location): Remove - no longer used. (main): Set main_input_filename rather than input_filename. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@94928 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/java/ChangeLog11
-rw-r--r--gcc/java/jv-scan.c26
-rw-r--r--gcc/java/lex.c10
-rw-r--r--gcc/java/parse-scan.y11
4 files changed, 23 insertions, 35 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index a24d4a49037..a1002f15b31 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,14 @@
+2005-02-11 Per Bothner <per@bothner.com>
+
+ PR java/15543
+ * parse-scan.y (input_location): Remove variable.
+ (main_input_filename): New - replaces input_filename, which isn't
+ settable if USE_MAPPED_LOCATION.
+ * lex.c (java_init_lex): Wrap some more places in #ifndef JC1-LITE,
+ so we don't reference input_location or wfl_operator in that case.
+ * jv-scan.c (expand_location): Remove - no longer used.
+ (main): Set main_input_filename rather than input_filename.
+
2005-02-09 Richard Henderson <rth@redhat.com>
* builtins.c (initialize_builtins): Call build_common_builtin_nodes.
diff --git a/gcc/java/jv-scan.c b/gcc/java/jv-scan.c
index 5f90ee93392..b7b8809b117 100644
--- a/gcc/java/jv-scan.c
+++ b/gcc/java/jv-scan.c
@@ -131,29 +131,6 @@ version (void)
exit (0);
}
-#ifdef USE_MAPPED_LOCATION
-/* FIXME - this is the same as the function in tree.c, which is awkward.
- Probably the cleanest solution is to move the function to line-map.c.
- This is difficult as long as we still support --disable-mapped-location,
- since whether expanded_location has a column fields depends on
- USE_MAPPED_LOCATION. */
-
-expanded_location
-expand_location (source_location loc)
-{
- expanded_location xloc;
- if (loc == 0) { xloc.file = NULL; xloc.line = 0; xloc.column = 0; }
- else
- {
- const struct line_map *map = linemap_lookup (&line_table, loc);
- xloc.file = map->to_file;
- xloc.line = SOURCE_LINE (map, loc);
- xloc.column = SOURCE_COLUMN (map, loc);
- };
- return xloc;
-}
-#endif
-
/* jc1-lite main entry point */
int
main (int argc, char **argv)
@@ -237,8 +214,7 @@ main (int argc, char **argv)
if (encoding == NULL || *encoding == '\0')
encoding = DEFAULT_ENCODING;
- input_filename = filename;
- input_line = 0;
+ main_input_filename = filename;
java_init_lex (finput, encoding);
ctxp->filename = filename;
yyparse ();
diff --git a/gcc/java/lex.c b/gcc/java/lex.c
index 712ffc2c589..d0a8f93e495 100644
--- a/gcc/java/lex.c
+++ b/gcc/java/lex.c
@@ -108,11 +108,13 @@ java_init_lex (FILE *finput, const char *encoding)
if (!wfl_operator)
{
+#ifndef JC1_LITE
#ifdef USE_MAPPED_LOCATION
wfl_operator = build_expr_wfl (NULL_TREE, input_location);
#else
wfl_operator = build_expr_wfl (NULL_TREE, ctxp->filename, 0, 0);
#endif
+#endif
}
if (!label_id)
label_id = get_identifier ("$L");
@@ -134,7 +136,9 @@ java_init_lex (FILE *finput, const char *encoding)
ctxp->package = NULL_TREE;
#endif
+#ifndef JC1_LITE
ctxp->save_location = input_location;
+#endif
ctxp->java_error_flag = 0;
ctxp->lexer = java_new_lexer (finput, encoding);
}
@@ -1471,7 +1475,6 @@ do_java_lex (YYSTYPE *java_lval)
#ifndef JC1_LITE
java_lval->operator.token = OCB_TK;
java_lval->operator.location = BUILD_LOCATION();
-#endif
#ifdef USE_MAPPED_LOCATION
if (ctxp->ccb_indent == 1)
ctxp->first_ccb_indent1 = input_location;
@@ -1479,14 +1482,14 @@ do_java_lex (YYSTYPE *java_lval)
if (ctxp->ccb_indent == 1)
ctxp->first_ccb_indent1 = input_line;
#endif
+#endif
ctxp->ccb_indent++;
return OCB_TK;
case '}':
+ ctxp->ccb_indent--;
#ifndef JC1_LITE
java_lval->operator.token = CCB_TK;
java_lval->operator.location = BUILD_LOCATION();
-#endif
- ctxp->ccb_indent--;
#ifdef USE_MAPPED_LOCATION
if (ctxp->ccb_indent == 1)
ctxp->last_ccb_indent1 = input_location;
@@ -1494,6 +1497,7 @@ do_java_lex (YYSTYPE *java_lval)
if (ctxp->ccb_indent == 1)
ctxp->last_ccb_indent1 = input_line;
#endif
+#endif
return CCB_TK;
case '[':
BUILD_OPERATOR (OSB_TK);
diff --git a/gcc/java/parse-scan.y b/gcc/java/parse-scan.y
index 189ee728e12..2e020c800e1 100644
--- a/gcc/java/parse-scan.y
+++ b/gcc/java/parse-scan.y
@@ -42,15 +42,12 @@ definitions and other extensions. */
#include "system.h"
#include "coretypes.h"
#include "tm.h"
-#include "input.h"
#include "obstack.h"
#include "toplev.h"
extern FILE *finput, *out;
-/* Current position in real source file. */
-
-location_t input_location;
+ const char *main_input_filename;
/* Obstack for the lexer. */
struct obstack temporary_obstack;
@@ -1295,7 +1292,7 @@ report_class_declaration (const char * name)
if (!previous_output)
{
if (flag_list_filename)
- fprintf (out, "%s: ", input_filename);
+ fprintf (out, "%s: ", main_input_filename);
previous_output = 1;
}
@@ -1340,7 +1337,7 @@ report (void)
{
extern int flag_complexity;
if (flag_complexity)
- fprintf (out, "%s %d\n", input_filename, complexity);
+ fprintf (out, "%s %d\n", main_input_filename, complexity);
}
/* Reset global status used by the report functions. */
@@ -1357,7 +1354,7 @@ reset_report (void)
void
yyerror (const char *msg ATTRIBUTE_UNUSED)
{
- fprintf (stderr, "%s: %d: %s\n", input_filename, input_line, msg);
+ fprintf (stderr, "%s: %s\n", main_input_filename, msg);
exit (1);
}