diff options
author | bothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1995-04-05 21:16:26 +0000 |
---|---|---|
committer | bothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1995-04-05 21:16:26 +0000 |
commit | ff8281e42fe545a0b86d5f185b9f44ea4f4c55a2 (patch) | |
tree | 444e0bc9b38ad6819d87db5007348f663acf5e60 /gcc/gen-protos.c | |
parent | ad0e2334a8dbbaec4d046a4929b08571197a8ec8 (diff) |
Re-write fixproto/fix-header/etc to use cpplib.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@9316 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gen-protos.c')
-rw-r--r-- | gcc/gen-protos.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/gcc/gen-protos.c b/gcc/gen-protos.c index 094ce2a4fca..3b5c6108bfb 100644 --- a/gcc/gen-protos.c +++ b/gcc/gen-protos.c @@ -19,9 +19,25 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <ctype.h> #include "hconfig.h" #include "scan.h" +#include "cpplib.h" +#include "cpphash.h" #define HASH_SIZE 2503 /* a prime */ +int +hashf (name, len, hashsize) + register U_CHAR *name; + register int len; + int hashsize; +{ + register int r = 0; + + while (len--) + r = HASHSTEP (r, *name++); + + return MAKE_POS (r) % hashsize; +} + int hash_tab[HASH_SIZE]; int verbose = 0; @@ -119,7 +135,7 @@ main (argc, argv) /* NOTE: If you edit this, also edit lookup_std_proto in fix-header.c !! */ - i = hash (name_start) % HASH_SIZE; + i = hashf (name_start, name_end - name_start, HASH_SIZE); i0 = i; if (hash_tab[i] != 0) { @@ -153,3 +169,14 @@ main (argc, argv) return 0; } + +void +fatal (s) + char *s; +{ + fprintf (stderr, "%s: %s\n", "gen-protos", s); +#ifndef FAILURE_EXIT_CODE +#define FAILURE_EXIT_CODE 33 /* gnu cc command understands this */ +#endif + exit (FAILURE_EXIT_CODE); +} |