Commit 7b45aab4 by Per Bothner Committed by Per Bothner

re PR java/15543 ("jv-scan --complexity" segfaults)


	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.

From-SVN: r94928
parent f4ddaddd
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.
......
......@@ -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 ();
......
......@@ -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);
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment