mirror of
https://gitlab.com/scemama/irpf90.git
synced 2024-12-22 04:13:33 +01:00
Fixed assert
This commit is contained in:
parent
cd4be303cc
commit
eec23e88c0
@ -28,7 +28,6 @@
|
|||||||
import util
|
import util
|
||||||
from command_line import command_line
|
from command_line import command_line
|
||||||
|
|
||||||
do_assert = command_line.do_assert
|
|
||||||
do_debug = command_line.do_debug
|
do_debug = command_line.do_debug
|
||||||
do_openmp = command_line.do_openmp
|
do_openmp = command_line.do_openmp
|
||||||
do_memory = command_line.do_memory
|
do_memory = command_line.do_memory
|
||||||
@ -159,7 +158,7 @@ end subroutine
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# $1
|
# $1
|
||||||
if do_assert or do_debug:
|
if do_debug:
|
||||||
s = """
|
s = """
|
||||||
if (.not.alloc) then
|
if (.not.alloc) then
|
||||||
"""
|
"""
|
||||||
@ -223,7 +222,7 @@ end subroutine
|
|||||||
txt = txt.replace("$3","")
|
txt = txt.replace("$3","")
|
||||||
|
|
||||||
# $4
|
# $4
|
||||||
if do_debug or do_assert:
|
if do_debug:
|
||||||
txt = txt.replace("$4","""
|
txt = txt.replace("$4","""
|
||||||
stack_index(ithread) = max(0,stack_index(ithread)-1)""")
|
stack_index(ithread) = max(0,stack_index(ithread)-1)""")
|
||||||
else:
|
else:
|
||||||
|
@ -360,7 +360,7 @@ def run():
|
|||||||
|
|
||||||
l_common_s = []
|
l_common_s = []
|
||||||
|
|
||||||
if command_line.do_assert:
|
if command_line.do_debug:
|
||||||
l_common_o += [ "irp_stack.irp.o" ]
|
l_common_o += [ "irp_stack.irp.o" ]
|
||||||
l_common_s += [ "irp_stack.irp.F90" ]
|
l_common_s += [ "irp_stack.irp.F90" ]
|
||||||
|
|
||||||
|
@ -511,7 +511,7 @@ def irp_simple_statements(text):
|
|||||||
|
|
||||||
def process_return(line):
|
def process_return(line):
|
||||||
assert type(line) == Return
|
assert type(line) == Return
|
||||||
if command_line.do_assert or command_line.do_debug:
|
if command_line.do_debug:
|
||||||
newline = Simple_line(line.i," call irp_leave(irp_here)",line.filename)
|
newline = Simple_line(line.i," call irp_leave(irp_here)",line.filename)
|
||||||
result = [newline, line]
|
result = [newline, line]
|
||||||
else:
|
else:
|
||||||
@ -551,7 +551,6 @@ def irp_simple_statements(text):
|
|||||||
Empty_line(i, "!", f),
|
Empty_line(i, "!", f),
|
||||||
Empty_line(i, "! >>> %s"%(txt,), f),
|
Empty_line(i, "! >>> %s"%(txt,), f),
|
||||||
If (i, " if (.not.%s) then"%(condition,), f),
|
If (i, " if (.not.%s) then"%(condition,), f),
|
||||||
Simple_line(i, " call irp_trace", f),
|
|
||||||
Simple_line(i, " print *, irp_here//': Assert failed:'", f),
|
Simple_line(i, " print *, irp_here//': Assert failed:'", f),
|
||||||
Simple_line(i, " print *, ' file: %s, line: %d'"%(f,i), f),
|
Simple_line(i, " print *, ' file: %s, line: %d'"%(f,i), f),
|
||||||
Simple_line(i, " print *, '%s'"%(condition_str,), f),
|
Simple_line(i, " print *, '%s'"%(condition_str,), f),
|
||||||
@ -568,7 +567,7 @@ def irp_simple_statements(text):
|
|||||||
def process_end(line):
|
def process_end(line):
|
||||||
'''Set irp_here variable in provider block'''
|
'''Set irp_here variable in provider block'''
|
||||||
line.text = "end"
|
line.text = "end"
|
||||||
if command_line.do_assert or command_line.do_debug:
|
if command_line.do_debug:
|
||||||
i = line.i
|
i = line.i
|
||||||
f = line.filename
|
f = line.filename
|
||||||
result = [
|
result = [
|
||||||
@ -592,7 +591,7 @@ def irp_simple_statements(text):
|
|||||||
f = line.filename
|
f = line.filename
|
||||||
result = [ Begin_provider(i,line.text, (f,varname)),
|
result = [ Begin_provider(i,line.text, (f,varname)),
|
||||||
Declaration(i," character*(%d) :: irp_here = '%s'"%(length,varname), f) ]
|
Declaration(i," character*(%d) :: irp_here = '%s'"%(length,varname), f) ]
|
||||||
if command_line.do_assert or command_line.do_debug:
|
if command_line.do_debug:
|
||||||
result += [
|
result += [
|
||||||
Simple_line(i," call irp_enter(irp_here)", f),
|
Simple_line(i," call irp_enter(irp_here)", f),
|
||||||
]
|
]
|
||||||
@ -618,7 +617,7 @@ def irp_simple_statements(text):
|
|||||||
f = line.filename
|
f = line.filename
|
||||||
result = [ line,
|
result = [ line,
|
||||||
Declaration(i," character*(%d) :: irp_here = '%s'"%(length,subname), f) ]
|
Declaration(i," character*(%d) :: irp_here = '%s'"%(length,subname), f) ]
|
||||||
if command_line.do_assert or command_line.do_debug:
|
if command_line.do_debug:
|
||||||
result += [
|
result += [
|
||||||
Simple_line(i," call irp_enter_f(irp_here)", f),
|
Simple_line(i," call irp_enter_f(irp_here)", f),
|
||||||
]
|
]
|
||||||
@ -632,7 +631,7 @@ def irp_simple_statements(text):
|
|||||||
f = line.filename
|
f = line.filename
|
||||||
result = [ line,
|
result = [ line,
|
||||||
Declaration(i," character*(%d) :: irp_here = '%s'"%(length,subname), f) ]
|
Declaration(i," character*(%d) :: irp_here = '%s'"%(length,subname), f) ]
|
||||||
if command_line.do_assert or command_line.do_debug:
|
if command_line.do_debug:
|
||||||
result += [
|
result += [
|
||||||
Simple_line(i," call irp_enter_f(irp_here)", f),
|
Simple_line(i," call irp_enter_f(irp_here)", f),
|
||||||
]
|
]
|
||||||
|
@ -547,7 +547,7 @@ class Variable(object):
|
|||||||
"!$ integer :: nthreads"]
|
"!$ integer :: nthreads"]
|
||||||
if command_line.do_openmp:
|
if command_line.do_openmp:
|
||||||
result.append(" call irp_lock_%s(.True.)"%(same_as))
|
result.append(" call irp_lock_%s(.True.)"%(same_as))
|
||||||
if command_line.do_assert or command_line.do_debug:
|
if command_line.do_debug:
|
||||||
result.append(" call irp_enter(irp_here)")
|
result.append(" call irp_enter(irp_here)")
|
||||||
result += call_provides(self.to_provide)
|
result += call_provides(self.to_provide)
|
||||||
result += flatten( map(build_alloc,[self.same_as]+self.others) )
|
result += flatten( map(build_alloc,[self.same_as]+self.others) )
|
||||||
@ -555,7 +555,7 @@ class Variable(object):
|
|||||||
" call bld_%s"%(same_as),
|
" call bld_%s"%(same_as),
|
||||||
" %s_is_built = .True."%(same_as), "" ]
|
" %s_is_built = .True."%(same_as), "" ]
|
||||||
result += [ " endif" ]
|
result += [ " endif" ]
|
||||||
if command_line.do_assert or command_line.do_debug:
|
if command_line.do_debug:
|
||||||
result.append(" call irp_leave(irp_here)")
|
result.append(" call irp_leave(irp_here)")
|
||||||
if command_line.do_openmp:
|
if command_line.do_openmp:
|
||||||
result.append(" call irp_lock_%s(.False.)"%(same_as))
|
result.append(" call irp_lock_%s(.False.)"%(same_as))
|
||||||
|
Loading…
Reference in New Issue
Block a user