General code cleanup.
authorRichard Kenner <kenner@gcc.gnu.org>
Sat, 1 Apr 1995 12:02:06 +0000 (07:02 -0500)
committerRichard Kenner <kenner@gcc.gnu.org>
Sat, 1 Apr 1995 12:02:06 +0000 (07:02 -0500)
commit25cbb59e7c7196b7a4bd237bc825ccb324ed24e3
treeedc8f36367448824d407fe6a733d892632f782c0
parent3378918eed6e1f5b263726908c2d7f9b8e5f6b68
General code cleanup.

Add prototypes for static functions.
Remove unnecessary casts to (char *); add casts to (U_CHAR *).
Add parentheses suggested by `gcc -Wparentheses'.
Rename local variables as suggested by `gcc -Wshadow'.
<fcntl.h>, <stdlib.h>, <string.h>, <unistd.h>: New includes.
<sys/time.h>, <sys/resource.h>: Include only if defined(RLIMIT_STACK).
<time.h>: Include, unless <sys/time.h> already does.
(HAVE_FCNTL_H, HAVE_STDLIB_H, HAVE_SYS_TIME_H): New symbols.
(HAVE_UNISTD_H, STDC_HEADERS, TIME_WITH_SYS_TIME): Likewise.
(__attribute__, PROTO, VA_START, PRINTF_ALIST, PRINTF_DCL): New macros.
(PRINTF_PROTO{,_1,_2,_3}, DO_PROTO): Likewise.
(bcopy, bzero, bcmp): If #defined by configuration file, use that.
If STDC_HEADERS is defined, use standard C functions.
If BSTRING is defined, or USG and VMS are not defined, use
the C library.  Otherwise, use my_bcopy, my_bzero, my_bcmp.
(localtime): Remove no-longer-necessary explicit declaration.
(getenv, index, rindex): Don't declare explicitly if the appropriate system
eader should declare it.
(fdopen): Remove no-longer-used declaration.
(vprintf): Define a subsitute macro if !defined(HAVE_VPRINTF).
(main): Replace `fdopen (dup (fileno (stdout)), "w"))' with `stdout'.
(get_lintcmd, rescan, create_definition): Use bcmp instead of strncmp when both
operands are known to be free of null bytes.
(check_macro_name, compare_defs, collect_expansion): Likewise.
(do_assert, compare_token_lists, assertion_lookup, do_line): Likewise.
(skip_if_group, lookup): Likewise.
(rescan): Remove unused label `startagain'.
Abort instead of printing nonsense if the stack is corrupted when there was an
unterminated successful conditional.
(pcfinclude): Include explicit double-cast through GENERICPTR to identify
particularly egregious type puns.
(create_definition, do_define, check_macro_name): Use %.*s printf format to
avoid painful copying-and-casting.
(do_once): Return void, not (unused) int.
(do_ident, do_pragma, do_sccs): Accept extra arguments so that all
directive-handler's types match.
(do_sccs): Define only if SCCS_DIRECTIVE is defined.
(skip_if_group, dump_single_macro): Add `default: break;' to keep -Wswitch
happy.
(error, warning, error_with_line, vwarning_with_line, pedwarn): Use
stdarg/vararg/vfprintf instead of passing bogus char * args around.
(pedwarn_with_line, pedwarn_with_file_and_line, fatal):  Likewise.
(verror, vwarning, verror_with_line, vwarning_with_line): New fcns.
(dump_single_macro): Abort if ap points to garbage.
(make_definition, make_undef, make_assertion): Parameter now char *.
(xmalloc, xrealloc, xcalloc, savestring, index0): Make sizes size_t
instead of unsigned; make pointer parameters GENERICPTR, not char *.
(xcalloc): Use bzero to clear memory instead of using own loop.

From-SVN: r9278
gcc/cccp.c