aboutsummaryrefslogtreecommitdiff
path: root/gcc/gen-protos.c
diff options
context:
space:
mode:
authorPer Bothner <bothner@gcc.gnu.org>1995-04-05 14:16:26 -0700
committerPer Bothner <bothner@gcc.gnu.org>1995-04-05 14:16:26 -0700
commitb3ca463cdad1c4d09304baf3841906be92681d0a (patch)
tree444e0bc9b38ad6819d87db5007348f663acf5e60 /gcc/gen-protos.c
parent355142da80432e9a21bc56a8f796636967ea5622 (diff)
downloadgcc-b3ca463cdad1c4d09304baf3841906be92681d0a.zip
gcc-b3ca463cdad1c4d09304baf3841906be92681d0a.tar.gz
gcc-b3ca463cdad1c4d09304baf3841906be92681d0a.tar.bz2
Re-write fixproto/fix-header/etc to use cpplib.
From-SVN: r9316
Diffstat (limited to 'gcc/gen-protos.c')
-rw-r--r--gcc/gen-protos.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/gcc/gen-protos.c b/gcc/gen-protos.c
index 094ce2a..3b5c610 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);
+}