
Raymond Toy pushed to branch issue-386-generate-def-unix-error at cmucl / cmucl Commits: 17859fdd by Raymond Toy at 2025-03-01T05:38:46-08:00 Ignore duplicate errno values Put the awk script in the new file create-def-unix-error.awk. This script pretty much does what the previous version did, but it checks to see if we have a duplicate errno value in the file and just ignores it, assuming the first occurrence is what we want. Update create-errno.sh to call this script. Duplicates appear to happen on Darwin, where EOPNOTSUPP occurs twice due to #if's selecting one or the other. We assume here that the latter is not what we want. This is a gross hack. - - - - - 2 changed files: - + bin/create-def-unix-error.awk - bin/create-errno.sh Changes: ===================================== bin/create-def-unix-error.awk ===================================== @@ -0,0 +1,22 @@ +BEGIN { + count = 0 +} + +# Find anything that matches '#define Efoo value' +/^#define[ \t]+(E[A-Z0-9]+)[ \t]+([A-Z0-9]+).*$/ { + # If we haven't found $2 in errno before, add it to the table. + # This is to catch any duplicates. We assume the latter value is + # NOT what we want. This happens on Darwin where EOPNOSUPP is + # defined twice due to #if's. + if (!($2 in errno)) { + errno[count] = $2; + value[count] = $3; + ++count; + } +} + +END { + for (k = 0; k < count; ++k) { + printf "(def-unix-error %s %s)\n", errno[k], value[k]; + } +} ===================================== bin/create-errno.sh ===================================== @@ -23,9 +23,7 @@ case `uname -s` in ;; esac -awk '/^#define[ \t]+(E[A-Z0-9]+)[ \t]+([A-Z0-9]+).*$/ { - printf "(def-unix-error %s %s)\n", $2, $3; -}' "$@" ${ERRNO_FILES} >> $OUTPUT +awk -f bin/create-def-unix-error.awk ${ERRNO_FILES} >> $OUTPUT # The tail was also copied from code/unix.lisp. It's needed to tell # Lisp about the errno values. View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/17859fddd84b302482b8614d... -- View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/17859fddd84b302482b8614d... You're receiving this email because of your account on gitlab.common-lisp.net.
participants (1)
-
Raymond Toy (@rtoy)