]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/hash-table.c
Correct a function pre/postcondition [PR102403].
[thirdparty/gcc.git] / gcc / hash-table.c
index bff9644ae8137ebaf0af4b00979dce6643857016..a1603ee017044e6696552152ed65bd64456a54e9 100644 (file)
@@ -1,5 +1,5 @@
 /* A type-safe hash table template.
-   Copyright (C) 2012-2018 Free Software Foundation, Inc.
+   Copyright (C) 2012-2021 Free Software Foundation, Inc.
    Contributed by Lawrence Crowl <crowl@google.com>
 
 This file is part of GCC.
@@ -74,8 +74,11 @@ struct prime_ent const prime_tab[] = {
   { 0xfffffffb, 0x00000006, 0x00000008, 31 }
 };
 
+/* Limit number of comparisons when calling hash_table<>::verify.  */
+unsigned int hash_table_sanitize_eq_limit;
+
 /* The following function returns an index into the above table of the
-   nearest prime number which is greater than N, and near a power of two. */
+   nearest prime number which is at least N, and near a power of two. */
 
 unsigned int
 hash_table_higher_prime_index (unsigned long n)
@@ -121,3 +124,15 @@ void dump_hash_table_loc_statistics (void)
       hash_table_usage ().dump (origin);
     }
 }
+
+/* Report a hash table checking error.  */
+
+ATTRIBUTE_NORETURN ATTRIBUTE_COLD
+void
+hashtab_chk_error ()
+{
+  fprintf (stderr, "hash table checking failed: "
+          "equal operator returns true for a pair "
+          "of values with a different hash value\n");
+  gcc_unreachable ();
+}