Commit 3b5edfee by Nathan Sidwell Committed by Nathan Sidwell

gcc.c (add_sysrooted_prefix, [...]): Use fatal, not abort.

	* gcc.c (add_sysrooted_prefix, execute, do_self_spec, do_spec_1,
	handle_braces, process_brace_body, main, used_arg,
	set_multilib_dir, print_multilib_info): Use fatal, not abort.

From-SVN: r87231
parent d73d4593
2004-09-09 Nathan Sidwell <nathan@codesourcery.com> 2004-09-09 Nathan Sidwell <nathan@codesourcery.com>
* gcc.c (add_sysrooted_prefix, execute, do_self_spec, do_spec_1,
handle_braces, process_brace_body, main, used_arg,
set_multilib_dir, print_multilib_info): Use fatal, not abort.
* tree-nested.c (create_tmp_var_for): Correct missinverted assert. * tree-nested.c (create_tmp_var_for): Correct missinverted assert.
* tree-outof-ssa.c (free_temp_expr_table): Add missed assert. * tree-outof-ssa.c (free_temp_expr_table): Add missed assert.
......
...@@ -2628,7 +2628,7 @@ add_sysrooted_prefix (struct path_prefix *pprefix, const char *prefix, ...@@ -2628,7 +2628,7 @@ add_sysrooted_prefix (struct path_prefix *pprefix, const char *prefix,
int require_machine_suffix, int os_multilib) int require_machine_suffix, int os_multilib)
{ {
if (!IS_ABSOLUTE_PATH (prefix)) if (!IS_ABSOLUTE_PATH (prefix))
abort (); fatal ("system path `%s' is not absolute", prefix);
if (target_system_root) if (target_system_root)
{ {
...@@ -2666,8 +2666,7 @@ execute (void) ...@@ -2666,8 +2666,7 @@ execute (void)
struct command *commands; /* each command buffer with above info. */ struct command *commands; /* each command buffer with above info. */
if (processing_spec_function) gcc_assert (!processing_spec_function);
abort ();
/* Count # of piped commands. */ /* Count # of piped commands. */
for (n_commands = 1, i = 0; i < argbuf_index; i++) for (n_commands = 1, i = 0; i < argbuf_index; i++)
...@@ -2840,8 +2839,7 @@ execute (void) ...@@ -2840,8 +2839,7 @@ execute (void)
int pid; int pid;
pid = pwait (commands[i].pid, &status, 0); pid = pwait (commands[i].pid, &status, 0);
if (pid < 0) gcc_assert (pid >= 0);
abort ();
#ifdef HAVE_GETRUSAGE #ifdef HAVE_GETRUSAGE
if (report_times) if (report_times)
...@@ -4365,7 +4363,7 @@ do_self_spec (const char *spec) ...@@ -4365,7 +4363,7 @@ do_self_spec (const char *spec)
/* Each switch should start with '-'. */ /* Each switch should start with '-'. */
if (argbuf[i][0] != '-') if (argbuf[i][0] != '-')
abort (); fatal ("switch '%s' does not start with '-'", argbuf[i]);
sw = &switches[i + first]; sw = &switches[i + first];
sw->part1 = &argbuf[i][1]; sw->part1 = &argbuf[i][1];
...@@ -4592,7 +4590,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) ...@@ -4592,7 +4590,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
switch (c = *p++) switch (c = *p++)
{ {
case 0: case 0:
fatal ("invalid specification! Bug in cc"); fatal ("spec '%s' invalid", spec);
case 'b': case 'b':
obstack_grow (&obstack, input_basename, basename_length); obstack_grow (&obstack, input_basename, basename_length);
...@@ -4731,7 +4729,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) ...@@ -4731,7 +4729,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
p += 2; p += 2;
/* We don't support extra suffix characters after %O. */ /* We don't support extra suffix characters after %O. */
if (*p == '.' || ISALPHA ((unsigned char) *p)) if (*p == '.' || ISALPHA ((unsigned char) *p))
abort (); fatal ("spec '%s' has invalid `%%0%c'", spec, *p);
if (suffix_length == 0) if (suffix_length == 0)
suffix = TARGET_OBJECT_SUFFIX; suffix = TARGET_OBJECT_SUFFIX;
else else
...@@ -4928,7 +4926,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) ...@@ -4928,7 +4926,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
int cur_index = argbuf_index; int cur_index = argbuf_index;
/* Handle the {...} following the %W. */ /* Handle the {...} following the %W. */
if (*p != '{') if (*p != '{')
abort (); fatal ("spec `%s' has invalid `%%W%c", spec, *p);
p = handle_braces (p + 1); p = handle_braces (p + 1);
if (p == 0) if (p == 0)
return -1; return -1;
...@@ -4959,7 +4957,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) ...@@ -4959,7 +4957,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
/* Skip past the option value and make a copy. */ /* Skip past the option value and make a copy. */
if (*p != '{') if (*p != '{')
abort (); fatal ("spec `%s' has invalid `%%x%c'", spec, *p);
while (*p++ != '}') while (*p++ != '}')
; ;
string = save_string (p1 + 1, p - p1 - 2); string = save_string (p1 + 1, p - p1 - 2);
...@@ -5517,6 +5515,7 @@ handle_braces (const char *p) ...@@ -5517,6 +5515,7 @@ handle_braces (const char *p)
{ {
const char *atom, *end_atom; const char *atom, *end_atom;
const char *d_atom = NULL, *d_end_atom = NULL; const char *d_atom = NULL, *d_end_atom = NULL;
const char *orig = p;
bool a_is_suffix; bool a_is_suffix;
bool a_is_starred; bool a_is_starred;
...@@ -5536,7 +5535,7 @@ handle_braces (const char *p) ...@@ -5536,7 +5535,7 @@ handle_braces (const char *p)
do do
{ {
if (a_must_be_last) if (a_must_be_last)
abort (); goto invalid;
/* Scan one "atom" (S in the description above of %{}, possibly /* Scan one "atom" (S in the description above of %{}, possibly
with !, ., or * modifiers). */ with !, ., or * modifiers). */
...@@ -5560,32 +5559,33 @@ handle_braces (const char *p) ...@@ -5560,32 +5559,33 @@ handle_braces (const char *p)
p++, a_is_starred = 1; p++, a_is_starred = 1;
SKIP_WHITE(); SKIP_WHITE();
if (*p == '&' || *p == '}') switch (*p)
{ {
case '&': case '}':
/* Substitute the switch(es) indicated by the current atom. */ /* Substitute the switch(es) indicated by the current atom. */
ordered_set = true; ordered_set = true;
if (disjunct_set || n_way_choice || a_is_negated || a_is_suffix if (disjunct_set || n_way_choice || a_is_negated || a_is_suffix
|| atom == end_atom) || atom == end_atom)
abort (); goto invalid;
mark_matching_switches (atom, end_atom, a_is_starred); mark_matching_switches (atom, end_atom, a_is_starred);
if (*p == '}') if (*p == '}')
process_marked_switches (); process_marked_switches ();
} break;
else if (*p == '|' || *p == ':')
{ case '|': case ':':
/* Substitute some text if the current atom appears as a switch /* Substitute some text if the current atom appears as a switch
or suffix. */ or suffix. */
disjunct_set = true; disjunct_set = true;
if (ordered_set) if (ordered_set)
abort (); goto invalid;
if (atom == end_atom) if (atom == end_atom)
{ {
if (!n_way_choice || disj_matched || *p == '|' if (!n_way_choice || disj_matched || *p == '|'
|| a_is_negated || a_is_suffix || a_is_starred) || a_is_negated || a_is_suffix || a_is_starred)
abort (); goto invalid;
/* An empty term may appear as the last choice of an /* An empty term may appear as the last choice of an
N-way choice set; it means "otherwise". */ N-way choice set; it means "otherwise". */
...@@ -5596,7 +5596,7 @@ handle_braces (const char *p) ...@@ -5596,7 +5596,7 @@ handle_braces (const char *p)
else else
{ {
if (a_is_suffix && a_is_starred) if (a_is_suffix && a_is_starred)
abort (); goto invalid;
if (!a_is_starred) if (!a_is_starred)
disj_starred = false; disj_starred = false;
...@@ -5639,14 +5639,19 @@ handle_braces (const char *p) ...@@ -5639,14 +5639,19 @@ handle_braces (const char *p)
d_atom = d_end_atom = NULL; d_atom = d_end_atom = NULL;
} }
} }
break;
default:
goto invalid;
} }
else
abort ();
} }
while (*p++ != '}'); while (*p++ != '}');
return p; return p;
invalid:
fatal ("braced spec `%s' is invalid at `%c'", orig, *p);
#undef SKIP_WHITE #undef SKIP_WHITE
} }
...@@ -5686,7 +5691,7 @@ process_brace_body (const char *p, const char *atom, const char *end_atom, ...@@ -5686,7 +5691,7 @@ process_brace_body (const char *p, const char *atom, const char *end_atom,
else if (*p == '%' && p[1] == '*' && nesting_level == 1) else if (*p == '%' && p[1] == '*' && nesting_level == 1)
have_subst = true; have_subst = true;
else if (*p == '\0') else if (*p == '\0')
abort (); goto invalid;
p++; p++;
} }
...@@ -5695,7 +5700,7 @@ process_brace_body (const char *p, const char *atom, const char *end_atom, ...@@ -5695,7 +5700,7 @@ process_brace_body (const char *p, const char *atom, const char *end_atom,
end_body--; end_body--;
if (have_subst && !starred) if (have_subst && !starred)
abort (); goto invalid;
if (matched) if (matched)
{ {
...@@ -5731,6 +5736,9 @@ process_brace_body (const char *p, const char *atom, const char *end_atom, ...@@ -5731,6 +5736,9 @@ process_brace_body (const char *p, const char *atom, const char *end_atom,
} }
return p; return p;
invalid:
fatal ("braced spec body `%s' is invalid", body);
} }
/* Return 0 iff switch number SWITCHNUM is obsoleted by a later switch /* Return 0 iff switch number SWITCHNUM is obsoleted by a later switch
...@@ -6454,13 +6462,13 @@ main (int argc, const char **argv) ...@@ -6454,13 +6462,13 @@ main (int argc, const char **argv)
{ {
value = do_spec (input_file_compiler->spec); value = do_spec (input_file_compiler->spec);
infiles[i].preprocessed = true; infiles[i].preprocessed = true;
if (have_o_argbuf_index) if (!have_o_argbuf_index)
infiles[i].name = argbuf[have_o_argbuf_index]; fatal ("spec `%s' is invalid", input_file_compiler->spec);
else infiles[i].name = argbuf[have_o_argbuf_index];
abort (); infiles[i].incompiler
infiles[i].incompiler = lookup_compiler (infiles[i].name, = lookup_compiler (infiles[i].name,
strlen (infiles[i].name), strlen (infiles[i].name),
infiles[i].language); infiles[i].language);
if (value < 0) if (value < 0)
this_file_error = 1; this_file_error = 1;
...@@ -6921,7 +6929,10 @@ used_arg (const char *p, int len) ...@@ -6921,7 +6929,10 @@ used_arg (const char *p, int len)
while (*q != ' ') while (*q != ' ')
{ {
if (*q == '\0') if (*q == '\0')
abort (); {
invalid_matches:
fatal ("multilib spec `%s' is invalid", multilib_matches);
}
q++; q++;
} }
matches[i].len = q - matches[i].str; matches[i].len = q - matches[i].str;
...@@ -6930,7 +6941,7 @@ used_arg (const char *p, int len) ...@@ -6930,7 +6941,7 @@ used_arg (const char *p, int len)
while (*q != ';' && *q != '\0') while (*q != ';' && *q != '\0')
{ {
if (*q == ' ') if (*q == ' ')
abort (); goto invalid_matches;
q++; q++;
} }
matches[i].rep_len = q - matches[i].replace; matches[i].rep_len = q - matches[i].replace;
...@@ -7110,7 +7121,11 @@ set_multilib_dir (void) ...@@ -7110,7 +7121,11 @@ set_multilib_dir (void)
while (*p != ';') while (*p != ';')
{ {
if (*p == '\0') if (*p == '\0')
abort (); {
invalid_exclusions:
fatal ("multilib exclusions `%s' is invalid",
multilib_exclusions);
}
if (! ok) if (! ok)
{ {
...@@ -7122,7 +7137,7 @@ set_multilib_dir (void) ...@@ -7122,7 +7137,7 @@ set_multilib_dir (void)
while (*p != ' ' && *p != ';') while (*p != ' ' && *p != ';')
{ {
if (*p == '\0') if (*p == '\0')
abort (); goto invalid_exclusions;
++p; ++p;
} }
...@@ -7164,7 +7179,11 @@ set_multilib_dir (void) ...@@ -7164,7 +7179,11 @@ set_multilib_dir (void)
while (*p != ' ') while (*p != ' ')
{ {
if (*p == '\0') if (*p == '\0')
abort (); {
invalid_select:
fatal ("multilib select `%s' is invalid",
multilib_select);
}
++p; ++p;
} }
this_path_len = p - this_path; this_path_len = p - this_path;
...@@ -7176,7 +7195,7 @@ set_multilib_dir (void) ...@@ -7176,7 +7195,7 @@ set_multilib_dir (void)
while (*p != ';') while (*p != ';')
{ {
if (*p == '\0') if (*p == '\0')
abort (); goto invalid_select;
if (! ok) if (! ok)
{ {
...@@ -7188,7 +7207,7 @@ set_multilib_dir (void) ...@@ -7188,7 +7207,7 @@ set_multilib_dir (void)
while (*p != ' ' && *p != ';') while (*p != ' ' && *p != ';')
{ {
if (*p == '\0') if (*p == '\0')
abort (); goto invalid_select;
++p; ++p;
} }
...@@ -7301,7 +7320,11 @@ print_multilib_info (void) ...@@ -7301,7 +7320,11 @@ print_multilib_info (void)
while (*p != ' ') while (*p != ' ')
{ {
if (*p == '\0') if (*p == '\0')
abort (); {
invalid_select:
fatal ("multilib select `%s' is invalid", multilib_select);
}
++p; ++p;
} }
...@@ -7335,7 +7358,11 @@ print_multilib_info (void) ...@@ -7335,7 +7358,11 @@ print_multilib_info (void)
int mp = 0; int mp = 0;
if (*e == '\0') if (*e == '\0')
abort (); {
invalid_exclusion:
fatal ("multilib exclusion `%s' is invalid",
multilib_exclusions);
}
if (! m) if (! m)
{ {
...@@ -7348,7 +7375,7 @@ print_multilib_info (void) ...@@ -7348,7 +7375,7 @@ print_multilib_info (void)
while (*e != ' ' && *e != ';') while (*e != ' ' && *e != ';')
{ {
if (*e == '\0') if (*e == '\0')
abort (); goto invalid_exclusion;
++e; ++e;
} }
...@@ -7359,19 +7386,20 @@ print_multilib_info (void) ...@@ -7359,19 +7386,20 @@ print_multilib_info (void)
int len = e - this_arg; int len = e - this_arg;
if (*q == '\0') if (*q == '\0')
abort (); goto invalid_select;
arg = q; arg = q;
while (*q != ' ' && *q != ';') while (*q != ' ' && *q != ';')
{ {
if (*q == '\0') if (*q == '\0')
abort (); goto invalid_select;
++q; ++q;
} }
if (! strncmp (arg, this_arg, (len < q - arg) ? q - arg : len) || if (! strncmp (arg, this_arg,
default_arg (this_arg, e - this_arg)) (len < q - arg) ? q - arg : len)
|| default_arg (this_arg, e - this_arg))
{ {
mp = 1; mp = 1;
break; break;
...@@ -7402,7 +7430,8 @@ print_multilib_info (void) ...@@ -7402,7 +7430,8 @@ print_multilib_info (void)
if (! skip) if (! skip)
{ {
/* If this is a duplicate, skip it. */ /* If this is a duplicate, skip it. */
skip = (last_path != 0 && (unsigned int) (p - this_path) == last_path_len skip = (last_path != 0
&& (unsigned int) (p - this_path) == last_path_len
&& ! strncmp (last_path, this_path, last_path_len)); && ! strncmp (last_path, this_path, last_path_len));
last_path = this_path; last_path = this_path;
...@@ -7422,7 +7451,7 @@ print_multilib_info (void) ...@@ -7422,7 +7451,7 @@ print_multilib_info (void)
const char *arg; const char *arg;
if (*q == '\0') if (*q == '\0')
abort (); goto invalid_select;
if (*q == '!') if (*q == '!')
arg = NULL; arg = NULL;
...@@ -7432,7 +7461,7 @@ print_multilib_info (void) ...@@ -7432,7 +7461,7 @@ print_multilib_info (void)
while (*q != ' ' && *q != ';') while (*q != ' ' && *q != ';')
{ {
if (*q == '\0') if (*q == '\0')
abort (); goto invalid_select;
++q; ++q;
} }
...@@ -7463,7 +7492,7 @@ print_multilib_info (void) ...@@ -7463,7 +7492,7 @@ print_multilib_info (void)
int use_arg; int use_arg;
if (*p == '\0') if (*p == '\0')
abort (); goto invalid_select;
if (skip) if (skip)
{ {
...@@ -7479,7 +7508,7 @@ print_multilib_info (void) ...@@ -7479,7 +7508,7 @@ print_multilib_info (void)
while (*p != ' ' && *p != ';') while (*p != ' ' && *p != ';')
{ {
if (*p == '\0') if (*p == '\0')
abort (); goto invalid_select;
if (use_arg) if (use_arg)
putchar (*p); putchar (*p);
++p; ++p;
......
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