From 33cd4b10aca2e097e1d03fe4d5ee725f4f207131 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 22 Aug 2023 21:03:12 -0700 Subject: genman: guard against symbol hash collisions. * genman.txr (process-ambiguities): Keep track of calculated hashes and error out when there is a duplicate. When the time comes, we will have to resolve those somehow, and also change the doc function to do it the same way. --- genman.txr | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/genman.txr b/genman.txr index d1593cfb..6ef0404b 100644 --- a/genman.txr +++ b/genman.txr @@ -42,12 +42,16 @@ `TOC-@sec`) (defun process-ambiguities (hash) - (dohash (sym tags hash) - (let ((shash (fmt "S-~,08X" (crc32 sym)))) - (set [hash sym] shash) - (if (null (cdr tags)) - (push shash [direct (car tags)]) - (set [disamb shash] (reverse tags))))))) + (let ((rhash (hash))) + (dohash (sym tags hash) + (let ((shash (fmt "S-~,08X" (crc32 sym)))) + (if [rhash shash] + (error "~a ~a hash collision" sym [rhash shash]) + (set [rhash shash] sym)) + (set [hash sym] shash) + (if (null (cdr tags)) + (push shash [direct (car tags)]) + (set [disamb shash] (reverse tags)))))))) Content-type: text/html @(skip 15)

TXR

-- cgit v1.2.3