Commit 8b1edcee by Per Bothner Committed by Per Bothner

jvspec.c (lang_specific_driver): Check for .zip and .jar files.


	* jvspec.c (lang_specific_driver):  Check for .zip and .jar files.
	Add constructed filelist-file at end, following -xjava.  Thus any .o
	and library files are not affected by the -xjava.  Also wrap
	explicut @FILE with -xjava and -xnone.

From-SVN: r40621
parent 6bc5f6cb
2001-03-19 Per Bothner <per@bothner.com>
* jvspec.c (lang_specific_driver): Check for .zip and .jar files.
Add constructed filelist-file at end, following -xjava. Thus any .o
and library files are not affected by the -xjava. Also wrap
explicut @FILE with -xjava and -xnone.
2001-03-19 Andrew Haley <aph@cambridge.redhat.com> 2001-03-19 Andrew Haley <aph@cambridge.redhat.com>
* class.c (build_static_field_ref): Call make_decl_rtl() after * class.c (build_static_field_ref): Call make_decl_rtl() after
...@@ -29,10 +36,10 @@ ...@@ -29,10 +36,10 @@
* parse.h (BLOCK_EXPR_ORIGIN): Removed macro. * parse.h (BLOCK_EXPR_ORIGIN): Removed macro.
* parse.y (declare_local_variables, maybe_absorb_scoping_blocks): * parse.y (declare_local_variables, maybe_absorb_scoping_blocks):
Use BLOCK_IS_IMPLICIT rather than BLOCK_EXPR_ORIGIN. Use BLOCK_IS_IMPLICIT rather than BLOCK_EXPR_ORIGIN.
* jcf-parse.c (yyparse): Set/reset input_filename for source file. * jcf-parse.c (yyparse): Set/reset input_filename for source file.
* parse.y (java_expand_classes): Likewise. * parse.y (java_expand_classes): Likewise.
* parse.y (expand_start_java_method): Was only called once and had a * parse.y (expand_start_java_method): Was only called once and had a
misleading name, so inline in caller java_complete_expand_method. misleading name, so inline in caller java_complete_expand_method.
(enter_a_block): Likewise inline in enter_block and remove. (enter_a_block): Likewise inline in enter_block and remove.
...@@ -68,7 +75,7 @@ ...@@ -68,7 +75,7 @@
(get_dispatch_table): Likewise. (get_dispatch_table): Likewise.
* decl.c (push_jvm_slot): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc. * decl.c (push_jvm_slot): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
2001-03-07 Tom Tromey <tromey@redhat.com> 2001-03-07 Tom Tromey <tromey@redhat.com>
* config-lang.in (lang_requires): Define. * config-lang.in (lang_requires): Define.
......
...@@ -38,8 +38,10 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ ...@@ -38,8 +38,10 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#define JAVA_FILE_ARG (1<<3) #define JAVA_FILE_ARG (1<<3)
/* True if this arg is a .class input file name. */ /* True if this arg is a .class input file name. */
#define CLASS_FILE_ARG (1<<4) #define CLASS_FILE_ARG (1<<4)
/* True if this arg is a .zip or .jar input file name. */
#define ZIP_FILE_ARG (1<<5)
/* True if this arg is @FILE - where FILE contains a list of filenames. */ /* True if this arg is @FILE - where FILE contains a list of filenames. */
#define INDIRECT_FILE_ARG (1<<5) #define INDIRECT_FILE_ARG (1<<6)
static char *find_spec_file PARAMS ((const char *)); static char *find_spec_file PARAMS ((const char *));
...@@ -117,21 +119,18 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) ...@@ -117,21 +119,18 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
/* Number of .java and .class source file arguments seen. */ /* Number of .java and .class source file arguments seen. */
int java_files_count = 0; int java_files_count = 0;
int class_files_count = 0; int class_files_count = 0;
/* Number of .zip or .jar file arguments seen. */
int zip_files_count = 0;
/* Number of '@FILES' arguments seen. */ /* Number of '@FILES' arguments seen. */
int indirect_files_count = 0; int indirect_files_count = 0;
/* Cumulative length of the .java and .class source file names. */
int java_files_length = 0;
int class_files_length = 0;
/* Name of file containing list of files to compile. */ /* Name of file containing list of files to compile. */
char *filelist_filename; char *filelist_filename;
FILE *filelist_file; FILE *filelist_file;
/* The number of arguments being added to what's in argv, other than /* The number of arguments being added to what's in argv, other than
libraries. We use this to track the number of times we've inserted libraries. */
-xc++/-xnone. */
int added = 2; int added = 2;
/* Used to track options that take arguments, so we don't go wrapping /* Used to track options that take arguments, so we don't go wrapping
...@@ -327,6 +326,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) ...@@ -327,6 +326,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
{ {
args[i] |= INDIRECT_FILE_ARG; args[i] |= INDIRECT_FILE_ARG;
indirect_files_count++; indirect_files_count++;
added += 2; /* for -xjava and -xnone */
} }
len = strlen (argv[i]); len = strlen (argv[i]);
...@@ -334,14 +334,20 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) ...@@ -334,14 +334,20 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
{ {
args[i] |= JAVA_FILE_ARG; args[i] |= JAVA_FILE_ARG;
java_files_count++; java_files_count++;
java_files_length += len;
last_input_index = i; last_input_index = i;
} }
if (len > 6 && strcmp (argv[i] + len - 6, ".class") == 0) if (len > 6 && strcmp (argv[i] + len - 6, ".class") == 0)
{ {
args[i] |= CLASS_FILE_ARG; args[i] |= CLASS_FILE_ARG;
class_files_count++; class_files_count++;
class_files_length += len; last_input_index = i;
}
if (len > 4
&& (strcmp (argv[i] + len - 4, ".zip") == 0
|| strcmp (argv[i] + len - 4, ".jar") == 0))
{
args[i] |= ZIP_FILE_ARG;
zip_files_count++;
last_input_index = i; last_input_index = i;
} }
} }
...@@ -357,20 +363,21 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) ...@@ -357,20 +363,21 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
if (saw_C) if (saw_C)
{ {
num_args += 3; num_args += 3;
if (class_files_count > 0) if (class_files_count + zip_files_count > 0)
{ {
error ("Warning: already-compiled .class files ignored with -C"); error ("Warning: already-compiled .class files ignored with -C");
num_args -= class_files_count + zip_files_count;
class_files_count = 0; class_files_count = 0;
num_args -= class_files_count; zip_files_count = 0;
} }
num_args += 2; /* For -o NONE. */ num_args += 2; /* For -o NONE. */
if (saw_o) if (saw_o)
fatal ("cannot specify both -C and -o"); fatal ("cannot specify both -C and -o");
} }
if ((saw_o && java_files_count + class_files_count > 1) if ((saw_o && java_files_count + class_files_count + zip_files_count > 1)
|| (saw_C && java_files_count > 1)) || (saw_C && java_files_count > 1)
combine_inputs = 1; || (indirect_files_count > 0
if (class_files_count > 1) && java_files_count + class_files_count + zip_files_count > 0))
combine_inputs = 1; combine_inputs = 1;
if (combine_inputs) if (combine_inputs)
...@@ -382,8 +389,8 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) ...@@ -382,8 +389,8 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
filelist_file = fopen (filelist_filename, "w"); filelist_file = fopen (filelist_filename, "w");
if (filelist_file == NULL) if (filelist_file == NULL)
pfatal_with_name (filelist_filename); pfatal_with_name (filelist_filename);
num_args -= java_files_count + class_files_count; num_args -= java_files_count + class_files_count + zip_files_count;
num_args++; /* Add one for the combined arg. */ num_args += 2; /* for the combined arg and "-xjava" */
} }
/* If we know we don't have to do anything, bail now. */ /* If we know we don't have to do anything, bail now. */
#if 0 #if 0
...@@ -403,7 +410,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) ...@@ -403,7 +410,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
num_args++; num_args++;
if (combine_inputs || indirect_files_count > 0) if (combine_inputs || indirect_files_count > 0)
num_args += 2; num_args += 1; /* for "-ffilelist-file" */
if (combine_inputs && indirect_files_count > 0) if (combine_inputs && indirect_files_count > 0)
fatal("using both @FILE with multiple files not implemented"); fatal("using both @FILE with multiple files not implemented");
...@@ -420,12 +427,6 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) ...@@ -420,12 +427,6 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
for (i = 0; i < argc; i++, j++) for (i = 0; i < argc; i++, j++)
{ {
if (i == 1 && (combine_inputs || indirect_files_count > 0))
{
arglist[j++] = "-ffilelist-file";
arglist[j++] = "-xjava";
}
arglist[j] = argv[i]; arglist[j] = argv[i];
if ((args[i] & PARAM_ARG) || i == 0) if ((args[i] & PARAM_ARG) || i == 0)
...@@ -465,16 +466,19 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) ...@@ -465,16 +466,19 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
if ((args[i] & INDIRECT_FILE_ARG) != 0) if ((args[i] & INDIRECT_FILE_ARG) != 0)
{ {
arglist[j] = argv[i]+1; /* Drop '@'. */ arglist[j++] = "-xjava";
arglist[j++] = argv[i]+1; /* Drop '@'. */
arglist[j] = "-xnone";
} }
if ((args[i] & CLASS_FILE_ARG) && saw_C) if ((args[i] & (CLASS_FILE_ARG|ZIP_FILE_ARG)) && saw_C)
{ {
--j; --j;
continue; continue;
} }
if (combine_inputs && (args[i] & (CLASS_FILE_ARG|JAVA_FILE_ARG)) != 0) if (combine_inputs
&& (args[i] & (CLASS_FILE_ARG|JAVA_FILE_ARG|ZIP_FILE_ARG)) != 0)
{ {
fputs (argv[i], filelist_file); fputs (argv[i], filelist_file);
fputc ('\n', filelist_file); fputc ('\n', filelist_file);
...@@ -483,10 +487,14 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) ...@@ -483,10 +487,14 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
} }
} }
if (combine_inputs || indirect_files_count > 0)
arglist[j++] = "-ffilelist-file";
if (combine_inputs) if (combine_inputs)
{ {
if (fclose (filelist_file)) if (fclose (filelist_file))
pfatal_with_name (filelist_filename); pfatal_with_name (filelist_filename);
arglist[j++] = "-xjava";
arglist[j++] = filelist_filename; arglist[j++] = filelist_filename;
} }
......
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