lib/realtime: free attributes of Clock at finalize_once
[nit.git] / contrib / pep8analysis / src / cfg / cfg_base.nit
index c532215..d42a4b3 100644 (file)
@@ -45,7 +45,7 @@ class CFG
                                        if instr.is_indirect then
                                                #indirect_jump_sites.add(line.address)
                                                has_indirect_jump_sites = true
-                                               manager.notes.add(new Warn(instr.location, "use of indirect jumps, the CFG may be wrong"))
+                                               manager.notes.add(new Warn(instr.location, "jumps to a dynamic address, this may be OK but the CFG may be wrong"))
                                        else
                                                var op = instr.n_operand
                                                var dest = op.n_value.to_i
@@ -85,8 +85,8 @@ class CFG
                end
 
                # sort breakpoints in order
-               starts = starts.uniq.sort_filter.to_a
-               ends = ends.uniq.sort_filter.to_a
+               starts = starts.iterator.uniq.sort.to_a
+               ends = ends.iterator.uniq.sort.to_a
 
                # create basic blocks
                var current_block: nullable BasicBlock = null
@@ -172,7 +172,8 @@ class CFG
                                                b.successors.add(db)
                                                db.predecessors.add(b)
                                        else
-                                               manager.notes.add(new Error(line.location, "invalid line following instruction"))
+                                               manager.notes.add(new P8Error(line.location,
+                                                       "this instruction is not followed by valid code as it should (misplaced data or missing BR?)"))
                                        end
                                end
 
@@ -180,7 +181,8 @@ class CFG
                                        has_function_calls = true
                                        var next_addr = line.address+4
                                        if not addr_to_blocks.has_key(next_addr) then
-                                               print "error, no instruction following call {b.name}"
+                                               manager.notes.add(new P8Error(line.location,
+                                                       "this CALL is not followed by valide code as it should"))
                                        else
                                                b.after_call = addr_to_blocks[next_addr]
                                        end
@@ -304,11 +306,11 @@ class CFG
                end
        end
 
-       var watchdog writable = 0
+       var watchdog = 0 is writable
        fun link_ret_to_calls(b: BasicBlock, to_link_ori: List[BasicBlock], seq: List[BasicBlock], depth: Int): Bool
        do
                watchdog += 1
-               if watchdog == 100000 then
+               if watchdog == 10000 then
                        print "Error: Umanagable cycle detected"
                        return false
                end
@@ -343,7 +345,7 @@ class CFG
 
                                else if instr isa ARetInstruction then
                                                if to_link.is_empty then
-                                                       manager.notes.add( new Error(instr.location,"no CALL can be linked to return") )
+                                                       manager.notes.add( new P8Error(instr.location,"no CALL can be linked to this RET") )
                                                        return false
                                                else
                                                        var caller = to_link.pop
@@ -374,7 +376,7 @@ class CFG
 end
 
 class BasicBlock
-       var name : String
+       var name: String is noinit
        var lines = new Array[ANonEmptyLine]
        var successors = new Array[BasicBlock]
        var predecessors = new Array[BasicBlock]