From ca80fb4e416718e3c19f12b60c63cc91e907f489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Sch=C3=BCtt?= Date: Tue, 20 Oct 2020 09:46:39 +0200 Subject: [PATCH] Make analyze_gfortran_warnings.py work with C and UTF8 locales --- tools/conventions/analyze_gfortran_warnings.py | 12 ++++++------ tools/conventions/conventions.supp | 15 ++------------- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/tools/conventions/analyze_gfortran_warnings.py b/tools/conventions/analyze_gfortran_warnings.py index 1deeb7626c..b65df59052 100755 --- a/tools/conventions/analyze_gfortran_warnings.py +++ b/tools/conventions/analyze_gfortran_warnings.py @@ -29,7 +29,6 @@ lapack_re = re.compile( ) warning_re = re.compile(r".*[Ww]arning: (.*)") -warning_re_subst = re.compile(r"‘\d+’") # replace occurrences of '49' with * IGNORED_WARNINGS = ( "-Wrealloc-lhs", @@ -42,7 +41,7 @@ IGNORED_WARNINGS = ( "defined but not used", "Removing call to function", "Conversion from", - "Non-significant digits in ‘REAL(8)’", + "Non-significant digits in 'REAL(8)'", "POINTER-valued function appears on right-hand side", "style of line directive is a GCC extension", ) @@ -82,15 +81,16 @@ def check_warnings(fhandle): continue # we are only looking for warnings warning = m.group(1) - warning = warning_re_subst.sub("*", warning) + warning = re.sub(r"[‘’]", "'", warning) # replace unicode apostrophes + warning = re.sub(r"'\d+'", "*", warning) # replace numbers with * if any(iw in warning for iw in IGNORED_WARNINGS): continue if "Unused" in warning: - if "‘error’" in warning: + if "'error'" in warning: continue - if "‘routinep’" in warning: + if "'routinep'" in warning: continue if loc_short == "cp_common_uses.f90": continue @@ -102,7 +102,7 @@ def check_warnings(fhandle): if "called with an implicit interface" in warning: parts = warning.split() assert parts[0] == "Procedure" - routine = parts[1].strip("‘’").upper() + routine = parts[1].strip("'").upper() if may_call_implicit(loc, routine): continue print( diff --git a/tools/conventions/conventions.supp b/tools/conventions/conventions.supp index b4bdc49219..3a7641fe6c 100644 --- a/tools/conventions/conventions.supp +++ b/tools/conventions/conventions.supp @@ -109,8 +109,8 @@ eip_silicon.F: Found WRITE statement with hardcoded unit in "eip_bazant_silicon" eip_silicon.F: Found WRITE statement with hardcoded unit in "eip_lenosky_silicon" eip_silicon.F: Found WRITE statement with hardcoded unit in "subfeniat_b" eip_silicon.F: Found WRITE statement with hardcoded unit in "subfeniat_l" -eri_mme_lattice_summation.F: ‘__var_14_matmul.dim[0].lbound’ is used uninitialized in this function [-Wuninitialized] -eri_mme_lattice_summation.F: ‘__var_14_matmul.dim[0].ubound’ is used uninitialized in this function [-Wuninitialized] +eri_mme_lattice_summation.F: '__var_14_matmul.dim[0].lbound' is used uninitialized in this function [-Wuninitialized] +eri_mme_lattice_summation.F: '__var_14_matmul.dim[0].ubound' is used uninitialized in this function [-Wuninitialized] et_coupling_proj.F: Routine INFOG2L called with an implicit interface. extended_system_init.F: Found WRITE statement with hardcoded unit in "init_barostat_variables" farming_methods.F: Found CLOSE statement in procedure "farming_parse_input" @@ -130,17 +130,6 @@ graph_methods.F: Found WRITE statement with hardcoded unit in "fes_path" graph_utils.F: Found WRITE statement with hardcoded unit in "get_val_res" graphcon.F: Found GOTO statement in procedure "all_permutations" graphcon.F: Found WRITE statement with hardcoded unit in "reorder_graph" -grid_integrate.F: Routine INTEGRATE_CORE_0 called with an implicit interface. -grid_integrate.F: Routine INTEGRATE_CORE_1 called with an implicit interface. -grid_integrate.F: Routine INTEGRATE_CORE_2 called with an implicit interface. -grid_integrate.F: Routine INTEGRATE_CORE_3 called with an implicit interface. -grid_integrate.F: Routine INTEGRATE_CORE_4 called with an implicit interface. -grid_integrate.F: Routine INTEGRATE_CORE_5 called with an implicit interface. -grid_integrate.F: Routine INTEGRATE_CORE_6 called with an implicit interface. -grid_integrate.F: Routine INTEGRATE_CORE_7 called with an implicit interface. -grid_integrate.F: Routine INTEGRATE_CORE_8 called with an implicit interface. -grid_integrate.F: Routine INTEGRATE_CORE_9 called with an implicit interface. -grid_integrate.F: Routine INTEGRATE_CORE_DEFAULT called with an implicit interface. hfx_compression_methods.F: Found READ with unchecked STAT in "hfx_decompress_cache" hfx_energy_potential.F: Found WRITE statement with hardcoded unit in "print_integrals" input_enumeration_types.F: Found WRITE statement with hardcoded unit in "enum_i2c"