Commit 2e3f9f3d by Richard Kenner

Use symbolic codes for exit.

From-SVN: r13938
parent 65ed39df
/* fix-header.c - Make C header file suitable for C++. /* fix-header.c - Make C header file suitable for C++.
Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc. Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the under the terms of the GNU General Public License as published by the
...@@ -624,7 +624,7 @@ read_scan_file (in_fname, argc, argv) ...@@ -624,7 +624,7 @@ read_scan_file (in_fname, argc, argv)
fprintf (stderr, "(%s: %d errors and %d warnings from cpp)\n", fprintf (stderr, "(%s: %d errors and %d warnings from cpp)\n",
inc_filename, scan_in.errors, warnings); inc_filename, scan_in.errors, warnings);
if (scan_in.errors) if (scan_in.errors)
exit (0); exit (SUCCESS_EXIT_CODE);
/* Traditionally, getc and putc are defined in terms of _filbuf and _flsbuf. /* Traditionally, getc and putc are defined in terms of _filbuf and _flsbuf.
If so, those functions are also required. */ If so, those functions are also required. */
...@@ -689,7 +689,7 @@ read_scan_file (in_fname, argc, argv) ...@@ -689,7 +689,7 @@ read_scan_file (in_fname, argc, argv)
{ {
if (verbose) if (verbose)
fprintf (stderr, "%s: OK, nothing needs to be done.\n", inc_filename); fprintf (stderr, "%s: OK, nothing needs to be done.\n", inc_filename);
exit (0); exit (SUCCESS_EXIT_CODE);
} }
if (!verbose) if (!verbose)
fprintf (stderr, "%s: fixing %s\n", progname, inc_filename); fprintf (stderr, "%s: fixing %s\n", progname, inc_filename);
...@@ -1077,7 +1077,7 @@ main (argc, argv) ...@@ -1077,7 +1077,7 @@ main (argc, argv)
{ {
fprintf (stderr, "%s: Usage: foo.h infile.h outfile.h options\n", fprintf (stderr, "%s: Usage: foo.h infile.h outfile.h options\n",
progname); progname);
exit (-1); exit (FATAL_EXIT_CODE);
} }
inc_filename = argv[1]; inc_filename = argv[1];
...@@ -1095,7 +1095,7 @@ main (argc, argv) ...@@ -1095,7 +1095,7 @@ main (argc, argv)
{ {
if (verbose) if (verbose)
fprintf (stderr, "%s: ignoring %s\n", progname, inc_filename); fprintf (stderr, "%s: ignoring %s\n", progname, inc_filename);
exit (0); exit (SUCCESS_EXIT_CODE);
} }
} }
...@@ -1157,13 +1157,13 @@ main (argc, argv) ...@@ -1157,13 +1157,13 @@ main (argc, argv)
fprintf (stderr, "%s: Cannot open '%s' for reading -", fprintf (stderr, "%s: Cannot open '%s' for reading -",
progname, argv[2]); progname, argv[2]);
perror (NULL); perror (NULL);
exit (-1); exit (FATAL_EXIT_CODE);
} }
if (fstat (inf_fd, &sbuf) < 0) if (fstat (inf_fd, &sbuf) < 0)
{ {
fprintf (stderr, "%s: Cannot get size of '%s' -", progname, argv[2]); fprintf (stderr, "%s: Cannot get size of '%s' -", progname, argv[2]);
perror (NULL); perror (NULL);
exit (-1); exit (FATAL_EXIT_CODE);
} }
inf_size = sbuf.st_size; inf_size = sbuf.st_size;
inf_buffer = (char *) xmalloc (inf_size + 2); inf_buffer = (char *) xmalloc (inf_size + 2);
...@@ -1180,7 +1180,7 @@ main (argc, argv) ...@@ -1180,7 +1180,7 @@ main (argc, argv)
{ {
fprintf (stderr, "%s: Failed to read '%s' -", progname, argv[2]); fprintf (stderr, "%s: Failed to read '%s' -", progname, argv[2]);
perror (NULL); perror (NULL);
exit (-1); exit (FATAL_EXIT_CODE);
} }
if (i == 0) if (i == 0)
{ {
...@@ -1203,7 +1203,7 @@ main (argc, argv) ...@@ -1203,7 +1203,7 @@ main (argc, argv)
fprintf (stderr, "%s: Cannot open '%s' for writing -", fprintf (stderr, "%s: Cannot open '%s' for writing -",
progname, argv[3]); progname, argv[3]);
perror (NULL); perror (NULL);
exit (-1); exit (FATAL_EXIT_CODE);
} }
lineno = 1; lineno = 1;
......
/* Gcov.c: prepend line execution counts and branch probabilities to a /* Gcov.c: prepend line execution counts and branch probabilities to a
source file. source file.
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1996, 1997 Free Software Copyright (C) 1990, 91, 92, 93, 94, 96, 1997 Free Software Foundation, Inc.
Foundation, Inc.
Contributed by James E. Wilson of Cygnus Support. Contributed by James E. Wilson of Cygnus Support.
Mongled by Bob Manson of Cygnus Support. Mongled by Bob Manson of Cygnus Support.
...@@ -252,7 +251,7 @@ xmalloc (size) ...@@ -252,7 +251,7 @@ xmalloc (size)
if (value == 0) if (value == 0)
{ {
fprintf (stderr, "error: virtual memory exhausted"); fprintf (stderr, "error: virtual memory exhausted");
exit (1); exit (FATAL_EXIT_CODE);
} }
return value; return value;
} }
......
/* Protoize program - Original version by Ron Guilmette (rfg@segfault.us.com). /* Protoize program - Original version by Ron Guilmette (rfg@segfault.us.com).
Copyright (C) 1989, 92-95, 1996 Free Software Foundation, Inc. Copyright (C) 1989, 92-96, 1997 Free Software Foundation, Inc.
This file is part of GNU CC. This file is part of GNU CC.
...@@ -666,7 +666,7 @@ xmalloc (byte_count) ...@@ -666,7 +666,7 @@ xmalloc (byte_count)
if (rv == NULL) if (rv == NULL)
{ {
fprintf (stderr, "\n%s: virtual memory exceeded\n", pname); fprintf (stderr, "\n%s: virtual memory exceeded\n", pname);
exit (1); exit (FATAL_EXIT_CODE);
return 0; /* avoid warnings */ return 0; /* avoid warnings */
} }
else else
...@@ -686,7 +686,7 @@ xrealloc (old_space, byte_count) ...@@ -686,7 +686,7 @@ xrealloc (old_space, byte_count)
if (rv == NULL) if (rv == NULL)
{ {
fprintf (stderr, "\n%s: virtual memory exceeded\n", pname); fprintf (stderr, "\n%s: virtual memory exceeded\n", pname);
exit (1); exit (FATAL_EXIT_CODE);
return 0; /* avoid warnings */ return 0; /* avoid warnings */
} }
else else
...@@ -739,7 +739,7 @@ void ...@@ -739,7 +739,7 @@ void
fancy_abort () fancy_abort ()
{ {
fprintf (stderr, "%s: internal abort\n", pname); fprintf (stderr, "%s: internal abort\n", pname);
exit (1); exit (FATAL_EXIT_CODE);
} }
/* Make a duplicate of the first N bytes of a given string in a newly /* Make a duplicate of the first N bytes of a given string in a newly
...@@ -877,7 +877,7 @@ usage () ...@@ -877,7 +877,7 @@ usage ()
fprintf (stderr, "%s: usage '%s [ -VqfnkNlgC ] [ -B <dirname> ] [ filename ... ]'\n", fprintf (stderr, "%s: usage '%s [ -VqfnkNlgC ] [ -B <dirname> ] [ filename ... ]'\n",
pname, pname); pname, pname);
#endif /* !defined (UNPROTOIZE) */ #endif /* !defined (UNPROTOIZE) */
exit (1); exit (FATAL_EXIT_CODE);
} }
/* Return true if the given filename (assumed to be an absolute filename) /* Return true if the given filename (assumed to be an absolute filename)
...@@ -1364,18 +1364,18 @@ abspath (cwd, rel_filename) ...@@ -1364,18 +1364,18 @@ abspath (cwd, rel_filename)
while (outp >= abs_buffer && *outp != '/') while (outp >= abs_buffer && *outp != '/')
outp--; outp--;
if (outp < abs_buffer) if (outp < abs_buffer)
{ {
/* Catch cases like /.. where we try to backup to a /* Catch cases like /.. where we try to backup to a
point above the absolute root of the logical file point above the absolute root of the logical file
system. */ system. */
fprintf (stderr, "%s: invalid file name: %s\n", fprintf (stderr, "%s: invalid file name: %s\n",
pname, rel_filename); pname, rel_filename);
exit (1); exit (FATAL_EXIT_CODE);
} }
*++outp = '\0'; *++outp = '\0';
continue; continue;
} }
} }
*outp++ = *inp++; *outp++ = *inp++;
} }
...@@ -1541,7 +1541,7 @@ aux_info_corrupted () ...@@ -1541,7 +1541,7 @@ aux_info_corrupted ()
{ {
fprintf (stderr, "\n%s: fatal error: aux info file corrupted at line %d\n", fprintf (stderr, "\n%s: fatal error: aux info file corrupted at line %d\n",
pname, current_aux_info_lineno); pname, current_aux_info_lineno);
exit (1); exit (FATAL_EXIT_CODE);
} }
/* ??? This comment is vague. Say what the condition is for. */ /* ??? This comment is vague. Say what the condition is for. */
...@@ -1867,7 +1867,7 @@ save_def_or_dec (l, is_syscalls) ...@@ -1867,7 +1867,7 @@ save_def_or_dec (l, is_syscalls)
def_dec_p->file->hash_entry->symbol, def_dec_p->file->hash_entry->symbol,
def_dec_p->line, def_dec_p->line,
def_dec_p->hash_entry->symbol); def_dec_p->hash_entry->symbol);
exit (1); exit (FATAL_EXIT_CODE);
} }
free_def_dec (def_dec_p); free_def_dec (def_dec_p);
return; return;
...@@ -4575,7 +4575,7 @@ main (argc, argv) ...@@ -4575,7 +4575,7 @@ main (argc, argv)
{ {
fprintf (stderr, "%s: cannot get working directory: %s\n", fprintf (stderr, "%s: cannot get working directory: %s\n",
pname, my_strerror(errno)); pname, my_strerror(errno));
exit (1); exit (FATAL_EXIT_CODE);
} }
/* By default, convert the files in the current directory. */ /* By default, convert the files in the current directory. */
...@@ -4700,9 +4700,8 @@ main (argc, argv) ...@@ -4700,9 +4700,8 @@ main (argc, argv)
fprintf (stderr, "%s: %s\n", pname, version_string); fprintf (stderr, "%s: %s\n", pname, version_string);
do_processing (); do_processing ();
} }
if (errors)
exit (1); exit (errors ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
else
exit (0);
return 1; return 1;
} }
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