This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: fix for CLASSPATH/classpath switch behaviour
Bryce McKinlay <bryce@waitaki.otago.ac.nz> writes:
> Nic Ferrier wrote:
>
> >The current GCJ switches are incompatible with Sun's. This means it's
> >very difficult to write portable makefiles or to switch from Sun's
> >compiler to GCJ.
> >
> >The attached patch fixes the switching problem for the following
> >programs:
> >
> >- gcj
> >- jcf-dump
> >- gcjh
> >
> >The patch also fixes the GCJ texinfo manual.
> >
> >
> >+ printf (" --bootclasspath PATH Set path to find .class files including vm classes\n");
> >
>
> I suggest that this be changed to something like "Set path to find
> .class files, overriding built-in class path".
I tried that but it broke the line.
I've put it in and attached another diff so you can see what I mean.
>
> Otherwise, I don't have authority to approve compiler patches, but this
> patch looks like the right thing to do to me. Alex?
I couldn't work out whether this went to gcc-patches or not.
I hope it did.
Nic
? cp-switch.diff
? gcc/java/lang.c.diff
? libjava/file
? libjava/arg-handle.c
? libjava/arghandler
? libjava/is-it-true
Index: gcc/gcc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcc.c,v
retrieving revision 1.289
diff -u -r1.289 gcc.c
--- gcc.c 2002/02/02 18:56:35 1.289
+++ gcc.c 2002/02/12 17:08:01
@@ -907,7 +907,7 @@
{"--assemble", "-S", 0},
{"--assert", "-A", "a"},
{"--classpath", "-fclasspath=", "aj"},
- {"--CLASSPATH", "-fCLASSPATH=", "aj"},
+ {"--bootclasspath", "-fbootclasspath=", "aj"},
{"--comments", "-C", 0},
{"--compile", "-c", 0},
{"--debug", "-g", "oj"},
Index: gcc/java/gcj.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/gcj.texi,v
retrieving revision 1.21
diff -u -r1.21 gcj.texi
--- gcj.texi 2002/02/07 19:39:27 1.21
+++ gcj.texi 2002/02/12 17:08:14
@@ -141,7 +141,7 @@
@ignore
@c man begin SYNOPSIS gcj
gcj [@option{-I}@var{dir}@dots{}] [@option{-d} @var{dir}@dots{}]
- [@option{--classpath}=@var{path}] [@option{--CLASSPATH}=@var{path}]
+ [@option{--bootclasspath}=@var{path}] [@option{--classpath}=@var{path}]
[@option{-f}@var{option}@dots{}] [@option{--encoding}=@var{name}]
[@option{--main}=@var{classname}] [@option{-D}@var{name}[=@var{value}]@dots{}]
[@option{-C}] [@option{-R} @var{resource-name}] [@option{-d} @var{directory}]
@@ -240,11 +240,11 @@
always using @code{-I} instead of the other options for manipulating the
class path.
-@item --classpath=@var{path}
+@item --bootclasspath=@var{path}
This sets the class path to @var{path}, a colon-separated list of paths
(on Windows-based systems, a semicolon-separate list of paths).
-@item --CLASSPATH=@var{path}
+@item --classpath=@var{path}
This sets the class path to @var{path}, a colon-separated list of paths
(on Windows-based systems, a semicolon-separate list of paths). This
differs from the @code{--classpath} option in that it does not suppress
@@ -261,17 +261,18 @@
First come all directories specified via @code{-I}.
@item
-If @code{--classpath} is specified, its value is appended and processing
-stops. That is, @code{--classpath} suppresses all the options mentioned
+If @option{--bootclasspath} is specified, its value is appended and processing
+stops. That is, @option{--bootclasspath} suppresses all the options mentioned
later in this list.
@item
-If @code{--CLASSPATH} is specified, its value is appended and the
+If @option{--classpath} is specified, its value is appended and the
@code{CLASSPATH} environment variable is suppressed.
@item
If the @code{CLASSPATH} environment variable is specified (and was not
-suppressed by @code{--CLASSPATH}), then its value is appended.
+suppressed by @option{--classpath} or @option{--bootclasspath}), then its
+value is appended.
@item
Finally, the built-in system directory, @file{libgcj.jar}, is appended.
Index: gcc/java/gjavah.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/gjavah.c,v
retrieving revision 1.83
diff -u -r1.83 gjavah.c
--- gjavah.c 2002/01/31 19:36:25 1.83
+++ gjavah.c 2002/02/12 17:08:18
@@ -2101,41 +2101,41 @@
/* This is used to mark options with no short value. */
#define LONG_OPT(Num) ((Num) + 128)
-#define OPT_classpath LONG_OPT (0)
-#define OPT_CLASSPATH LONG_OPT (1)
-#define OPT_HELP LONG_OPT (2)
-#define OPT_TEMP LONG_OPT (3)
-#define OPT_VERSION LONG_OPT (4)
-#define OPT_PREPEND LONG_OPT (5)
-#define OPT_FRIEND LONG_OPT (6)
-#define OPT_ADD LONG_OPT (7)
-#define OPT_APPEND LONG_OPT (8)
-#define OPT_M LONG_OPT (9)
-#define OPT_MM LONG_OPT (10)
-#define OPT_MG LONG_OPT (11)
-#define OPT_MD LONG_OPT (12)
-#define OPT_MMD LONG_OPT (13)
+#define OPT_classpath LONG_OPT (0)
+#define OPT_bootclasspath LONG_OPT (1)
+#define OPT_HELP LONG_OPT (2)
+#define OPT_TEMP LONG_OPT (3)
+#define OPT_VERSION LONG_OPT (4)
+#define OPT_PREPEND LONG_OPT (5)
+#define OPT_FRIEND LONG_OPT (6)
+#define OPT_ADD LONG_OPT (7)
+#define OPT_APPEND LONG_OPT (8)
+#define OPT_M LONG_OPT (9)
+#define OPT_MM LONG_OPT (10)
+#define OPT_MG LONG_OPT (11)
+#define OPT_MD LONG_OPT (12)
+#define OPT_MMD LONG_OPT (13)
static const struct option options[] =
{
- { "classpath", required_argument, NULL, OPT_classpath },
- { "CLASSPATH", required_argument, NULL, OPT_CLASSPATH },
- { "help", no_argument, NULL, OPT_HELP },
- { "stubs", no_argument, &stubs, 1 },
- { "td", required_argument, NULL, OPT_TEMP },
- { "verbose", no_argument, NULL, 'v' },
- { "version", no_argument, NULL, OPT_VERSION },
- { "prepend", required_argument, NULL, OPT_PREPEND },
- { "friend", required_argument, NULL, OPT_FRIEND },
- { "add", required_argument, NULL, OPT_ADD },
- { "append", required_argument, NULL, OPT_APPEND },
- { "M", no_argument, NULL, OPT_M },
- { "MM", no_argument, NULL, OPT_MM },
- { "MG", no_argument, NULL, OPT_MG },
- { "MD", no_argument, NULL, OPT_MD },
- { "MMD", no_argument, NULL, OPT_MMD },
- { "jni", no_argument, &flag_jni, 1 },
- { NULL, no_argument, NULL, 0 }
+ { "classpath", required_argument, NULL, OPT_classpath },
+ { "bootclasspath", required_argument, NULL, OPT_bootclasspath },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "stubs", no_argument, &stubs, 1 },
+ { "td", required_argument, NULL, OPT_TEMP },
+ { "verbose", no_argument, NULL, 'v' },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { "prepend", required_argument, NULL, OPT_PREPEND },
+ { "friend", required_argument, NULL, OPT_FRIEND },
+ { "add", required_argument, NULL, OPT_ADD },
+ { "append", required_argument, NULL, OPT_APPEND },
+ { "M", no_argument, NULL, OPT_M },
+ { "MM", no_argument, NULL, OPT_MM },
+ { "MG", no_argument, NULL, OPT_MG },
+ { "MD", no_argument, NULL, OPT_MD },
+ { "MMD", no_argument, NULL, OPT_MMD },
+ { "jni", no_argument, &flag_jni, 1 },
+ { NULL, no_argument, NULL, 0 }
};
static void
@@ -2158,8 +2158,9 @@
printf (" -friend TEXT Insert TEXT as `friend' declaration\n");
printf (" -prepend TEXT Insert TEXT before start of class\n");
printf ("\n");
+ printf (" --bootclasspath PATH Set path to find .class files, overriding\n\
+ built-in class path\n");
printf (" --classpath PATH Set path to find .class files\n");
- printf (" --CLASSPATH PATH Set path to find .class files\n");
printf (" -IDIR Append directory to class path\n");
printf (" -d DIRECTORY Set output directory name\n");
printf (" -o FILE Set output file name\n");
@@ -2240,8 +2241,8 @@
jcf_path_classpath_arg (optarg);
break;
- case OPT_CLASSPATH:
- jcf_path_CLASSPATH_arg (optarg);
+ case OPT_bootclasspath:
+ jcf_path_bootclasspath_arg (optarg);
break;
case OPT_HELP:
Index: gcc/java/jcf-dump.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-dump.c,v
retrieving revision 1.40
diff -u -r1.40 jcf-dump.c
--- jcf-dump.c 2002/01/31 19:36:25 1.40
+++ jcf-dump.c 2002/02/12 17:08:21
@@ -772,22 +772,22 @@
/* This is used to mark options with no short value. */
#define LONG_OPT(Num) ((Num) + 128)
-#define OPT_classpath LONG_OPT (0)
-#define OPT_CLASSPATH LONG_OPT (1)
-#define OPT_HELP LONG_OPT (2)
-#define OPT_VERSION LONG_OPT (3)
-#define OPT_JAVAP LONG_OPT (4)
+#define OPT_classpath LONG_OPT (0)
+#define OPT_bootclasspath LONG_OPT (1)
+#define OPT_HELP LONG_OPT (2)
+#define OPT_VERSION LONG_OPT (3)
+#define OPT_JAVAP LONG_OPT (4)
static const struct option options[] =
{
- { "classpath", required_argument, NULL, OPT_classpath },
- { "CLASSPATH", required_argument, NULL, OPT_CLASSPATH },
- { "help", no_argument, NULL, OPT_HELP },
- { "verbose", no_argument, NULL, 'v' },
- { "version", no_argument, NULL, OPT_VERSION },
- { "javap", no_argument, NULL, OPT_JAVAP },
- { "print-main", no_argument, &flag_print_main, 1 },
- { NULL, no_argument, NULL, 0 }
+ { "classpath", required_argument, NULL, OPT_classpath },
+ { "bootclasspath", required_argument, NULL, OPT_bootclasspath },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "verbose", no_argument, NULL, 'v' },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { "javap", no_argument, NULL, OPT_JAVAP },
+ { "print-main", no_argument, &flag_print_main, 1 },
+ { NULL, no_argument, NULL, 0 }
};
static void
@@ -805,8 +805,9 @@
printf (" -c Disassemble method bodies\n");
printf (" --javap Generate output in `javap' format\n");
printf ("\n");
+ printf (" --bootclasspath PATH Set path to find .class files, overriding\n\
+ built-in class path\n");
printf (" --classpath PATH Set path to find .class files\n");
- printf (" --CLASSPATH PATH Set path to find .class files\n");
printf (" -IDIR Append directory to class path\n");
printf (" -o FILE Set output file name\n");
printf ("\n");
@@ -874,8 +875,8 @@
jcf_path_classpath_arg (optarg);
break;
- case OPT_CLASSPATH:
- jcf_path_CLASSPATH_arg (optarg);
+ case OPT_bootclasspath:
+ jcf_path_bootclasspath_arg (optarg);
break;
case OPT_HELP:
Index: gcc/java/jcf-path.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-path.c,v
retrieving revision 1.17
diff -u -r1.17 jcf-path.c
--- jcf-path.c 2001/08/16 21:52:14 1.17
+++ jcf-path.c 2002/02/12 17:08:21
@@ -71,8 +71,8 @@
built-in system directory (only libgcj.jar)
CLASSPATH environment variable
- -CLASSPATH overrides CLASSPATH
- -classpath option - overrides CLASSPATH, -CLASSPATH, and built-in
+ -classpath overrides CLASSPATH
+ -bootclasspath option - overrides CLASSPATH, -classpath, and built-in
-I prepends path to list
We implement this by keeping several path lists, and then simply
@@ -84,7 +84,7 @@
/* This holds the CLASSPATH environment variable. */
static struct entry *classpath_env;
-/* This holds the -CLASSPATH command-line option. */
+/* This holds the -bootclasspath command-line option. */
static struct entry *classpath_u;
/* This holds the -classpath command-line option. */
@@ -286,7 +286,7 @@
/* Call this when -classpath is seen on the command line. */
void
-jcf_path_classpath_arg (path)
+jcf_path_bootclasspath_arg (path)
const char *path;
{
free_entry (&classpath_l);
@@ -295,7 +295,7 @@
/* Call this when -CLASSPATH is seen on the command line. */
void
-jcf_path_CLASSPATH_arg (path)
+jcf_path_classpath_arg (path)
const char *path;
{
free_entry (&classpath_u);
Index: gcc/java/jcf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf.h,v
retrieving revision 1.26
diff -u -r1.26 jcf.h
--- jcf.h 2001/12/03 23:09:42 1.26
+++ jcf.h 2002/02/12 17:08:22
@@ -270,8 +270,8 @@
/* Declarations for path handling code. */
extern void jcf_path_init PARAMS ((void));
+extern void jcf_path_bootclasspath_arg PARAMS ((const char *));
extern void jcf_path_classpath_arg PARAMS ((const char *));
-extern void jcf_path_CLASSPATH_arg PARAMS ((const char *));
extern void jcf_path_include_arg PARAMS ((const char *));
extern void jcf_path_seal PARAMS ((int));
extern void *jcf_path_start PARAMS ((void));
Index: gcc/java/jvspec.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jvspec.c,v
retrieving revision 1.51
diff -u -r1.51 jvspec.c
--- jvspec.c 2001/12/23 16:07:13 1.51
+++ jvspec.c 2002/02/12 17:08:23
@@ -65,7 +65,7 @@
%{<femit-class-file} %{<femit-class-files} %{<fencoding*}\
%{<fuse-boehm-gc} %{<fhash-synchronization} %{<fjni}\
%{<findirect-dispatch} \
- %{<fclasspath*} %{<fCLASSPATH*} %{<foutput-class-dir}\
+ %{<fclasspath*} %{<fbootclasspath*} %{<foutput-class-dir}\
%{<fuse-divide-subroutine} %{<fno-use-divide-subroutine}\
%{<fcheck-references} %{<fno-check-references}\
%{<ffilelist-file}\
@@ -288,7 +288,7 @@
quote = argv[i];
}
else if (strcmp(argv[i], "-classpath") == 0
- || strcmp(argv[i], "-CLASSPATH") == 0)
+ || strcmp(argv[i], "-bootclasspath") == 0)
{
quote = argv[i];
added -= 1;
Index: gcc/java/lang-options.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/lang-options.h,v
retrieving revision 1.28
diff -u -r1.28 lang-options.h
--- lang-options.h 2001/08/09 04:19:12 1.28
+++ lang-options.h 2002/02/12 17:08:23
@@ -32,9 +32,9 @@
N_("Disable automatic array bounds checking") },
{ "-fjni",
N_("Assume native functions are implemented using JNI") },
- { "--classpath",
+ { "--bootclasspath",
N_("Set class path and suppress system path") },
- { "--CLASSPATH",
+ { "--classpath",
N_("Set class path") },
{ "--main",
N_("Choose class whose main method should be used") },
Index: gcc/java/lang.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/lang.c,v
retrieving revision 1.84
diff -u -r1.84 lang.c
--- lang.c 2002/01/01 01:42:15 1.84
+++ lang.c 2002/02/12 17:08:24
@@ -299,17 +299,17 @@
return 1;
}
#undef CLARG
-#define CLARG "-fclasspath="
+#define CLARG "-fbootclasspath="
if (strncmp (p, CLARG, sizeof (CLARG) - 1) == 0)
{
- jcf_path_classpath_arg (p + sizeof (CLARG) - 1);
+ jcf_path_bootclasspath_arg (p + sizeof (CLARG) - 1);
return 1;
}
#undef CLARG
-#define CLARG "-fCLASSPATH="
+#define CLARG "-fclasspath="
if (strncmp (p, CLARG, sizeof (CLARG) - 1) == 0)
{
- jcf_path_CLASSPATH_arg (p + sizeof (CLARG) - 1);
+ jcf_path_classpath_arg (p + sizeof (CLARG) - 1);
return 1;
}
#undef CLARG