From: Arnaud Giersch Date: Wed, 30 Mar 2022 20:12:35 +0000 (+0200) Subject: [MBI] Avoid to generate if() with the same then/else branches. X-Git-Tag: v3.32~341 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/7dcb380bcb07f43e4b88a1c7c3676a1a551e3476?ds=sidebyside [MBI] Avoid to generate if() with the same then/else branches. PVS-studio: V523. The 'then' statement is equivalent to the 'else' statement. --- diff --git a/teshsuite/smpi/MBI/CollMatchingGenerator.py b/teshsuite/smpi/MBI/CollMatchingGenerator.py index 206baff677..5d72ca3f88 100755 --- a/teshsuite/smpi/MBI/CollMatchingGenerator.py +++ b/teshsuite/smpi/MBI/CollMatchingGenerator.py @@ -114,6 +114,11 @@ for c1 in gen.coll + gen.icoll + gen.ibarrier: replace['longdesc'] = f'All ranks call {c1} twice' replace['outcome'] = 'OK' replace['errormsg'] = '' + replace['change_cond'] = 'rank < nprocs' + replace['operation1b'] = '' + replace['operation2b'] = '' + replace['fini1b'] = '' + replace['fini2b'] = '' gen.make_file(template, f'CallOrdering_{c1}_{c2}_ok.c', replace) # Generate the correct code using the collective once replace = patterns.copy() @@ -122,9 +127,12 @@ for c1 in gen.coll + gen.icoll + gen.ibarrier: replace['outcome'] = 'OK' replace['errormsg'] = '' replace['init2'] = '' + replace['change_cond'] = 'rank < nprocs' replace['operation2a'] = '' + replace['operation1b'] = '' replace['operation2b'] = '' replace['fini2a'] = '' + replace['fini1b'] = '' replace['fini2b'] = '' replace['free2'] = '' gen.make_file(template, f'CallOrdering_{c1}_ok.c', replace) @@ -135,6 +143,11 @@ for c1 in gen.coll + gen.icoll + gen.ibarrier: replace['longdesc'] = f'All ranks call {c1} and then {c2}' replace['outcome'] = 'OK' replace['errormsg'] = '' + replace['change_cond'] = 'rank < nprocs' + replace['operation1b'] = '' + replace['operation2b'] = '' + replace['fini1b'] = '' + replace['fini2b'] = '' gen.make_file(template, f'CallOrdering_{c1}_{c2}_ok.c', replace) # Generate the incorrect ordering with two different collectives replace = patterns.copy() @@ -175,7 +188,7 @@ for c1 in gen.coll + gen.icoll + gen.ibarrier: replace['longdesc'] = f'All ranks call {c1}' replace['outcome'] = 'OK' replace['errormsg'] = '' - replace['change_cond'] = 'nprocs<256' + replace['change_cond'] = 'rank < nprocs' replace['operation1b'] = '' # Remove functions replace['operation2b'] = '' replace['operation2a'] = ''