2 exec guile -q -s "$0" "$@"
5 ;; The use of certain identifiers as variable or parameter names has
6 ;; been found to cause build problems on particular platforms. The
7 ;; aim of this test is to cause "make check" to fail (on GNU/Linux,
8 ;; which most Guile developers use) if we accidentally add new code
9 ;; that uses those identifiers.
11 (define bad-identifiers
13 ;; On AIX 5.2 and 5.3, /usr/include/sys/timer.h includes:
14 ;; #ifndef _LINUX_SOURCE_COMPAT
15 ;; #define func_data t_union.data
17 ;; So we want to avoid using func_data in Guile source code.
20 ;; More troublesome identifiers can be added into the list here.
23 (use-modules (ice-9 regex) (ice-9 rdelim))
26 (make-regexp (string-append "\\<("
27 (string-join (map regexp-quote bad-identifiers) "|")
30 (define exit-status 0)
32 ;; Non-exported code from (ice-9 ftw).
33 (define (directory-files dir)
34 (let ((dir-stream (opendir dir)))
35 (let loop ((new (readdir dir-stream))
41 (loop (readdir dir-stream)
42 (if (or (string=? "." new) ;;; ignore
43 (string=? ".." new)) ;;; ignore
45 (cons (in-vicinity dir new) acc)))))))
47 (define (directory-files-matching dir pattern)
48 (let ((file-name-regexp (make-regexp pattern)))
50 (regexp-exec file-name-regexp fn))
51 (directory-files dir))))
53 (let loop ((file-names (directory-files-matching "../../libguile"
55 (or (null? file-names)
57 (with-input-from-file (car file-names)
59 (let loop ((linenum 1) (line (read-line)))
60 (or (eof-object? line)
62 (if (regexp-exec bad-id-regexp line)
65 (format (current-error-port)
70 (loop (+ linenum 1) (read-line)))))))
71 (loop (cdr file-names)))))