chiark / gitweb /
src/: Style cleanup: use constant names for types where available.
authorMark Wooding <mdw@distorted.org.uk>
Wed, 16 Dec 2015 05:25:51 +0000 (05:25 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 29 May 2016 13:40:40 +0000 (14:40 +0100)
For example, say `c-type-int' rather than `(c-type int)'.

src/class-make-impl.lisp
src/class-utilities.lisp
src/codegen-test.lisp
src/method-impl.lisp
src/method-proto.lisp

index 906519b7ac2826007deae310afcca7fff52f094b..8aacd400ba4650040d9296e58933fd280b0909e9 100644 (file)
@@ -226,7 +226,8 @@ (defmethod shared-initialize :after
                (every (lambda (arg)
                         (or (eq arg :ellipsis)
                             (argument-name arg)
-                            (eq (argument-type arg) (c-type void))))
+                            (c-type-equal-p (argument-type arg)
+                                            c-type-void)))
                       (c-function-arguments type)))
       (error "Abstract declarators not permitted in method definitions")))
 
index d57d07dd8286e622f03bd5b680cb98a18dd97690..573c6779b65500356df891a2947102b562812137 100644 (file)
@@ -161,7 +161,7 @@ (defun argument-lists-compatible-p (message-args method-args)
        (every (lambda (message-arg method-arg)
                (if (eq message-arg :ellipsis)
                    (c-type-equal-p (argument-type method-arg)
-                                   (c-type va-list))
+                                   c-type-va-list)
                    (c-type-equal-p (argument-type message-arg)
                                    (argument-type method-arg))))
              message-args method-args)))
index c01dc8cd1b346823b768180ae52298f11e2384af..81fa3e0f494ef0878b37092fc9b2145dc433f8bb 100644 (file)
@@ -35,13 +35,13 @@ (defun make-gcd (codegen)
 
   (codegen-push codegen)
   (loop for (name init) in '(("aa" 1) ("bb" 0))
-       do (ensure-var codegen name (c-type int) init))
+       do (ensure-var codegen name c-type-int init))
   (codegen-push codegen)
-  (with-temporary-var (codegen r (c-type int))
+  (with-temporary-var (codegen r c-type-int)
     (emit-inst codegen(make-set-inst r "u%v"))
-    (with-temporary-var (codegen q (c-type int))
+    (with-temporary-var (codegen q c-type-int)
       (emit-inst codegen (make-set-inst q "u/v"))
-      (with-temporary-var (codegen a (c-type int))
+      (with-temporary-var (codegen a c-type-int)
        (emit-insts codegen
                    (list (make-set-inst a "aa")
                          (make-set-inst "aa" "bb")
@@ -62,8 +62,8 @@ (defun make-gcd (codegen)
   (loop for (name init) in '(("u" "atoi(argv[1])")
                             ("v" "atoi(argv[2])")
                             ("a"))
-       do (ensure-var codegen name (c-type int) init))
-  (ensure-var codegen "g" (c-type int)
+       do (ensure-var codegen name c-type-int init))
+  (ensure-var codegen "g" c-type-int
              (make-call-inst "gcd" (list "u" "v" "&a")))
   (emit-inst codegen (make-expr-inst
                      (make-call-inst "printf"
index 6f22a142f92f9e487ca7858db4758fd3ff4a26e7..725a0ec2b817555159fc221ef5112bd995799b2e 100644 (file)
@@ -55,7 +55,7 @@ (define-on-demand-slot basic-message argument-tail (message)
 (define-on-demand-slot basic-message no-varargs-tail (message)
   (mapcar (lambda (arg)
            (if (eq arg :ellipsis)
-               (make-argument *sod-ap* (c-type va-list))
+               (make-argument *sod-ap* c-type-va-list)
                arg))
          (sod-message-argument-tail message)))
 
@@ -147,7 +147,7 @@ (defmethod check-method-type ((method daemon-direct-method)
                              (message sod-message)
                              (type c-function-type))
   (with-slots ((msgtype %type)) message
-    (unless (c-type-equal-p (c-type-subtype type) (c-type void))
+    (unless (c-type-equal-p (c-type-subtype type) c-type-void)
       (error "Method return type ~A must be `void'" (c-type-subtype type)))
     (unless (argument-lists-compatible-p (c-function-arguments msgtype)
                                         (c-function-arguments type))
@@ -178,8 +178,7 @@ (define-on-demand-slot delegating-direct-method next-method-type (method)
         (return-type (c-type-subtype (sod-message-type message)))
         (msgargs (sod-message-argument-tail message))
         (arguments (if (varargs-message-p message)
-                       (cons (make-argument *sod-master-ap*
-                                            (c-type va-list))
+                       (cons (make-argument *sod-master-ap* c-type-va-list)
                              (butlast msgargs))
                        msgargs)))
     (c-type (fun (lisp return-type)
@@ -197,8 +196,7 @@ (define-on-demand-slot delegating-direct-method function-type (method)
                                           method)))))
                 .
                 (if (varargs-message-p message)
-                    (cons (make-argument *sod-master-ap*
-                                         (c-type va-list))
+                    (cons (make-argument *sod-master-ap* c-type-va-list)
                           method-args)
                     method-args)))))
 
@@ -275,7 +273,7 @@ (defmethod shared-initialize :after
   (declare (ignore slot-names))
   (with-slots (message target) codegen
     (setf target
-         (if (eq (c-type-subtype (sod-message-type message)) (c-type void))
+         (if (eq (c-type-subtype (sod-message-type message)) c-type-void)
              :void
              :return))))
 
@@ -454,7 +452,7 @@ (defmethod compute-method-entry-functions ((method basic-effective-method))
                                               ("me" (* (class tail)))
                                               . raw-entry-args))))
                   (codegen-push codegen)
-                  (ensure-var codegen *sod-ap* (c-type va-list))
+                  (ensure-var codegen *sod-ap* c-type-va-list)
                   (convert-stmts codegen entry-target return-type
                                  (lambda (target)
                                    (emit-inst codegen
index 6a1b6400f57d8c0fa1828b88b53f9e14981fb564..12cefc85ba500e44c21db8b8dbd617f3906b6fcc 100644 (file)
@@ -292,7 +292,7 @@ (defun invoke-method (codegen target arguments-tail direct-method)
        (convert-stmts codegen target
                       (c-type-subtype (sod-method-type direct-method))
                       (lambda (var)
-                        (ensure-var codegen *sod-tmp-ap* (c-type va-list))
+                        (ensure-var codegen *sod-tmp-ap* c-type-va-list)
                         (emit-inst codegen
                                    (make-va-copy-inst *sod-tmp-ap*
                                                       *sod-ap*))
@@ -338,8 +338,7 @@ (defun make-trampoline (codegen super body)
         (return-type (c-type-subtype message-type))
         (raw-args (sod-message-argument-tail message))
         (arguments (if (varargs-message-p message)
-                       (cons (make-argument *sod-ap*
-                                            (c-type va-list))
+                       (cons (make-argument *sod-ap* c-type-va-list)
                              (butlast raw-args))
                        raw-args)))
     (codegen-push codegen)