1.0.30.3: deal with load-time-value constants more aggressively
[sbcl.git] / contrib / sb-grovel / def-to-lisp.lisp
index aa13f2e..4c6cad4 100644 (file)
@@ -16,6 +16,7 @@
 
 (defun c-escape (string &optional (dangerous-chars '(#\")) (escape-char #\\))
   "Escape DANGEROUS-CHARS in STRING, with ESCAPE-CHAR."
+  (declare (simple-string string))
   (coerce (loop for c across string
                 if (member c dangerous-chars) collect escape-char
                 collect c)
@@ -112,10 +113,12 @@ code:
     (dolist (def definitions)
       (destructuring-bind (type lispname cname &optional doc export) def
         (case type
-          (:integer
+          ((:integer :errno)
            (as-c "#ifdef" cname)
            (printf "(cl:defconstant ~A %d \"~A\")" lispname doc
                    cname)
+           (when (eql type :errno)
+             (printf "(cl:setf (get '~A 'errno) t)" lispname))
            (as-c "#else")
            (printf "(sb-int:style-warn \"Couldn't grovel for ~A (unknown to the C compiler).\")" cname)
            (as-c "#endif"))
@@ -204,6 +207,7 @@ code:
                         "-D_FILE_OFFSET_BITS=64")
                       #+(and x86-64 darwin)
                       '("-arch" "x86_64")
+                      #+(and x86-64 sunos) '("-m64")
                       (list "-o"
                             (namestring tmp-a-dot-out)
                             (namestring tmp-c-source)))