chiark / gitweb /
src/: Write `NULL' for a null pointer, rather than plain `0'.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 10 Jan 2016 13:51:04 +0000 (13:51 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 29 May 2016 13:40:41 +0000 (14:40 +0100)
This isn't my usual style, but others may like it more.  The output is
controlled by a new variable `*null-pointer*'.  Maybe it will be
configurable later.

doc/SYMBOLS
doc/clang.tex
src/codegen-proto.lisp
src/method-impl.lisp
src/method-proto.lisp

index 5ee51b38b6e18d5f779b8a1ce88f2afc281151a6..bb6b9444fe40f22add0c67685b6fa2d4117edc7d 100644 (file)
@@ -326,6 +326,7 @@ codegen-impl.lisp
   temporary-variable                            class
 
 codegen-proto.lisp
+  *null-pointer*                                variable
   *sod-ap*                                      variable
   *sod-master-ap*                               variable
   block-inst                                    class
index f5b16a87ca7fc4d33b905eb82880c5b0f925eb01..9da2f365fb30edd97ea9d44831d527bd212e0e33 100644 (file)
@@ -859,7 +859,8 @@ Temporary names are represented by objects which implement a simple protocol.
   \begin{tabular}[C]{*2{>{\codeface}l}}                            \hlx*{hv}
     \thd{\textbf{Variable}} & \thd{\textbf{Name format}}        \\ \hlx{vhv}
     {}*sod-ap*                  & sod__ap                       \\
-    {}*sod-master-ap*           & sod__master_ap                \\ \hlx*{vh}
+    {}*sod-master-ap*           & sod__master_ap                \\
+    {}*null-pointer*            & NULL                          \\ \hlx*{vh}
   \end{tabular}
   \caption{Well-known temporary names}
   \label{tab:codegen.codegen.well-known-temps}
index 4bfaeca68a8c8df18112ae41a52342e5129c5d85..c1156716fefff6c01f1228cd92b903eacab669f4 100644 (file)
@@ -67,6 +67,9 @@ (defparameter *sod-tmp-ap*
 (defparameter *sod-tmp-val*
   (make-instance 'temporary-name :tag "sod__t"))
 
+(export '*null-pointer*)
+(defparameter *null-pointer* "NULL")
+
 ;;;--------------------------------------------------------------------------
 ;;; Instructions.
 
index 8501a021bd9edc579f6f6108a712fdbb0e2340dd..e4aaae36d8df7ce300cb29b253051ef9d784f19d 100644 (file)
@@ -337,7 +337,7 @@ (defmethod method-entry-function-name
                (sod-class-nickname message-class)
                (sod-message-name message)
                (sod-class-nickname chain-head))
-       0)))
+       *null-pointer*)))
 
 (defmethod method-entry-slot-name ((entry method-entry))
   (let* ((method (method-entry-effective-method entry))
index 069f7e4d5fb7681776518ac64c2a04fe1c1adaef..36237d63897bae5fd6f19fd65d4c470c0f766540 100644 (file)
@@ -407,7 +407,7 @@ (defun invoke-delegation-chain (codegen target basic-tail chain kernel)
                   (make-trampoline codegen (sod-method-class method)
                                    (lambda (target)
                                      (invoke chain target)))
-                  0))
+                  *null-pointer*))
             (invoke (chain target)
               (if (null chain)
                   (funcall kernel target)