Use symbolic codes for exit.

From-SVN: r13938
This commit is contained in:
Richard Kenner 1997-04-20 12:39:28 -04:00
parent 65ed39df89
commit 2e3f9f3d62
3 changed files with 31 additions and 33 deletions

View File

@ -1,5 +1,5 @@
/* 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
under the terms of the GNU General Public License as published by the
@ -624,7 +624,7 @@ read_scan_file (in_fname, argc, argv)
fprintf (stderr, "(%s: %d errors and %d warnings from cpp)\n",
inc_filename, scan_in.errors, warnings);
if (scan_in.errors)
exit (0);
exit (SUCCESS_EXIT_CODE);
/* Traditionally, getc and putc are defined in terms of _filbuf and _flsbuf.
If so, those functions are also required. */
@ -689,7 +689,7 @@ read_scan_file (in_fname, argc, argv)
{
if (verbose)
fprintf (stderr, "%s: OK, nothing needs to be done.\n", inc_filename);
exit (0);
exit (SUCCESS_EXIT_CODE);
}
if (!verbose)
fprintf (stderr, "%s: fixing %s\n", progname, inc_filename);
@ -1077,7 +1077,7 @@ main (argc, argv)
{
fprintf (stderr, "%s: Usage: foo.h infile.h outfile.h options\n",
progname);
exit (-1);
exit (FATAL_EXIT_CODE);
}
inc_filename = argv[1];
@ -1095,7 +1095,7 @@ main (argc, argv)
{
if (verbose)
fprintf (stderr, "%s: ignoring %s\n", progname, inc_filename);
exit (0);
exit (SUCCESS_EXIT_CODE);
}
}
@ -1157,13 +1157,13 @@ main (argc, argv)
fprintf (stderr, "%s: Cannot open '%s' for reading -",
progname, argv[2]);
perror (NULL);
exit (-1);
exit (FATAL_EXIT_CODE);
}
if (fstat (inf_fd, &sbuf) < 0)
{
fprintf (stderr, "%s: Cannot get size of '%s' -", progname, argv[2]);
perror (NULL);
exit (-1);
exit (FATAL_EXIT_CODE);
}
inf_size = sbuf.st_size;
inf_buffer = (char *) xmalloc (inf_size + 2);
@ -1180,7 +1180,7 @@ main (argc, argv)
{
fprintf (stderr, "%s: Failed to read '%s' -", progname, argv[2]);
perror (NULL);
exit (-1);
exit (FATAL_EXIT_CODE);
}
if (i == 0)
{
@ -1203,7 +1203,7 @@ main (argc, argv)
fprintf (stderr, "%s: Cannot open '%s' for writing -",
progname, argv[3]);
perror (NULL);
exit (-1);
exit (FATAL_EXIT_CODE);
}
lineno = 1;

View File

@ -1,7 +1,6 @@
/* Gcov.c: prepend line execution counts and branch probabilities to a
source file.
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1996, 1997 Free Software
Foundation, Inc.
Copyright (C) 1990, 91, 92, 93, 94, 96, 1997 Free Software Foundation, Inc.
Contributed by James E. Wilson of Cygnus Support.
Mongled by Bob Manson of Cygnus Support.
@ -252,7 +251,7 @@ xmalloc (size)
if (value == 0)
{
fprintf (stderr, "error: virtual memory exhausted");
exit (1);
exit (FATAL_EXIT_CODE);
}
return value;
}

View File

@ -1,5 +1,5 @@
/* 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.
@ -666,7 +666,7 @@ xmalloc (byte_count)
if (rv == NULL)
{
fprintf (stderr, "\n%s: virtual memory exceeded\n", pname);
exit (1);
exit (FATAL_EXIT_CODE);
return 0; /* avoid warnings */
}
else
@ -686,7 +686,7 @@ xrealloc (old_space, byte_count)
if (rv == NULL)
{
fprintf (stderr, "\n%s: virtual memory exceeded\n", pname);
exit (1);
exit (FATAL_EXIT_CODE);
return 0; /* avoid warnings */
}
else
@ -739,7 +739,7 @@ void
fancy_abort ()
{
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
@ -877,7 +877,7 @@ usage ()
fprintf (stderr, "%s: usage '%s [ -VqfnkNlgC ] [ -B <dirname> ] [ filename ... ]'\n",
pname, pname);
#endif /* !defined (UNPROTOIZE) */
exit (1);
exit (FATAL_EXIT_CODE);
}
/* Return true if the given filename (assumed to be an absolute filename)
@ -1364,18 +1364,18 @@ abspath (cwd, rel_filename)
while (outp >= abs_buffer && *outp != '/')
outp--;
if (outp < abs_buffer)
{
/* Catch cases like /.. where we try to backup to a
point above the absolute root of the logical file
system. */
{
/* Catch cases like /.. where we try to backup to a
point above the absolute root of the logical file
system. */
fprintf (stderr, "%s: invalid file name: %s\n",
pname, rel_filename);
exit (1);
}
fprintf (stderr, "%s: invalid file name: %s\n",
pname, rel_filename);
exit (FATAL_EXIT_CODE);
}
*++outp = '\0';
continue;
}
}
}
*outp++ = *inp++;
}
@ -1541,7 +1541,7 @@ aux_info_corrupted ()
{
fprintf (stderr, "\n%s: fatal error: aux info file corrupted at line %d\n",
pname, current_aux_info_lineno);
exit (1);
exit (FATAL_EXIT_CODE);
}
/* ??? This comment is vague. Say what the condition is for. */
@ -1867,7 +1867,7 @@ save_def_or_dec (l, is_syscalls)
def_dec_p->file->hash_entry->symbol,
def_dec_p->line,
def_dec_p->hash_entry->symbol);
exit (1);
exit (FATAL_EXIT_CODE);
}
free_def_dec (def_dec_p);
return;
@ -4575,7 +4575,7 @@ main (argc, argv)
{
fprintf (stderr, "%s: cannot get working directory: %s\n",
pname, my_strerror(errno));
exit (1);
exit (FATAL_EXIT_CODE);
}
/* By default, convert the files in the current directory. */
@ -4700,9 +4700,8 @@ main (argc, argv)
fprintf (stderr, "%s: %s\n", pname, version_string);
do_processing ();
}
if (errors)
exit (1);
else
exit (0);
exit (errors ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
return 1;
}