10
0
mirror of https://gitlab.com/scemama/irpf90.git synced 2024-12-22 20:33:39 +01:00

Removed stack trace from assert

This commit is contained in:
Anthony Scemama 2017-05-16 13:00:18 +02:00
parent 30bb28894b
commit ab943ea7ad
4 changed files with 13 additions and 11 deletions

View File

@ -476,7 +476,7 @@ def run(d_module, ninja):
l_irp_sup_o = ["irp_touches.irp.o"] l_irp_sup_o = ["irp_touches.irp.o"]
l_irp_sup_s = ["irp_touches.irp.F90"] l_irp_sup_s = ["irp_touches.irp.F90"]
if command_line.do_assert: if command_line.do_debug:
l_irp_sup_o += ["irp_stack.irp.o"] l_irp_sup_o += ["irp_stack.irp.o"]
l_irp_sup_s += ["irp_stack.irp.F90"] l_irp_sup_s += ["irp_stack.irp.F90"]

View File

@ -600,7 +600,7 @@ class Entity(object):
] ]
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 += build_call_provide(self.to_provide, self.d_entity) result += build_call_provide(self.to_provide, self.d_entity)
result += flatten(map(build_alloc, [self.same_as] + self.others_entity_name)) result += flatten(map(build_alloc, [self.same_as] + self.others_entity_name))
@ -609,7 +609,7 @@ class Entity(object):
" %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))

View File

@ -159,7 +159,7 @@ end subroutine
""" """
# $1 # $1
if do_assert or do_debug: if do_debug:
s = """ s = """
if (.not.alloc) then if (.not.alloc) then
""" """
@ -168,6 +168,9 @@ end subroutine
!$OMP PARALLEL !$OMP PARALLEL
!$OMP SINGLE !$OMP SINGLE
nthread = omp_get_num_threads() nthread = omp_get_num_threads()
if (nthread>1) then
stop 'irpf90 -debug does not work in multithread'
endif
!$OMP END SINGLE !$OMP END SINGLE
!$OMP END PARALLEL !$OMP END PARALLEL
!$OMP CRITICAL !$OMP CRITICAL
@ -223,7 +226,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:

View File

@ -544,7 +544,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:
@ -585,7 +585,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),
@ -600,7 +599,7 @@ def irp_simple_statements(text):
def process_end(line): def process_end(line):
'''Add irp_leave if necessary''' '''Add irp_leave if necessary'''
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 = [Simple_line(i, " call irp_leave(irp_here)", f), line] result = [Simple_line(i, " call irp_leave(irp_here)", f), line]
@ -624,7 +623,7 @@ def irp_simple_statements(text):
Begin_provider(i, line.text, (f, varname)), 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 += [Simple_line(i, " call irp_enter(irp_here)", f), ] result += [Simple_line(i, " call irp_enter(irp_here)", f), ]
return result return result
@ -646,7 +645,7 @@ def irp_simple_statements(text):
f = line.filename f = line.filename
result = [ line, Declaration(i, " character*(%d) :: irp_here = '%s'" % (length, subname), f)] result = [ line, 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 += [Simple_line(i, " call irp_enter_f(irp_here)", f), ] result += [Simple_line(i, " call irp_enter_f(irp_here)", f), ]
return result return result
@ -659,7 +658,7 @@ def irp_simple_statements(text):
result = [ result = [
line, Declaration(i, " character*(%d) :: irp_here = '%s'" % (length, subname), f) line, 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 += [Simple_line(i, " call irp_enter_f(irp_here)", f), ] result += [Simple_line(i, " call irp_enter_f(irp_here)", f), ]
return result return result