about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-03-12 16:44:27 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-03-12 16:44:51 -0700
commit6d33acfc4d1611d9086d08ecc2a193cb8b906255 (patch)
treee0eacd41e9b449130b5093a5ecd3585cff237a77
parentca4ca1a27afb2fc89b60c19c60b47302a625b422 (diff)
downloadmu-6d33acfc4d1611d9086d08ecc2a193cb8b906255.tar.gz
892 - warning for bugs like 887
-rw-r--r--mu.arc25
1 files changed, 25 insertions, 0 deletions
diff --git a/mu.arc b/mu.arc
index 69906bfa..69b7efe5 100644
--- a/mu.arc
+++ b/mu.arc
@@ -1449,6 +1449,29 @@
       (repeat space.arg
         (zap next-space-generator* name)))))
 
+(proc check-numeric-address (instrs name)
+;?   (prn name) ;? 2
+  (on instr instrs
+;?     (prn instr) ;? 2
+    (when acons.instr  ; not a label
+      (let (oargs op args)  (parse-instr instr)
+        (each arg oargs
+;?           (prn " " arg) ;? 2
+          (when (and acons.arg  ; not dummy _ or raw string
+                     (isa v.arg 'int)
+                     (~is v.arg 0)
+                     (~pos '(raw) metadata.arg)
+                     (~literal? arg))
+            (prn "using a raw integer address @arg in @name (instruction #@index)")))
+        (each arg args
+;?           (prn " " arg) ;? 2
+          (when (and acons.arg  ; not dummy _ or raw string
+                     (isa v.arg 'int)
+                     (~is v.arg 0)
+                     (~pos '(raw) metadata.arg)
+                     (~literal? arg))
+            (prn "using a raw integer address @arg in @name (instruction #@index)")))))))
+
 ;; literate tangling system for reordering code
 
 (def convert-quotes (instrs)
@@ -1598,6 +1621,8 @@
   (each (name body)  canon.function-table
     (check-default-space body name))
   (each (name body)  canon.function-table
+    (check-numeric-address body name))
+  (each (name body)  canon.function-table
     (add-next-space-generator body name))
   ; keep converting names until none remain
   ; (we need to skip unrecognized spaces)