summaryrefslogtreecommitdiff
path: root/gcc/java/jcf-parse.c
diff options
context:
space:
mode:
authorapbianco <apbianco@138bc75d-0d04-0410-961f-82ee72b054a4>1999-04-21 13:49:49 +0000
committerapbianco <apbianco@138bc75d-0d04-0410-961f-82ee72b054a4>1999-04-21 13:49:49 +0000
commit53bd31b59a04dd78049c5bbc67c4d26f98c7653f (patch)
tree6a4397f5304c150cbe5d79eab70071c1fe5a446a /gcc/java/jcf-parse.c
parentbb5daf981dd9bf2a57d8bc80a238f5cf9d2922dd (diff)
downloadgcc-53bd31b59a04dd78049c5bbc67c4d26f98c7653f.tar.gz
Wed Apr 21 11:13:36 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* decl.c (predef_filenames, predef_filenames_size): New globals (init_decl_processing): predef_filenames and predef_filenames_size initialized. * java-tree.h (predef_filenames, predef_filenames_size): Declared extern. * jcf-parse.c (predefined_filename_p): New function. (yyparse): Check that files on the command line are specified only once and issue a warning otherwise. * parse.h (JPRIMITIVE_TYPE_OR_VOID_P): New macro. * parse.y (source_end_java_method): Nullify NOP method bodies, to avoid a gcc warning with -W -Wall turned on. (java_expand_classes): Abort if errors were encountered. (java_complete_lhs): If the cross reference flag is set, wrap field DECL node around a WFL when resolving expression name. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26578 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java/jcf-parse.c')
-rw-r--r--gcc/java/jcf-parse.c52
1 files changed, 49 insertions, 3 deletions
diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c
index 7b582299f7f..054c239ff72 100644
--- a/gcc/java/jcf-parse.c
+++ b/gcc/java/jcf-parse.c
@@ -761,6 +761,17 @@ parse_source_file (file)
java_parse_abort_on_error ();
}
+static int
+predefined_filename_p (node)
+ tree node;
+{
+ int i;
+ for (i = 0; i < predef_filenames_size; i++)
+ if (predef_filenames [i] == node)
+ return 1;
+ return 0;
+}
+
int
yyparse ()
{
@@ -780,6 +791,8 @@ yyparse ()
if (list[0])
{
char *value;
+ tree id;
+ int twice = 0;
int len = strlen (list);
/* FIXME: this test is only needed until our .java parser is
@@ -792,9 +805,42 @@ yyparse ()
obstack_grow0 (&temporary_obstack, list, len);
value = obstack_finish (&temporary_obstack);
- node = get_identifier (value);
- IS_A_COMMAND_LINE_FILENAME_P (node) = 1;
- current_file_list = tree_cons (NULL_TREE, node, current_file_list);
+
+ /* Exclude file that we see twice on the command line. For
+ all files except {Class,Error,Object,RuntimeException,String,
+ Throwable}.java we can rely on maybe_get_identifier. For
+ these files, we need to do a linear search of
+ current_file_list. This search happens only for these
+ files, presumably only when we're recompiling libgcj. */
+
+ if ((id = maybe_get_identifier (value)))
+ {
+ if (predefined_filename_p (id))
+ {
+ tree c;
+ for (c = current_file_list; c; c = TREE_CHAIN (c))
+ if (TREE_VALUE (c) == id)
+ twice = 1;
+ }
+ else
+ twice = 1;
+ }
+
+ if (twice)
+ {
+ char *saved_input_filename = input_filename;
+ input_filename = value;
+ warning ("source file seen twice on command line and will be "
+ "compiled only once.");
+ input_filename = saved_input_filename;
+ }
+ else
+ {
+ node = get_identifier (value);
+ IS_A_COMMAND_LINE_FILENAME_P (node) = 1;
+ current_file_list = tree_cons (NULL_TREE, node,
+ current_file_list);
+ }
}
list = next;
}