0.9.15.33:
[sbcl.git] / contrib / sb-grovel / def-to-lisp.lisp
index 32b448d..1356609 100644 (file)
@@ -5,6 +5,15 @@
 (defun escape-for-string (string)
   (c-escape string))
 
+(defun split-cflags (string)
+  (remove-if (lambda (flag)
+               (zerop (length flag)))
+             (loop
+                for start = 0 then (if end (1+ end) nil)
+                for end = (and start (position #\Space string :start start))
+                while start
+                collect (subseq string start end))))
+
 (defun c-escape (string &optional (dangerous-chars '(#\")) (escape-char #\\))
   "Escape DANGEROUS-CHARS in STRING, with ESCAPE-CHAR."
   (coerce (loop for c across string
@@ -175,15 +184,16 @@ code:
     (funcall (intern "C-CONSTANTS-EXTRACT" (find-package "SB-GROVEL"))
              filename tmp-c-source (constants-package component))
     (let ((code (sb-ext:process-exit-code
-                 (sb-ext:run-program "gcc"
-                                     (append
-                                      (sb-ext:posix-getenv "EXTRA_CFLAGS")
-                                      (list "-o"
-                                            (namestring tmp-a-dot-out)
-                                            (namestring tmp-c-source)))
-                                     :search t
-                                     :input nil
-                                     :output *trace-output*))))
+                 (sb-ext:run-program
+                  "gcc"
+                  (append
+                   (split-cflags (sb-ext:posix-getenv "EXTRA_CFLAGS"))
+                   (list "-o"
+                         (namestring tmp-a-dot-out)
+                         (namestring tmp-c-source)))
+                  :search t
+                  :input nil
+                  :output *trace-output*))))
       (unless (= code 0)
         (case (operation-on-failure op)
           (:warn (warn "~@<C compiler failure when performing ~A on ~A.~@:>"