Commit 2dec80c7 by Joseph Myers Committed by Joseph Myers

re PR driver/15303 (When gcc sees an unrecognized option, the exit status indicates success)

	PR driver/15303
	* gcc.c (inform, warning, inform): New functions.
	(fatal_ice): Rename to internal_error; change cmsgid parameter to
	gmsgid.  All callers changed.
	(notice): Rename to fnotice; add parameter fp.  All callers
	changed.
	(fatal_error): Rename to fatal_signal.  All users changed.
	(fatal): Rename to fatal_error; change cmsgid parameter to
	gmsgid.  All callers changed.
	(process_command): Use warning instead of error for warnings.
	(end_going_arg): Don't use _() around argument of error.
	(do_spec_1): Use inform for message from %n specs.  Use warning
	instead of error for warnings.
	(main): Use inform for comparison messages.  Use warning for
	message about unused linker input.
	(error): Increment error_count.  Print "error: ".
	* gcc.h (fatal): Change to fatal_error.
	(warning): Declare.
	* config/darwin-driver.c (darwin_default_min_version): Use warning
	instead of fprintf for warnings.
	* cppspec.c (lang_specific_driver): Use fatal_error instead of
	fatal.

cp:
	* g++spec.c (lang_specific_driver): Use fatal_error instead of
	fatal.

fortran:
	* gfortranspec.c (append_arg, lang_specific_driver): Use
	fatal_error instead of fatal.  Use warning instead of fprintf for
	warnings.

java:
	* jvspec.c (lang_specific_driver): Use fatal_error instead of
	fatal.  Use warning instead of error for warnings.

From-SVN: r159986
parent 7325b1b3
2010-05-28 Joseph Myers <joseph@codesourcery.com>
PR driver/15303
* gcc.c (inform, warning, inform): New functions.
(fatal_ice): Rename to internal_error; change cmsgid parameter to
gmsgid. All callers changed.
(notice): Rename to fnotice; add parameter fp. All callers
changed.
(fatal_error): Rename to fatal_signal. All users changed.
(fatal): Rename to fatal_error; change cmsgid parameter to
gmsgid. All callers changed.
(process_command): Use warning instead of error for warnings.
(end_going_arg): Don't use _() around argument of error.
(do_spec_1): Use inform for message from %n specs. Use warning
instead of error for warnings.
(main): Use inform for comparison messages. Use warning for
message about unused linker input.
(error): Increment error_count. Print "error: ".
* gcc.h (fatal): Change to fatal_error.
(warning): Declare.
* config/darwin-driver.c (darwin_default_min_version): Use warning
instead of fprintf for warnings.
* cppspec.c (lang_specific_driver): Use fatal_error instead of
fatal.
2010-05-28 Julian Brown <julian@codesourcery.com> 2010-05-28 Julian Brown <julian@codesourcery.com>
* config/arm/thumb2.md (*thumb2_addsi3_compare0): New. * config/arm/thumb2.md (*thumb2_addsi3_compare0): New.
......
/* Additional functions for the GCC driver on Darwin native. /* Additional functions for the GCC driver on Darwin native.
Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. Copyright (C) 2006, 2007, 2008, 2010 Free Software Foundation, Inc.
Contributed by Apple Computer Inc. Contributed by Apple Computer Inc.
This file is part of GCC. This file is part of GCC.
...@@ -107,7 +107,7 @@ darwin_default_min_version (int * argc_p, char *** argv_p) ...@@ -107,7 +107,7 @@ darwin_default_min_version (int * argc_p, char *** argv_p)
if (sysctl (osversion_name, ARRAY_SIZE (osversion_name), osversion, if (sysctl (osversion_name, ARRAY_SIZE (osversion_name), osversion,
&osversion_len, NULL, 0) == -1) &osversion_len, NULL, 0) == -1)
{ {
fprintf (stderr, "sysctl for kern.osversion failed: %s\n", warning (0, "sysctl for kern.osversion failed: %s",
xstrerror (errno)); xstrerror (errno));
return; return;
} }
...@@ -151,7 +151,7 @@ darwin_default_min_version (int * argc_p, char *** argv_p) ...@@ -151,7 +151,7 @@ darwin_default_min_version (int * argc_p, char *** argv_p)
return; return;
parse_failed: parse_failed:
fprintf (stderr, "couldn't understand kern.osversion `%.*s'\n", warning (0, "couldn't understand kern.osversion `%.*s'",
(int) osversion_len, osversion); (int) osversion_len, osversion);
return; return;
} }
......
2010-05-28 Joseph Myers <joseph@codesourcery.com>
* g++spec.c (lang_specific_driver): Use fatal_error instead of
fatal.
2010-05-28 Dodji Seketeli <dodji@redhat.com> 2010-05-28 Dodji Seketeli <dodji@redhat.com>
Revert fix of PR c++/44188 Revert fix of PR c++/44188
......
/* Specific flags and argument handling of the C++ front end. /* Specific flags and argument handling of the C++ front end.
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2007, 2008, 2009 Free Software Foundation, Inc. 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -258,7 +258,7 @@ lang_specific_driver (int *in_argc, const char *const **in_argv, ...@@ -258,7 +258,7 @@ lang_specific_driver (int *in_argc, const char *const **in_argv,
} }
if (quote) if (quote)
fatal ("argument to '%s' missing\n", quote); fatal_error ("argument to '%s' missing\n", quote);
/* There's no point adding -shared-libgcc if we don't have a shared /* There's no point adding -shared-libgcc if we don't have a shared
libgcc. */ libgcc. */
......
/* Specific flags and argument handling of the C preprocessor. /* Specific flags and argument handling of the C preprocessor.
Copyright (C) 1999, 2007 Free Software Foundation, Inc. Copyright (C) 1999, 2007, 2010 Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -103,8 +103,8 @@ lang_specific_driver (int *in_argc, const char *const **in_argv, ...@@ -103,8 +103,8 @@ lang_specific_driver (int *in_argc, const char *const **in_argv,
need_E = 0; need_E = 0;
else if (argv[i][1] == 'S' || argv[i][1] == 'c') else if (argv[i][1] == 'S' || argv[i][1] == 'c')
{ {
fatal ("\"%s\" is not a valid option to the preprocessor", fatal_error ("\"%s\" is not a valid option to the "
argv[i]); "preprocessor", argv[i]);
return; return;
} }
else if (argv[i][1] == 'x') else if (argv[i][1] == 'x')
...@@ -125,7 +125,7 @@ lang_specific_driver (int *in_argc, const char *const **in_argv, ...@@ -125,7 +125,7 @@ lang_specific_driver (int *in_argc, const char *const **in_argv,
seen_input++; seen_input++;
if (seen_input == 3) if (seen_input == 3)
{ {
fatal ("too many input files"); fatal_error ("too many input files");
return; return;
} }
else if (seen_input == 2) else if (seen_input == 2)
......
2010-05-28 Joseph Myers <joseph@codesourcery.com> 2010-05-28 Joseph Myers <joseph@codesourcery.com>
* gfortranspec.c (append_arg, lang_specific_driver): Use
fatal_error instead of fatal. Use warning instead of fprintf for
warnings.
2010-05-28 Joseph Myers <joseph@codesourcery.com>
* cpp.c (gfc_cpp_init_0): Use xstrerror instead of strerror. * cpp.c (gfc_cpp_init_0): Use xstrerror instead of strerror.
* module.c (write_char, gfc_dump_module, gfc_use_module): Use * module.c (write_char, gfc_dump_module, gfc_use_module): Use
xstrerror instead of strerror. xstrerror instead of strerror.
......
...@@ -244,7 +244,7 @@ append_arg (const char *arg) ...@@ -244,7 +244,7 @@ append_arg (const char *arg)
} }
if (g77_newargc == newargsize) if (g77_newargc == newargsize)
fatal ("overflowed output arg list for '%s'", arg); fatal_error ("overflowed output arg list for '%s'", arg);
g77_newargv[g77_newargc++] = arg; g77_newargv[g77_newargc++] = arg;
} }
...@@ -402,11 +402,11 @@ For more information about these matters, see the file named COPYING\n\n")); ...@@ -402,11 +402,11 @@ For more information about these matters, see the file named COPYING\n\n"));
if (i + skip < argc) if (i + skip < argc)
i += skip; i += skip;
else else
fatal ("argument to '%s' missing", argv[i]); fatal_error ("argument to '%s' missing", argv[i]);
} }
if ((n_outfiles != 0) && (n_infiles == 0)) if ((n_outfiles != 0) && (n_infiles == 0))
fatal ("no input files; unwilling to write output files"); fatal_error ("no input files; unwilling to write output files");
/* If there are no input files, no need for the library. */ /* If there are no input files, no need for the library. */
if (n_infiles == 0) if (n_infiles == 0)
...@@ -428,8 +428,7 @@ For more information about these matters, see the file named COPYING\n\n")); ...@@ -428,8 +428,7 @@ For more information about these matters, see the file named COPYING\n\n"));
{ {
char *p; char *p;
fprintf (stderr, _("Warning: Using -M <directory> is deprecated, " warning (0, "using -M <directory> is deprecated, use -J instead");
"use -J instead\n"));
if (argv[i][2] == '\0') if (argv[i][2] == '\0')
{ {
if (i+1 < argc) if (i+1 < argc)
...@@ -441,7 +440,7 @@ For more information about these matters, see the file named COPYING\n\n")); ...@@ -441,7 +440,7 @@ For more information about these matters, see the file named COPYING\n\n"));
i++; i++;
} }
else else
fatal ("argument to '%s' missing", argv[i]); fatal_error ("argument to '%s' missing", argv[i]);
} }
else else
{ {
......
...@@ -377,9 +377,11 @@ static int used_arg (const char *, int); ...@@ -377,9 +377,11 @@ static int used_arg (const char *, int);
static int default_arg (const char *, int); static int default_arg (const char *, int);
static void set_multilib_dir (void); static void set_multilib_dir (void);
static void print_multilib_info (void); static void print_multilib_info (void);
static void inform (int, const char *, ...) ATTRIBUTE_PRINTF_2;
static void perror_with_name (const char *); static void perror_with_name (const char *);
static void fatal_ice (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; static void internal_error (const char *, ...)
static void notice (const char *, ...) ATTRIBUTE_PRINTF_1; ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
static void fnotice (FILE *, const char *, ...) ATTRIBUTE_PRINTF_2;
static void display_help (void); static void display_help (void);
static void add_preprocessor_option (const char *, int); static void add_preprocessor_option (const char *, int);
static void add_assembler_option (const char *, int); static void add_assembler_option (const char *, int);
...@@ -388,7 +390,7 @@ static void process_command (int, const char **); ...@@ -388,7 +390,7 @@ static void process_command (int, const char **);
static int execute (void); static int execute (void);
static void alloc_args (void); static void alloc_args (void);
static void clear_args (void); static void clear_args (void);
static void fatal_error (int); static void fatal_signal (int);
#if defined(ENABLE_SHARED_LIBGCC) && !defined(REAL_LIBGCC_SPEC) #if defined(ENABLE_SHARED_LIBGCC) && !defined(REAL_LIBGCC_SPEC)
static void init_gcc_specs (struct obstack *, const char *, const char *, static void init_gcc_specs (struct obstack *, const char *, const char *,
const char *); const char *);
...@@ -1795,7 +1797,7 @@ init_spec (void) ...@@ -1795,7 +1797,7 @@ init_spec (void)
return; /* Already initialized. */ return; /* Already initialized. */
if (verbose_flag) if (verbose_flag)
notice ("Using built-in specs.\n"); fnotice (stderr, "Using built-in specs.\n");
#ifdef EXTRA_SPECS #ifdef EXTRA_SPECS
extra_specs = XCNEWVEC (struct spec_list, ARRAY_SIZE (extra_specs_1)); extra_specs = XCNEWVEC (struct spec_list, ARRAY_SIZE (extra_specs_1));
...@@ -1980,7 +1982,7 @@ set_spec (const char *name, const char *spec) ...@@ -1980,7 +1982,7 @@ set_spec (const char *name, const char *spec)
#ifdef DEBUG_SPECS #ifdef DEBUG_SPECS
if (verbose_flag) if (verbose_flag)
notice ("Setting spec %s to '%s'\n\n", name, *(sl->ptr_spec)); fnotice (stderr, "Setting spec %s to '%s'\n\n", name, *(sl->ptr_spec));
#endif #endif
/* Free the old spec. */ /* Free the old spec. */
...@@ -2103,7 +2105,7 @@ load_specs (const char *filename) ...@@ -2103,7 +2105,7 @@ load_specs (const char *filename)
char *specs_p; char *specs_p;
if (verbose_flag) if (verbose_flag)
notice ("Reading specs from %s\n", filename); fnotice (stderr, "Reading specs from %s\n", filename);
/* Open and stat the file. */ /* Open and stat the file. */
desc = open (filename, O_RDONLY, 0); desc = open (filename, O_RDONLY, 0);
...@@ -2199,8 +2201,9 @@ read_specs (const char *filename, int main_p) ...@@ -2199,8 +2201,9 @@ read_specs (const char *filename, int main_p)
p1++; p1++;
if (*p1++ != '<' || p[-2] != '>') if (*p1++ != '<' || p[-2] != '>')
fatal ("specs %%include syntax malformed after %ld characters", fatal_error ("specs %%include syntax malformed after "
(long) (p1 - buffer + 1)); "%ld characters",
(long) (p1 - buffer + 1));
p[-2] = '\0'; p[-2] = '\0';
new_filename = find_a_file (&startfile_prefixes, p1, R_OK, true); new_filename = find_a_file (&startfile_prefixes, p1, R_OK, true);
...@@ -2218,15 +2221,16 @@ read_specs (const char *filename, int main_p) ...@@ -2218,15 +2221,16 @@ read_specs (const char *filename, int main_p)
p1++; p1++;
if (*p1++ != '<' || p[-2] != '>') if (*p1++ != '<' || p[-2] != '>')
fatal ("specs %%include syntax malformed after %ld characters", fatal_error ("specs %%include syntax malformed after "
(long) (p1 - buffer + 1)); "%ld characters",
(long) (p1 - buffer + 1));
p[-2] = '\0'; p[-2] = '\0';
new_filename = find_a_file (&startfile_prefixes, p1, R_OK, true); new_filename = find_a_file (&startfile_prefixes, p1, R_OK, true);
if (new_filename) if (new_filename)
read_specs (new_filename, FALSE); read_specs (new_filename, FALSE);
else if (verbose_flag) else if (verbose_flag)
notice ("could not find specs file %s\n", p1); fnotice (stderr, "could not find specs file %s\n", p1);
continue; continue;
} }
else if (!strncmp (p1, "%rename", sizeof "%rename" - 1) else if (!strncmp (p1, "%rename", sizeof "%rename" - 1)
...@@ -2243,16 +2247,18 @@ read_specs (const char *filename, int main_p) ...@@ -2243,16 +2247,18 @@ read_specs (const char *filename, int main_p)
p1++; p1++;
if (! ISALPHA ((unsigned char) *p1)) if (! ISALPHA ((unsigned char) *p1))
fatal ("specs %%rename syntax malformed after %ld characters", fatal_error ("specs %%rename syntax malformed after "
(long) (p1 - buffer)); "%ld characters",
(long) (p1 - buffer));
p2 = p1; p2 = p1;
while (*p2 && !ISSPACE ((unsigned char) *p2)) while (*p2 && !ISSPACE ((unsigned char) *p2))
p2++; p2++;
if (*p2 != ' ' && *p2 != '\t') if (*p2 != ' ' && *p2 != '\t')
fatal ("specs %%rename syntax malformed after %ld characters", fatal_error ("specs %%rename syntax malformed after "
(long) (p2 - buffer)); "%ld characters",
(long) (p2 - buffer));
name_len = p2 - p1; name_len = p2 - p1;
*p2++ = '\0'; *p2++ = '\0';
...@@ -2260,8 +2266,9 @@ read_specs (const char *filename, int main_p) ...@@ -2260,8 +2266,9 @@ read_specs (const char *filename, int main_p)
p2++; p2++;
if (! ISALPHA ((unsigned char) *p2)) if (! ISALPHA ((unsigned char) *p2))
fatal ("specs %%rename syntax malformed after %ld characters", fatal_error ("specs %%rename syntax malformed after "
(long) (p2 - buffer)); "%ld characters",
(long) (p2 - buffer));
/* Get new spec name. */ /* Get new spec name. */
p3 = p2; p3 = p2;
...@@ -2269,8 +2276,9 @@ read_specs (const char *filename, int main_p) ...@@ -2269,8 +2276,9 @@ read_specs (const char *filename, int main_p)
p3++; p3++;
if (p3 != p - 1) if (p3 != p - 1)
fatal ("specs %%rename syntax malformed after %ld characters", fatal_error ("specs %%rename syntax malformed after "
(long) (p3 - buffer)); "%ld characters",
(long) (p3 - buffer));
*p3 = '\0'; *p3 = '\0';
for (sl = specs; sl; sl = sl->next) for (sl = specs; sl; sl = sl->next)
...@@ -2278,21 +2286,22 @@ read_specs (const char *filename, int main_p) ...@@ -2278,21 +2286,22 @@ read_specs (const char *filename, int main_p)
break; break;
if (!sl) if (!sl)
fatal ("specs %s spec was not found to be renamed", p1); fatal_error ("specs %s spec was not found to be renamed", p1);
if (strcmp (p1, p2) == 0) if (strcmp (p1, p2) == 0)
continue; continue;
for (newsl = specs; newsl; newsl = newsl->next) for (newsl = specs; newsl; newsl = newsl->next)
if (strcmp (newsl->name, p2) == 0) if (strcmp (newsl->name, p2) == 0)
fatal ("%s: attempt to rename spec '%s' to already defined spec '%s'", fatal_error ("%s: attempt to rename spec '%s' to "
"already defined spec '%s'",
filename, p1, p2); filename, p1, p2);
if (verbose_flag) if (verbose_flag)
{ {
notice ("rename spec %s to %s\n", p1, p2); fnotice (stderr, "rename spec %s to %s\n", p1, p2);
#ifdef DEBUG_SPECS #ifdef DEBUG_SPECS
notice ("spec is '%s'\n\n", *(sl->ptr_spec)); fnotice (stderr, "spec is '%s'\n\n", *(sl->ptr_spec));
#endif #endif
} }
...@@ -2305,8 +2314,8 @@ read_specs (const char *filename, int main_p) ...@@ -2305,8 +2314,8 @@ read_specs (const char *filename, int main_p)
continue; continue;
} }
else else
fatal ("specs unknown %% command after %ld characters", fatal_error ("specs unknown %% command after %ld characters",
(long) (p1 - buffer)); (long) (p1 - buffer));
} }
/* Find the colon that should end the suffix. */ /* Find the colon that should end the suffix. */
...@@ -2316,8 +2325,8 @@ read_specs (const char *filename, int main_p) ...@@ -2316,8 +2325,8 @@ read_specs (const char *filename, int main_p)
/* The colon shouldn't be missing. */ /* The colon shouldn't be missing. */
if (*p1 != ':') if (*p1 != ':')
fatal ("specs file malformed after %ld characters", fatal_error ("specs file malformed after %ld characters",
(long) (p1 - buffer)); (long) (p1 - buffer));
/* Skip back over trailing whitespace. */ /* Skip back over trailing whitespace. */
p2 = p1; p2 = p1;
...@@ -2329,8 +2338,8 @@ read_specs (const char *filename, int main_p) ...@@ -2329,8 +2338,8 @@ read_specs (const char *filename, int main_p)
/* Find the next line. */ /* Find the next line. */
p = skip_whitespace (p1 + 1); p = skip_whitespace (p1 + 1);
if (p[1] == 0) if (p[1] == 0)
fatal ("specs file malformed after %ld characters", fatal_error ("specs file malformed after %ld characters",
(long) (p - buffer)); (long) (p - buffer));
p1 = p; p1 = p;
/* Find next blank line or end of string. */ /* Find next blank line or end of string. */
...@@ -2381,7 +2390,7 @@ read_specs (const char *filename, int main_p) ...@@ -2381,7 +2390,7 @@ read_specs (const char *filename, int main_p)
} }
if (link_command_spec == 0) if (link_command_spec == 0)
fatal ("spec file has no spec for linking"); fatal_error ("spec file has no spec for linking");
} }
/* Record the names of temporary files we tell compilers to write, /* Record the names of temporary files we tell compilers to write,
...@@ -2709,7 +2718,7 @@ static void ...@@ -2709,7 +2718,7 @@ static void
xputenv (const char *string) xputenv (const char *string)
{ {
if (verbose_flag) if (verbose_flag)
notice ("%s\n", string); fnotice (stderr, "%s\n", string);
putenv (CONST_CAST (char *, string)); putenv (CONST_CAST (char *, string));
} }
...@@ -2910,7 +2919,7 @@ add_sysrooted_prefix (struct path_prefix *pprefix, const char *prefix, ...@@ -2910,7 +2919,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))
fatal ("system path '%s' is not absolute", prefix); fatal_error ("system path '%s' is not absolute", prefix);
if (target_system_root) if (target_system_root)
{ {
...@@ -2982,7 +2991,7 @@ execute (void) ...@@ -2982,7 +2991,7 @@ execute (void)
if (strcmp (argbuf[i], "|") == 0) if (strcmp (argbuf[i], "|") == 0)
{ /* each command. */ { /* each command. */
#if defined (__MSDOS__) || defined (OS2) || defined (VMS) #if defined (__MSDOS__) || defined (OS2) || defined (VMS)
fatal ("-pipe not supported"); fatal_error ("-pipe not supported");
#endif #endif
argbuf[i] = 0; /* termination of command args. */ argbuf[i] = 0; /* termination of command args. */
commands[n_commands].prog = argbuf[i + 1]; commands[n_commands].prog = argbuf[i + 1];
...@@ -3053,7 +3062,7 @@ execute (void) ...@@ -3053,7 +3062,7 @@ execute (void)
return 0; return 0;
} }
#ifdef DEBUG #ifdef DEBUG
notice ("\nGo ahead? (y or n) "); fnotice (stderr, "\nGo ahead? (y or n) ");
fflush (stderr); fflush (stderr);
i = getchar (); i = getchar ();
if (i != '\n') if (i != '\n')
...@@ -3114,7 +3123,7 @@ execute (void) ...@@ -3114,7 +3123,7 @@ execute (void)
if (errmsg != NULL) if (errmsg != NULL)
{ {
if (err == 0) if (err == 0)
fatal (errmsg); fatal_error (errmsg);
else else
{ {
errno = err; errno = err;
...@@ -3169,7 +3178,7 @@ execute (void) ...@@ -3169,7 +3178,7 @@ execute (void)
} }
else else
#endif #endif
fatal_ice ("\ internal_error ("\
Internal error: %s (program %s)\n\ Internal error: %s (program %s)\n\
Please submit a full bug report.\n\ Please submit a full bug report.\n\
See %s for instructions.", See %s for instructions.",
...@@ -3197,7 +3206,8 @@ See %s for instructions.", ...@@ -3197,7 +3206,8 @@ See %s for instructions.",
if (ut + st != 0) if (ut + st != 0)
{ {
if (report_times) if (report_times)
notice ("# %s %.2f %.2f\n", commands[i].prog, ut, st); fnotice (stderr, "# %s %.2f %.2f\n",
commands[i].prog, ut, st);
if (report_times_to_file) if (report_times_to_file)
{ {
...@@ -3912,7 +3922,7 @@ process_command (int argc, const char **argv) ...@@ -3912,7 +3922,7 @@ process_command (int argc, const char **argv)
else if (strcmp (argv[i], "-Xlinker") == 0) else if (strcmp (argv[i], "-Xlinker") == 0)
{ {
if (i + 1 == argc) if (i + 1 == argc)
fatal ("argument to '-Xlinker' is missing"); fatal_error ("argument to '-Xlinker' is missing");
n_infiles++; n_infiles++;
i++; i++;
...@@ -3920,21 +3930,21 @@ process_command (int argc, const char **argv) ...@@ -3920,21 +3930,21 @@ process_command (int argc, const char **argv)
else if (strcmp (argv[i], "-Xpreprocessor") == 0) else if (strcmp (argv[i], "-Xpreprocessor") == 0)
{ {
if (i + 1 == argc) if (i + 1 == argc)
fatal ("argument to '-Xpreprocessor' is missing"); fatal_error ("argument to '-Xpreprocessor' is missing");
add_preprocessor_option (argv[i+1], strlen (argv[i+1])); add_preprocessor_option (argv[i+1], strlen (argv[i+1]));
} }
else if (strcmp (argv[i], "-Xassembler") == 0) else if (strcmp (argv[i], "-Xassembler") == 0)
{ {
if (i + 1 == argc) if (i + 1 == argc)
fatal ("argument to '-Xassembler' is missing"); fatal_error ("argument to '-Xassembler' is missing");
add_assembler_option (argv[i+1], strlen (argv[i+1])); add_assembler_option (argv[i+1], strlen (argv[i+1]));
} }
else if (strcmp (argv[i], "-l") == 0) else if (strcmp (argv[i], "-l") == 0)
{ {
if (i + 1 == argc) if (i + 1 == argc)
fatal ("argument to '-l' is missing"); fatal_error ("argument to '-l' is missing");
n_infiles++; n_infiles++;
i++; i++;
...@@ -3955,7 +3965,7 @@ process_command (int argc, const char **argv) ...@@ -3955,7 +3965,7 @@ process_command (int argc, const char **argv)
|| strcmp (argv[i]+12, "object") == 0) || strcmp (argv[i]+12, "object") == 0)
save_temps_flag = SAVE_TEMPS_OBJ; save_temps_flag = SAVE_TEMPS_OBJ;
else else
fatal ("'%s' is an unknown -save-temps option", argv[i]); fatal_error ("'%s' is an unknown -save-temps option", argv[i]);
} }
else if (strcmp (argv[i], "-no-canonical-prefixes") == 0) else if (strcmp (argv[i], "-no-canonical-prefixes") == 0)
/* Already handled as a special case, so ignored here. */ /* Already handled as a special case, so ignored here. */
...@@ -3969,7 +3979,7 @@ process_command (int argc, const char **argv) ...@@ -3969,7 +3979,7 @@ process_command (int argc, const char **argv)
{ {
struct user_specs *user = XNEW (struct user_specs); struct user_specs *user = XNEW (struct user_specs);
if (++i >= argc) if (++i >= argc)
fatal ("argument to '-specs' is missing"); fatal_error ("argument to '-specs' is missing");
user->next = (struct user_specs *) 0; user->next = (struct user_specs *) 0;
user->filename = argv[i]; user->filename = argv[i];
...@@ -3983,7 +3993,7 @@ process_command (int argc, const char **argv) ...@@ -3983,7 +3993,7 @@ process_command (int argc, const char **argv)
{ {
struct user_specs *user = XNEW (struct user_specs); struct user_specs *user = XNEW (struct user_specs);
if (strlen (argv[i]) == 7) if (strlen (argv[i]) == 7)
fatal ("argument to '-specs=' is missing"); fatal_error ("argument to '-specs=' is missing");
user->next = (struct user_specs *) 0; user->next = (struct user_specs *) 0;
user->filename = argv[i] + 7; user->filename = argv[i] + 7;
...@@ -4011,7 +4021,7 @@ process_command (int argc, const char **argv) ...@@ -4011,7 +4021,7 @@ process_command (int argc, const char **argv)
else if (strcmp (argv[i], "-wrapper") == 0) else if (strcmp (argv[i], "-wrapper") == 0)
{ {
if (++i >= argc) if (++i >= argc)
fatal ("argument to '-wrapper' is missing"); fatal_error ("argument to '-wrapper' is missing");
wrapper_string = argv[i]; wrapper_string = argv[i];
n_switches++; n_switches++;
...@@ -4039,7 +4049,7 @@ process_command (int argc, const char **argv) ...@@ -4039,7 +4049,7 @@ process_command (int argc, const char **argv)
int len; int len;
if (p[1] == 0 && i + 1 == argc) if (p[1] == 0 && i + 1 == argc)
fatal ("argument to '-B' is missing"); fatal_error ("argument to '-B' is missing");
if (p[1] == 0) if (p[1] == 0)
value = argv[++i]; value = argv[++i];
else else
...@@ -4216,7 +4226,7 @@ process_command (int argc, const char **argv) ...@@ -4216,7 +4226,7 @@ process_command (int argc, const char **argv)
{ {
/* -save-temps overrides -pipe, so that temp files are produced */ /* -save-temps overrides -pipe, so that temp files are produced */
if (save_temps_flag) if (save_temps_flag)
error ("warning: -pipe ignored because -save-temps specified"); warning (0, "-pipe ignored because -save-temps specified");
use_pipes = 0; use_pipes = 0;
} }
...@@ -4432,7 +4442,7 @@ process_command (int argc, const char **argv) ...@@ -4432,7 +4442,7 @@ process_command (int argc, const char **argv)
if (c == 'x') if (c == 'x')
{ {
if (p[1] == 0 && i + 1 == argc) if (p[1] == 0 && i + 1 == argc)
fatal ("argument to '-x' is missing"); fatal_error ("argument to '-x' is missing");
if (p[1] == 0) if (p[1] == 0)
spec_lang = argv[++i]; spec_lang = argv[++i];
else else
...@@ -4460,7 +4470,7 @@ process_command (int argc, const char **argv) ...@@ -4460,7 +4470,7 @@ process_command (int argc, const char **argv)
n_args = SWITCH_TAKES_ARG (c) - (p[1] != 0); n_args = SWITCH_TAKES_ARG (c) - (p[1] != 0);
} }
if (i + n_args >= argc) if (i + n_args >= argc)
fatal ("argument to '-%s' is missing", p); fatal_error ("argument to '-%s' is missing", p);
switches[n_switches].args switches[n_switches].args
= XNEWVEC (const char *, n_args + 1); = XNEWVEC (const char *, n_args + 1);
while (j < n_args) while (j < n_args)
...@@ -4552,7 +4562,7 @@ process_command (int argc, const char **argv) ...@@ -4552,7 +4562,7 @@ process_command (int argc, const char **argv)
} }
if (n_infiles == last_language_n_infiles && spec_lang != 0) if (n_infiles == last_language_n_infiles && spec_lang != 0)
error ("warning: '-x %s' after last input file has no effect", spec_lang); warning (0, "'-x %s' after last input file has no effect", spec_lang);
if (compare_debug == 2 || compare_debug == 3) if (compare_debug == 2 || compare_debug == 3)
{ {
...@@ -4715,7 +4725,7 @@ end_going_arg (void) ...@@ -4715,7 +4725,7 @@ end_going_arg (void)
if (full_script_path == NULL) if (full_script_path == NULL)
{ {
error (_("unable to locate default linker script '%s' in the library search paths"), string); error ("unable to locate default linker script '%s' in the library search paths", string);
/* Script was not found on search path. */ /* Script was not found on search path. */
return; return;
} }
...@@ -4903,7 +4913,7 @@ do_self_spec (const char *spec) ...@@ -4903,7 +4913,7 @@ do_self_spec (const char *spec)
/* Each switch should start with '-'. */ /* Each switch should start with '-'. */
if (c != '-') if (c != '-')
fatal ("switch '%s' does not start with '-'", argbuf[i]); fatal_error ("switch '%s' does not start with '-'", argbuf[i]);
p++; p++;
c = *p; c = *p;
...@@ -4927,7 +4937,7 @@ do_self_spec (const char *spec) ...@@ -4927,7 +4937,7 @@ do_self_spec (const char *spec)
n_args = SWITCH_TAKES_ARG (c) - (p[1] != 0); n_args = SWITCH_TAKES_ARG (c) - (p[1] != 0);
} }
if (i + n_args >= argbuf_index) if (i + n_args >= argbuf_index)
fatal ("argument to '-%s' is missing", p); fatal_error ("argument to '-%s' is missing", p);
sw->args sw->args
= XNEWVEC (const char *, n_args + 1); = XNEWVEC (const char *, n_args + 1);
while (j < n_args) while (j < n_args)
...@@ -5019,20 +5029,20 @@ create_at_file (char **argv) ...@@ -5019,20 +5029,20 @@ create_at_file (char **argv)
int status; int status;
if (f == NULL) if (f == NULL)
fatal ("could not open temporary response file %s", fatal_error ("could not open temporary response file %s",
temp_file); temp_file);
status = writeargv (argv, f); status = writeargv (argv, f);
if (status) if (status)
fatal ("could not write to temporary response file %s", fatal_error ("could not write to temporary response file %s",
temp_file); temp_file);
status = fclose (f); status = fclose (f);
if (EOF == status) if (EOF == status)
fatal ("could not close temporary response file %s", fatal_error ("could not close temporary response file %s",
temp_file); temp_file);
store_arg (at_argument, 0, 0); store_arg (at_argument, 0, 0);
...@@ -5133,7 +5143,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) ...@@ -5133,7 +5143,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 ("spec '%s' invalid", spec); fatal_error ("spec '%s' invalid", spec);
case 'b': case 'b':
if (save_temps_length) if (save_temps_length)
...@@ -5209,7 +5219,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) ...@@ -5209,7 +5219,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
buf = (char *) alloca (p - q + 1); buf = (char *) alloca (p - q + 1);
strncpy (buf, q, p - q); strncpy (buf, q, p - q);
buf[p - q] = 0; buf[p - q] = 0;
notice ("%s\n", _(buf)); inform (0, "%s", _(buf));
if (*p) if (*p)
p++; p++;
} }
...@@ -5282,7 +5292,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) ...@@ -5282,7 +5292,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 == '.' || ISALNUM ((unsigned char) *p)) if (*p == '.' || ISALNUM ((unsigned char) *p))
fatal ("spec '%s' has invalid '%%0%c'", spec, *p); fatal_error ("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
...@@ -5591,7 +5601,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) ...@@ -5591,7 +5601,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 != '{')
fatal ("spec '%s' has invalid '%%W%c", spec, *p); fatal_error ("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;
...@@ -5611,7 +5621,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) ...@@ -5611,7 +5621,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 != '{')
fatal ("spec '%s' has invalid '%%x%c'", spec, *p); fatal_error ("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);
...@@ -5815,7 +5825,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) ...@@ -5815,7 +5825,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
%[...] modifies -D options the way %P does; %[...] modifies -D options the way %P does;
%(...) uses the spec unmodified. */ %(...) uses the spec unmodified. */
case '[': case '[':
error ("warning: use of obsolete %%[ operator in specs"); warning (0, "use of obsolete %%[ operator in specs");
case '(': case '(':
{ {
const char *name = p; const char *name = p;
...@@ -5833,7 +5843,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) ...@@ -5833,7 +5843,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
{ {
name = *(sl->ptr_spec); name = *(sl->ptr_spec);
#ifdef DEBUG_SPECS #ifdef DEBUG_SPECS
notice ("Processing spec %c%s%c, which is '%s'\n", fnotice (stderr, "Processing spec %c%s%c, which is '%s'\n",
c, sl->name, (c == '(') ? ')' : ']', name); c, sl->name, (c == '(') ? ')' : ']', name);
#endif #endif
break; break;
...@@ -5958,7 +5968,7 @@ eval_spec_function (const char *func, const char *args) ...@@ -5958,7 +5968,7 @@ eval_spec_function (const char *func, const char *args)
sf = lookup_spec_function (func); sf = lookup_spec_function (func);
if (sf == NULL) if (sf == NULL)
fatal ("unknown spec function '%s'", func); fatal_error ("unknown spec function '%s'", func);
/* Push the spec processing context. */ /* Push the spec processing context. */
save_argbuf_index = argbuf_index; save_argbuf_index = argbuf_index;
...@@ -5978,7 +5988,7 @@ eval_spec_function (const char *func, const char *args) ...@@ -5978,7 +5988,7 @@ eval_spec_function (const char *func, const char *args)
alloc_args (); alloc_args ();
if (do_spec_2 (args) < 0) if (do_spec_2 (args) < 0)
fatal ("error in args to spec function '%s'", func); fatal_error ("error in args to spec function '%s'", func);
/* argbuf_index is an index for the next argument to be inserted, and /* argbuf_index is an index for the next argument to be inserted, and
so contains the count of the args already inserted. */ so contains the count of the args already inserted. */
...@@ -6027,10 +6037,10 @@ handle_spec_function (const char *p) ...@@ -6027,10 +6037,10 @@ handle_spec_function (const char *p)
break; break;
/* Only allow [A-Za-z0-9], -, and _ in function names. */ /* Only allow [A-Za-z0-9], -, and _ in function names. */
if (!ISALNUM (*endp) && !(*endp == '-' || *endp == '_')) if (!ISALNUM (*endp) && !(*endp == '-' || *endp == '_'))
fatal ("malformed spec function name"); fatal_error ("malformed spec function name");
} }
if (*endp != '(') /* ) */ if (*endp != '(') /* ) */
fatal ("no arguments for spec function"); fatal_error ("no arguments for spec function");
func = save_string (p, endp - p); func = save_string (p, endp - p);
p = ++endp; p = ++endp;
...@@ -6049,7 +6059,7 @@ handle_spec_function (const char *p) ...@@ -6049,7 +6059,7 @@ handle_spec_function (const char *p)
} }
/* ( */ /* ( */
if (*endp != ')') if (*endp != ')')
fatal ("malformed spec function arguments"); fatal_error ("malformed spec function arguments");
args = save_string (p, endp - p); args = save_string (p, endp - p);
p = ++endp; p = ++endp;
...@@ -6295,7 +6305,7 @@ handle_braces (const char *p) ...@@ -6295,7 +6305,7 @@ handle_braces (const char *p)
return p; return p;
invalid: invalid:
fatal ("braced spec '%s' is invalid at '%c'", orig, *p); fatal_error ("braced spec '%s' is invalid at '%c'", orig, *p);
#undef SKIP_WHITE #undef SKIP_WHITE
} }
...@@ -6383,7 +6393,7 @@ process_brace_body (const char *p, const char *atom, const char *end_atom, ...@@ -6383,7 +6393,7 @@ process_brace_body (const char *p, const char *atom, const char *end_atom,
return p; return p;
invalid: invalid:
fatal ("braced spec body '%s' is invalid", body); fatal_error ("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
...@@ -6600,7 +6610,7 @@ set_input (const char *filename) ...@@ -6600,7 +6610,7 @@ set_input (const char *filename)
/* On fatal signals, delete all the temporary files. */ /* On fatal signals, delete all the temporary files. */
static void static void
fatal_error (int signum) fatal_signal (int signum)
{ {
signal (signum, SIG_DFL); signal (signum, SIG_DFL);
delete_failure_queue (); delete_failure_queue ();
...@@ -6775,16 +6785,16 @@ main (int argc, char **argv) ...@@ -6775,16 +6785,16 @@ main (int argc, char **argv)
gcc_init_libintl (); gcc_init_libintl ();
if (signal (SIGINT, SIG_IGN) != SIG_IGN) if (signal (SIGINT, SIG_IGN) != SIG_IGN)
signal (SIGINT, fatal_error); signal (SIGINT, fatal_signal);
#ifdef SIGHUP #ifdef SIGHUP
if (signal (SIGHUP, SIG_IGN) != SIG_IGN) if (signal (SIGHUP, SIG_IGN) != SIG_IGN)
signal (SIGHUP, fatal_error); signal (SIGHUP, fatal_signal);
#endif #endif
if (signal (SIGTERM, SIG_IGN) != SIG_IGN) if (signal (SIGTERM, SIG_IGN) != SIG_IGN)
signal (SIGTERM, fatal_error); signal (SIGTERM, fatal_signal);
#ifdef SIGPIPE #ifdef SIGPIPE
if (signal (SIGPIPE, SIG_IGN) != SIG_IGN) if (signal (SIGPIPE, SIG_IGN) != SIG_IGN)
signal (SIGPIPE, fatal_error); signal (SIGPIPE, fatal_signal);
#endif #endif
#ifdef SIGCHLD #ifdef SIGCHLD
/* We *MUST* set SIGCHLD to SIG_DFL so that the wait4() call will /* We *MUST* set SIGCHLD to SIG_DFL so that the wait4() call will
...@@ -7154,7 +7164,7 @@ main (int argc, char **argv) ...@@ -7154,7 +7164,7 @@ main (int argc, char **argv)
else else
/* The error status indicates that only one set of fixed /* The error status indicates that only one set of fixed
headers should be built. */ headers should be built. */
fatal ("not configured with sysroot headers suffix"); fatal_error ("not configured with sysroot headers suffix");
} }
if (print_help_list) if (print_help_list)
...@@ -7200,8 +7210,8 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" ...@@ -7200,8 +7210,8 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
int n; int n;
const char *thrmod; const char *thrmod;
notice ("Target: %s\n", spec_machine); fnotice (stderr, "Target: %s\n", spec_machine);
notice ("Configured with: %s\n", configuration_arguments); fnotice (stderr, "Configured with: %s\n", configuration_arguments);
#ifdef THREAD_MODEL_SPEC #ifdef THREAD_MODEL_SPEC
/* We could have defined THREAD_MODEL_SPEC to "%*" by default, /* We could have defined THREAD_MODEL_SPEC to "%*" by default,
...@@ -7215,7 +7225,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" ...@@ -7215,7 +7225,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
thrmod = thread_model; thrmod = thread_model;
#endif #endif
notice ("Thread model: %s\n", thrmod); fnotice (stderr, "Thread model: %s\n", thrmod);
/* compiler_version is truncated at the first space when initialized /* compiler_version is truncated at the first space when initialized
from version string, so truncate version_string at the first space from version string, so truncate version_string at the first space
...@@ -7226,17 +7236,18 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" ...@@ -7226,17 +7236,18 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
if (! strncmp (version_string, compiler_version, n) if (! strncmp (version_string, compiler_version, n)
&& compiler_version[n] == 0) && compiler_version[n] == 0)
notice ("gcc version %s %s\n", version_string, pkgversion_string); fnotice (stderr, "gcc version %s %s\n", version_string,
pkgversion_string);
else else
notice ("gcc driver version %s %sexecuting gcc version %s\n", fnotice (stderr, "gcc driver version %s %sexecuting gcc version %s\n",
version_string, pkgversion_string, compiler_version); version_string, pkgversion_string, compiler_version);
if (n_infiles == 0) if (n_infiles == 0)
return (0); return (0);
} }
if (n_infiles == added_libraries) if (n_infiles == added_libraries)
fatal ("no input files"); fatal_error ("no input files");
/* Make a place to record the compiler output file names /* Make a place to record the compiler output file names
that correspond to the input files. */ that correspond to the input files. */
...@@ -7285,7 +7296,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" ...@@ -7285,7 +7296,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
} }
if (!combine_inputs && have_c && have_o && lang_n_infiles > 1) if (!combine_inputs && have_c && have_o && lang_n_infiles > 1)
fatal ("cannot specify -o with -c, -S or -E with multiple files"); fatal_error ("cannot specify -o with -c, -S or -E with multiple files");
if (combine_flag && save_temps_flag) if (combine_flag && save_temps_flag)
{ {
...@@ -7319,7 +7330,8 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" ...@@ -7319,7 +7330,8 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
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)
fatal ("spec '%s' is invalid", input_file_compiler->spec); fatal_error ("spec '%s' is invalid",
input_file_compiler->spec);
infiles[i].name = argbuf[have_o_argbuf_index]; infiles[i].name = argbuf[have_o_argbuf_index];
infiles[i].incompiler infiles[i].incompiler
= lookup_compiler (infiles[i].name, = lookup_compiler (infiles[i].name,
...@@ -7397,7 +7409,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" ...@@ -7397,7 +7409,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
else if (compare_debug && debug_check_temp_file[0]) else if (compare_debug && debug_check_temp_file[0])
{ {
if (verbose_flag) if (verbose_flag)
error ("Recompiling with -fcompare-debug"); inform (0, "recompiling with -fcompare-debug");
compare_debug = -compare_debug; compare_debug = -compare_debug;
n_switches = n_switches_debug_check[1]; n_switches = n_switches_debug_check[1];
...@@ -7420,7 +7432,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" ...@@ -7420,7 +7432,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
debug_check_temp_file[1])); debug_check_temp_file[1]));
if (verbose_flag) if (verbose_flag)
error ("Comparing final insns dumps"); inform (0, "comparing final insns dumps");
if (compare_files (debug_check_temp_file)) if (compare_files (debug_check_temp_file))
this_file_error = 1; this_file_error = 1;
...@@ -7510,12 +7522,12 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" ...@@ -7510,12 +7522,12 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
"liblto_plugin.so", R_OK, "liblto_plugin.so", R_OK,
false); false);
if (!linker_plugin_file_spec) if (!linker_plugin_file_spec)
fatal ("-fuse-linker-plugin, but liblto_plugin.so not found"); fatal_error ("-fuse-linker-plugin, but liblto_plugin.so not found");
lto_libgcc_spec = find_a_file (&startfile_prefixes, "libgcc.a", lto_libgcc_spec = find_a_file (&startfile_prefixes, "libgcc.a",
R_OK, true); R_OK, true);
if (!lto_libgcc_spec) if (!lto_libgcc_spec)
fatal ("could not find libgcc.a"); fatal_error ("could not find libgcc.a");
} }
lto_gcc_spec = argv[0]; lto_gcc_spec = argv[0];
...@@ -7544,8 +7556,8 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" ...@@ -7544,8 +7556,8 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
for (i = 0; (int) i < n_infiles; i++) for (i = 0; (int) i < n_infiles; i++)
if (explicit_link_files[i] if (explicit_link_files[i]
&& !(infiles[i].language && infiles[i].language[0] == '*')) && !(infiles[i].language && infiles[i].language[0] == '*'))
error ("%s: linker input file unused because linking not done", warning (0, "%s: linker input file unused because linking not done",
outfiles[i]); outfiles[i]);
/* Delete some or all of the temporary files we made. */ /* Delete some or all of the temporary files we made. */
...@@ -7663,20 +7675,20 @@ perror_with_name (const char *name) ...@@ -7663,20 +7675,20 @@ perror_with_name (const char *name)
void void
fancy_abort (const char *file, int line, const char *func) fancy_abort (const char *file, int line, const char *func)
{ {
fatal_ice ("internal gcc abort in %s, at %s:%d", func, file, line); internal_error ("internal gcc abort in %s, at %s:%d", func, file, line);
} }
/* Output an error message and exit. */ /* Output an error message and exit. */
void void
fatal_ice (const char *cmsgid, ...) internal_error (const char *gmsgid, ...)
{ {
va_list ap; va_list ap;
va_start (ap, cmsgid); va_start (ap, gmsgid);
fprintf (stderr, "%s: ", programname); fprintf (stderr, "%s: ", programname);
vfprintf (stderr, _(cmsgid), ap); vfprintf (stderr, _(gmsgid), ap);
va_end (ap); va_end (ap);
fprintf (stderr, "\n"); fprintf (stderr, "\n");
delete_temp_files (); delete_temp_files ();
...@@ -7684,14 +7696,14 @@ fatal_ice (const char *cmsgid, ...) ...@@ -7684,14 +7696,14 @@ fatal_ice (const char *cmsgid, ...)
} }
void void
fatal (const char *cmsgid, ...) fatal_error (const char *gmsgid, ...)
{ {
va_list ap; va_list ap;
va_start (ap, cmsgid); va_start (ap, gmsgid);
fprintf (stderr, "%s: ", programname); fprintf (stderr, "%s: ", programname);
vfprintf (stderr, _(cmsgid), ap); vfprintf (stderr, _(gmsgid), ap);
va_end (ap); va_end (ap);
fprintf (stderr, "\n"); fprintf (stderr, "\n");
delete_temp_files (); delete_temp_files ();
...@@ -7710,7 +7722,21 @@ error (const char *gmsgid, ...) ...@@ -7710,7 +7722,21 @@ error (const char *gmsgid, ...)
va_list ap; va_list ap;
va_start (ap, gmsgid); va_start (ap, gmsgid);
fprintf (stderr, "%s: ", programname); error_count++;
fprintf (stderr, "%s: %s: ", programname, _("error: "));
vfprintf (stderr, _(gmsgid), ap);
va_end (ap);
fprintf (stderr, "\n");
}
void
warning (int dummy ATTRIBUTE_UNUSED, const char *gmsgid, ...)
{
va_list ap;
va_start (ap, gmsgid);
fprintf (stderr, "%s: %s: ", programname, _("warning: "));
vfprintf (stderr, _(gmsgid), ap); vfprintf (stderr, _(gmsgid), ap);
va_end (ap); va_end (ap);
...@@ -7718,12 +7744,25 @@ error (const char *gmsgid, ...) ...@@ -7718,12 +7744,25 @@ error (const char *gmsgid, ...)
} }
static void static void
notice (const char *cmsgid, ...) inform (int dummy ATTRIBUTE_UNUSED, const char *gmsgid, ...)
{
va_list ap;
va_start (ap, gmsgid);
fprintf (stderr, "%s: %s: ", programname, _("note: "));
vfprintf (stderr, _(gmsgid), ap);
va_end (ap);
fprintf (stderr, "\n");
}
static void
fnotice (FILE *fp, const char *cmsgid, ...)
{ {
va_list ap; va_list ap;
va_start (ap, cmsgid); va_start (ap, cmsgid);
vfprintf (stderr, _(cmsgid), ap); vfprintf (fp, _(cmsgid), ap);
va_end (ap); va_end (ap);
} }
...@@ -7879,7 +7918,8 @@ used_arg (const char *p, int len) ...@@ -7879,7 +7918,8 @@ used_arg (const char *p, int len)
if (*q == '\0') if (*q == '\0')
{ {
invalid_matches: invalid_matches:
fatal ("multilib spec '%s' is invalid", multilib_matches); fatal_error ("multilib spec '%s' is invalid",
multilib_matches);
} }
q++; q++;
} }
...@@ -8070,8 +8110,8 @@ set_multilib_dir (void) ...@@ -8070,8 +8110,8 @@ set_multilib_dir (void)
if (*p == '\0') if (*p == '\0')
{ {
invalid_exclusions: invalid_exclusions:
fatal ("multilib exclusions '%s' is invalid", fatal_error ("multilib exclusions '%s' is invalid",
multilib_exclusions); multilib_exclusions);
} }
if (! ok) if (! ok)
...@@ -8128,8 +8168,8 @@ set_multilib_dir (void) ...@@ -8128,8 +8168,8 @@ set_multilib_dir (void)
if (*p == '\0') if (*p == '\0')
{ {
invalid_select: invalid_select:
fatal ("multilib select '%s' is invalid", fatal_error ("multilib select '%s' is invalid",
multilib_select); multilib_select);
} }
++p; ++p;
} }
...@@ -8269,7 +8309,7 @@ print_multilib_info (void) ...@@ -8269,7 +8309,7 @@ print_multilib_info (void)
if (*p == '\0') if (*p == '\0')
{ {
invalid_select: invalid_select:
fatal ("multilib select '%s' is invalid", multilib_select); fatal_error ("multilib select '%s' is invalid", multilib_select);
} }
++p; ++p;
...@@ -8307,8 +8347,8 @@ print_multilib_info (void) ...@@ -8307,8 +8347,8 @@ print_multilib_info (void)
if (*e == '\0') if (*e == '\0')
{ {
invalid_exclusion: invalid_exclusion:
fatal ("multilib exclusion '%s' is invalid", fatal_error ("multilib exclusion '%s' is invalid",
multilib_exclusions); multilib_exclusions);
} }
if (! m) if (! m)
...@@ -8513,7 +8553,7 @@ getenv_spec_function (int argc, const char **argv) ...@@ -8513,7 +8553,7 @@ getenv_spec_function (int argc, const char **argv)
value = getenv (argv[0]); value = getenv (argv[0]);
if (!value) if (!value)
fatal ("environment variable \"%s\" not defined", argv[0]); fatal_error ("environment variable \"%s\" not defined", argv[0]);
/* We have to escape every character of the environment variable so /* We have to escape every character of the environment variable so
they are not interpreted as active spec characters. A they are not interpreted as active spec characters. A
...@@ -8604,12 +8644,12 @@ compare_version_strings (const char *v1, const char *v2) ...@@ -8604,12 +8644,12 @@ compare_version_strings (const char *v1, const char *v2)
abort (); abort ();
rresult = regexec (&r, v1, 0, NULL, 0); rresult = regexec (&r, v1, 0, NULL, 0);
if (rresult == REG_NOMATCH) if (rresult == REG_NOMATCH)
fatal ("invalid version number `%s'", v1); fatal_error ("invalid version number `%s'", v1);
else if (rresult != 0) else if (rresult != 0)
abort (); abort ();
rresult = regexec (&r, v2, 0, NULL, 0); rresult = regexec (&r, v2, 0, NULL, 0);
if (rresult == REG_NOMATCH) if (rresult == REG_NOMATCH)
fatal ("invalid version number `%s'", v2); fatal_error ("invalid version number `%s'", v2);
else if (rresult != 0) else if (rresult != 0)
abort (); abort ();
...@@ -8652,13 +8692,13 @@ version_compare_spec_function (int argc, const char **argv) ...@@ -8652,13 +8692,13 @@ version_compare_spec_function (int argc, const char **argv)
bool result; bool result;
if (argc < 3) if (argc < 3)
fatal ("too few arguments to %%:version-compare"); fatal_error ("too few arguments to %%:version-compare");
if (argv[0][0] == '\0') if (argv[0][0] == '\0')
abort (); abort ();
if ((argv[0][1] == '<' || argv[0][1] == '>') && argv[0][0] != '!') if ((argv[0][1] == '<' || argv[0][1] == '>') && argv[0][0] != '!')
nargs = 2; nargs = 2;
if (argc != nargs + 3) if (argc != nargs + 3)
fatal ("too many arguments to %%:version-compare"); fatal_error ("too many arguments to %%:version-compare");
switch_len = strlen (argv[nargs + 1]); switch_len = strlen (argv[nargs + 1]);
for (i = 0; i < n_switches; i++) for (i = 0; i < n_switches; i++)
...@@ -8699,7 +8739,7 @@ version_compare_spec_function (int argc, const char **argv) ...@@ -8699,7 +8739,7 @@ version_compare_spec_function (int argc, const char **argv)
break; break;
default: default:
fatal ("unknown operator '%s' in %%:version-compare", argv[0]); fatal_error ("unknown operator '%s' in %%:version-compare", argv[0]);
} }
if (! result) if (! result)
return NULL; return NULL;
...@@ -8796,7 +8836,7 @@ compare_debug_dump_opt_spec_function (int arg, ...@@ -8796,7 +8836,7 @@ compare_debug_dump_opt_spec_function (int arg,
static char random_seed[HOST_BITS_PER_WIDE_INT / 4 + 3]; static char random_seed[HOST_BITS_PER_WIDE_INT / 4 + 3];
if (arg != 0) if (arg != 0)
fatal ("too many arguments to %%:compare-debug-dump-opt"); fatal_error ("too many arguments to %%:compare-debug-dump-opt");
do_spec_2 ("%{fdump-final-insns=*:%*}"); do_spec_2 ("%{fdump-final-insns=*:%*}");
do_spec_1 (" ", 0, NULL); do_spec_1 (" ", 0, NULL);
...@@ -8863,7 +8903,7 @@ compare_debug_self_opt_spec_function (int arg, ...@@ -8863,7 +8903,7 @@ compare_debug_self_opt_spec_function (int arg,
const char **argv ATTRIBUTE_UNUSED) const char **argv ATTRIBUTE_UNUSED)
{ {
if (arg != 0) if (arg != 0)
fatal ("too many arguments to %%:compare-debug-self-opt"); fatal_error ("too many arguments to %%:compare-debug-self-opt");
if (compare_debug >= 0) if (compare_debug >= 0)
return NULL; return NULL;
...@@ -8898,17 +8938,18 @@ compare_debug_auxbase_opt_spec_function (int arg, ...@@ -8898,17 +8938,18 @@ compare_debug_auxbase_opt_spec_function (int arg,
int len; int len;
if (arg == 0) if (arg == 0)
fatal ("too few arguments to %%:compare-debug-auxbase-opt"); fatal_error ("too few arguments to %%:compare-debug-auxbase-opt");
if (arg != 1) if (arg != 1)
fatal ("too many arguments to %%:compare-debug-auxbase-opt"); fatal_error ("too many arguments to %%:compare-debug-auxbase-opt");
if (compare_debug >= 0) if (compare_debug >= 0)
return NULL; return NULL;
len = strlen (argv[0]); len = strlen (argv[0]);
if (len < 3 || strcmp (argv[0] + len - 3, ".gk") != 0) if (len < 3 || strcmp (argv[0] + len - 3, ".gk") != 0)
fatal ("argument to %%:compare-debug-auxbase-opt does not end in .gk"); fatal_error ("argument to %%:compare-debug-auxbase-opt "
"does not end in .gk");
if (debug_auxbase_opt) if (debug_auxbase_opt)
return debug_auxbase_opt; return debug_auxbase_opt;
......
...@@ -59,8 +59,10 @@ struct spec_function ...@@ -59,8 +59,10 @@ struct spec_function
/* These are exported by gcc.c. */ /* These are exported by gcc.c. */
extern int do_spec (const char *); extern int do_spec (const char *);
extern void record_temp_file (const char *, int, int); extern void record_temp_file (const char *, int, int);
extern void fatal (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; extern void fatal_error (const char *, ...)
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
extern void error (const char *, ...) ATTRIBUTE_PRINTF_1; extern void error (const char *, ...) ATTRIBUTE_PRINTF_1;
extern void warning (int, const char *, ...) ATTRIBUTE_PRINTF_2;
extern void pfatal_with_name (const char *) ATTRIBUTE_NORETURN; extern void pfatal_with_name (const char *) ATTRIBUTE_NORETURN;
extern void set_input (const char *); extern void set_input (const char *);
......
2010-05-28 Joseph Myers <joseph@codesourcery.com>
* jvspec.c (lang_specific_driver): Use fatal_error instead of
fatal. Use warning instead of error for warnings.
2010-05-28 Nathan Froyd <froydnj@codesourcery.com> 2010-05-28 Nathan Froyd <froydnj@codesourcery.com>
* expr.c (get_symbol_table_index): Add spaces in expression. * expr.c (get_symbol_table_index): Add spaces in expression.
......
/* Specific flags and argument handling of the front-end of the /* Specific flags and argument handling of the front-end of the
GNU compiler for the Java(TM) language. GNU compiler for the Java(TM) language.
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007 Free Software Foundation, Inc. 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -400,33 +400,33 @@ lang_specific_driver (int *in_argc, const char *const **in_argv, ...@@ -400,33 +400,33 @@ lang_specific_driver (int *in_argc, const char *const **in_argv,
} }
if (quote) if (quote)
fatal ("argument to '%s' missing\n", quote); fatal_error ("argument to '%s' missing\n", quote);
if (saw_D && ! main_class_name) if (saw_D && ! main_class_name)
fatal ("can't specify '-D' without '--main'\n"); fatal_error ("can't specify '-D' without '--main'\n");
if (main_class_name && ! verify_class_name (main_class_name)) if (main_class_name && ! verify_class_name (main_class_name))
fatal ("'%s' is not a valid class name", main_class_name); fatal_error ("'%s' is not a valid class name", main_class_name);
num_args = argc + added; num_args = argc + added;
if (saw_resource) if (saw_resource)
{ {
if (! saw_o) if (! saw_o)
fatal ("--resource requires -o"); fatal_error ("--resource requires -o");
} }
if (saw_C) if (saw_C)
{ {
num_args += 3; num_args += 3;
if (class_files_count + zip_files_count > 0) if (class_files_count + zip_files_count > 0)
{ {
error ("warning: already-compiled .class files ignored with -C"); warning (0, "already-compiled .class files ignored with -C");
num_args -= class_files_count + zip_files_count; num_args -= class_files_count + zip_files_count;
class_files_count = 0; class_files_count = 0;
zip_files_count = 0; 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_error ("cannot specify both -C and -o");
} }
if ((saw_o && java_files_count + class_files_count + zip_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)
...@@ -438,7 +438,7 @@ lang_specific_driver (int *in_argc, const char *const **in_argv, ...@@ -438,7 +438,7 @@ lang_specific_driver (int *in_argc, const char *const **in_argv,
{ {
filelist_filename = make_temp_file ("jx"); filelist_filename = make_temp_file ("jx");
if (filelist_filename == NULL) if (filelist_filename == NULL)
fatal ("cannot create temporary file"); fatal_error ("cannot create temporary file");
record_temp_file (filelist_filename, ! saw_save_temps, 0); record_temp_file (filelist_filename, ! saw_save_temps, 0);
filelist_file = fopen (filelist_filename, "w"); filelist_file = fopen (filelist_filename, "w");
if (filelist_file == NULL) if (filelist_file == NULL)
...@@ -460,7 +460,7 @@ lang_specific_driver (int *in_argc, const char *const **in_argv, ...@@ -460,7 +460,7 @@ lang_specific_driver (int *in_argc, const char *const **in_argv,
if (combine_inputs || indirect_files_count > 0) if (combine_inputs || indirect_files_count > 0)
num_args += 1; /* for "-ffilelist-file" */ 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_error ("using both @FILE with multiple files not implemented");
/* There's no point adding -shared-libgcc if we don't have a shared /* There's no point adding -shared-libgcc if we don't have a shared
libgcc. */ libgcc. */
...@@ -582,7 +582,7 @@ lang_specific_driver (int *in_argc, const char *const **in_argv, ...@@ -582,7 +582,7 @@ lang_specific_driver (int *in_argc, const char *const **in_argv,
if (strncmp (argv[i], "-fmain=", 7) == 0) if (strncmp (argv[i], "-fmain=", 7) == 0)
{ {
if (! will_link) if (! will_link)
fatal ("cannot specify 'main' class when not linking"); fatal_error ("cannot specify 'main' class when not linking");
--j; --j;
continue; continue;
} }
......
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