prims.cc (parse_verbose_args): Fix verbose argument parsing.

2005-04-07  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* prims.cc (parse_verbose_args): Fix verbose argument parsing.

From-SVN: r98097
This commit is contained in:
Thomas Fitzsimmons 2005-04-13 16:37:20 +00:00 committed by Thomas Fitzsimmons
parent 4a36a3f164
commit 23a8ae8d46
2 changed files with 57 additions and 50 deletions

View File

@ -1,3 +1,7 @@
2005-04-07 Thomas Fitzsimmons <fitzsim@redhat.com>
* prims.cc (parse_verbose_args): Fix verbose argument parsing.
2005-04-12 Mike Stump <mrs@apple.com>
* configure: Regenerate.

View File

@ -1049,7 +1049,7 @@ static jint
parse_verbose_args (char* option_string,
bool ignore_unrecognized)
{
size_t len = sizeof ("-verbose");
size_t len = sizeof ("-verbose") - 1;
if (strlen (option_string) < len)
return -1;
@ -1058,69 +1058,72 @@ parse_verbose_args (char* option_string,
&& option_string[len + 1] != '\0')
{
char* verbose_args = option_string + len + 1;
size_t last = 0;
do
{
if (! strncmp (verbose_args,
"gc", (last = sizeof ("gc")) - 1)
&& (verbose_args[last] == '\0'
|| verbose_args[last] == ','))
{
// FIXME: we should add functions to boehm-gc that
// toggle GC_print_stats, GC_PRINT_ADDRESS_MAP and
// GC_print_back_height.
}
"gc", sizeof ("gc") - 1))
{
if (verbose_args[sizeof ("gc") - 1] == '\0'
|| verbose_args[sizeof ("gc") - 1] == ',')
{
// FIXME: we should add functions to boehm-gc that
// toggle GC_print_stats, GC_PRINT_ADDRESS_MAP and
// GC_print_back_height.
verbose_args += sizeof ("gc") - 1;
}
else
{
verbose_arg_err:
fprintf (stderr, "libgcj: unknown verbose option: %s\n",
option_string);
return -1;
}
}
else if (! strncmp (verbose_args,
"class",
(last = sizeof ("class")) - 1)
&& (verbose_args[last] == '\0'
|| verbose_args[last] == ','))
{
gcj::verbose_class_flag = true;
}
sizeof ("class") - 1))
{
if (verbose_args[sizeof ("class") - 1] == '\0'
|| verbose_args[sizeof ("class") - 1] == ',')
{
gcj::verbose_class_flag = true;
verbose_args += sizeof ("class") - 1;
}
else
goto verbose_arg_err;
}
else if (! strncmp (verbose_args, "jni",
(last = sizeof ("jni")) - 1)
&& (verbose_args[last] == '\0'
|| verbose_args[last] == ','))
{
// FIXME: enable JNI messages.
}
sizeof ("jni") - 1))
{
if (verbose_args[sizeof ("jni") - 1] == '\0'
|| verbose_args[sizeof ("jni") - 1] == ',')
{
// FIXME: enable JNI messages.
verbose_args += sizeof ("jni") - 1;
}
else
goto verbose_arg_err;
}
else if (ignore_unrecognized
&& verbose_args[0] == 'X')
{
// ignore unrecognized non-standard verbose option
last = 0;
while (verbose_args[last] != '\0'
&& verbose_args[last++] != ',');
while (verbose_args[0] != '\0'
&& verbose_args[0] != ',')
verbose_args++;
}
else if (verbose_args[0] == ',')
{
verbose_args++;
}
else
goto verbose_arg_err;
if (strlen (verbose_args) >= last)
{
if (verbose_args[last] == ',')
{
if (verbose_args[last + 1] == '\0')
// trailing comma
return -1;
else
{
verbose_args = verbose_args + last + 1;
last = 0;
}
}
// here verbose_args[last] is either '\0' or
// the first character in the next verbose
// argument.
}
else
// partial option
return -1;
// verbose_args[last] will be '\0' here if we're
// done.
if (verbose_args[0] == ',')
verbose_args++;
}
while (verbose_args[last] != '\0');
while (verbose_args[0] != '\0');
}
else if (option_string[len] == 'g'
&& option_string[len + 1] == 'c'