66#
77# Copyright (c) 2017-2020 Kestrel Technology LLC
88# Copyright (c) 2020-2022 Henny Sipma
9- # Copyright (c) 2023-2024 Aarno Labs LLC
9+ # Copyright (c) 2023-2026 Aarno Labs LLC
1010#
1111# Permission is hereby granted, free of charge, to any person obtaining a copy
1212# of this software and associated documentation files (the "Software"), to deal
@@ -237,7 +237,7 @@ def create_file_primary_proofobligations(
237237 print_status (self .targetpath )
238238 result = subprocess .call (
239239 cmd , cwd = self .targetpath , stderr = subprocess .STDOUT )
240- print ("\n Result: " + str (result ))
240+ print_status ("\n Result: " + str (result ))
241241 else :
242242 result = subprocess .call (
243243 cmd ,
@@ -293,7 +293,7 @@ def f(cfile: "CFile") -> None:
293293 self .capp .iter_files (f )
294294
295295 def _generate_and_check_file_cmd_partial (
296- self , cfilepath : Optional [str ], domains : str ) -> List [str ]:
296+ self , cfilepath : Optional [str ], domains : str , iteration : int ) -> List [str ]:
297297 cmd : List [str ] = [
298298 self .canalyzer ,
299299 "-summaries" ,
@@ -309,6 +309,7 @@ def _generate_and_check_file_cmd_partial(
309309 if not (self .contractpath is None ):
310310 cmd .extend (["-contractpath" , self .contractpath ])
311311 cmd .extend (["-projectname" , self .capp .projectname ])
312+ cmd .extend (["-iteration" , str (iteration )])
312313 if self .keep_system_includes :
313314 cmd .append ("-keep_system_includes" )
314315 if self .wordsize > 0 :
@@ -331,27 +332,28 @@ def generate_and_check_file(
331332 self ,
332333 cfilename : str ,
333334 cfilepath : Optional [str ],
334- domains : str ) -> None :
335+ domains : str ,
336+ iteration : int ) -> None :
335337 """Generate invariants and check proof obligations for a single file."""
336338
337339 try :
338- cmd = self ._generate_and_check_file_cmd_partial (cfilepath , domains )
340+ cmd = self ._generate_and_check_file_cmd_partial (cfilepath , domains , iteration )
339341 cmd .append (cfilename )
340342 chklogger .logger .info (
341343 "Calling AI to generate invariants: %s" ,
342344 " " .join (cmd ))
343345 if self .verbose :
344346 result = subprocess .call (
345347 cmd , cwd = self .targetpath , stderr = subprocess .STDOUT )
346- print ("\n Result: " + str (result ))
348+ print_status ("\n Result: " + str (result ))
347349 else :
348350 result = subprocess .call (
349351 cmd ,
350352 cwd = self .targetpath ,
351353 stdout = open (os .devnull , "w" ),
352354 stderr = subprocess .STDOUT ,
353355 )
354- print ("\n Result : " + str (result ))
356+ print_status ("\n Generate-and-check: result : " + str (result ))
355357 if result != 0 :
356358 chklogger .logger .error (
357359 "Error in generating invariants for %s" , cfilename )
@@ -361,14 +363,14 @@ def generate_and_check_file(
361363 print (args )
362364 exit (1 )
363365
364- def generate_and_check_app (self , domains : str , processes : int = 1 ) -> None :
366+ def generate_and_check_app (self , domains : str , iteration : int , processes : int = 1 ) -> None :
365367 """Generate invariants and check proof obligations for application."""
366368
367369 if processes > 1 :
368370
369371 def f (cfile : "CFile" ) -> None :
370372 cmd = self ._generate_and_check_file_cmd_partial (
371- cfile .cfilepath , domains )
373+ cfile .cfilepath , domains , iteration )
372374 cmd .append (cfile .cfilename )
373375 self ._execute_cmd (cmd )
374376
@@ -377,7 +379,7 @@ def f(cfile: "CFile") -> None:
377379
378380 def f (cfile : "CFile" ) -> None :
379381 self .generate_and_check_file (
380- cfile .cfilename , cfile .cfilepath , domains )
382+ cfile .cfilename , cfile .cfilepath , domains , iteration )
381383
382384 self .capp .iter_files (f )
383385 self .capp .iter_files (self .reset_tables )
0 commit comments