Merge pull request #6876 from davidhorstmann-arm/disable-code-style-for-bn-asm
Check for Uncrustify errors in `code_style.py`
This commit is contained in:
commit
f07ddde980
2 changed files with 20 additions and 8 deletions
|
@ -80,13 +80,12 @@
|
||||||
|
|
||||||
#endif /* bits in mbedtls_mpi_uint */
|
#endif /* bits in mbedtls_mpi_uint */
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
#if defined(MBEDTLS_HAVE_ASM)
|
#if defined(MBEDTLS_HAVE_ASM)
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
|
||||||
#ifndef asm
|
#ifndef asm
|
||||||
#define asm __asm
|
#define asm __asm
|
||||||
#endif
|
#endif
|
||||||
/* *INDENT-ON* */
|
|
||||||
|
|
||||||
/* armcc5 --gnu defines __GNUC__ but doesn't support GNU's extended asm */
|
/* armcc5 --gnu defines __GNUC__ but doesn't support GNU's extended asm */
|
||||||
#if defined(__GNUC__) && \
|
#if defined(__GNUC__) && \
|
||||||
|
@ -1073,4 +1072,5 @@
|
||||||
#define MULADDC_X8_CORE MULADDC_X4_CORE MULADDC_X4_CORE
|
#define MULADDC_X8_CORE MULADDC_X4_CORE MULADDC_X4_CORE
|
||||||
#endif /* MULADDC_X8_CORE */
|
#endif /* MULADDC_X8_CORE */
|
||||||
|
|
||||||
|
/* *INDENT-ON* */
|
||||||
#endif /* bn_mul.h */
|
#endif /* bn_mul.h */
|
||||||
|
|
|
@ -106,8 +106,12 @@ def check_style_is_correct(src_file_list: List[str]) -> bool:
|
||||||
style_correct = True
|
style_correct = True
|
||||||
for src_file in src_file_list:
|
for src_file in src_file_list:
|
||||||
uncrustify_cmd = [UNCRUSTIFY_EXE] + UNCRUSTIFY_ARGS + [src_file]
|
uncrustify_cmd = [UNCRUSTIFY_EXE] + UNCRUSTIFY_ARGS + [src_file]
|
||||||
subprocess.run(uncrustify_cmd, stdout=subprocess.PIPE, \
|
result = subprocess.run(uncrustify_cmd, stdout=subprocess.PIPE, \
|
||||||
stderr=subprocess.PIPE, check=False)
|
stderr=subprocess.PIPE, check=False)
|
||||||
|
if result.returncode != 0:
|
||||||
|
print_err("Uncrustify returned " + str(result.returncode) + \
|
||||||
|
" correcting file " + src_file)
|
||||||
|
return False
|
||||||
|
|
||||||
# Uncrustify makes changes to the code and places the result in a new
|
# Uncrustify makes changes to the code and places the result in a new
|
||||||
# file with the extension ".uncrustify". To get the changes (if any)
|
# file with the extension ".uncrustify". To get the changes (if any)
|
||||||
|
@ -128,22 +132,30 @@ def check_style_is_correct(src_file_list: List[str]) -> bool:
|
||||||
|
|
||||||
return style_correct
|
return style_correct
|
||||||
|
|
||||||
def fix_style_single_pass(src_file_list: List[str]) -> None:
|
def fix_style_single_pass(src_file_list: List[str]) -> bool:
|
||||||
"""
|
"""
|
||||||
Run Uncrustify once over the source files.
|
Run Uncrustify once over the source files.
|
||||||
"""
|
"""
|
||||||
code_change_args = UNCRUSTIFY_ARGS + ["--no-backup"]
|
code_change_args = UNCRUSTIFY_ARGS + ["--no-backup"]
|
||||||
for src_file in src_file_list:
|
for src_file in src_file_list:
|
||||||
uncrustify_cmd = [UNCRUSTIFY_EXE] + code_change_args + [src_file]
|
uncrustify_cmd = [UNCRUSTIFY_EXE] + code_change_args + [src_file]
|
||||||
subprocess.run(uncrustify_cmd, check=False, stdout=STDOUT_UTF8, \
|
result = subprocess.run(uncrustify_cmd, check=False, \
|
||||||
stderr=STDERR_UTF8)
|
stdout=STDOUT_UTF8, stderr=STDERR_UTF8)
|
||||||
|
if result.returncode != 0:
|
||||||
|
print_err("Uncrustify with file returned: " + \
|
||||||
|
str(result.returncode) + " correcting file " + \
|
||||||
|
src_file)
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def fix_style(src_file_list: List[str]) -> int:
|
def fix_style(src_file_list: List[str]) -> int:
|
||||||
"""
|
"""
|
||||||
Fix the code style. This takes 2 passes of Uncrustify.
|
Fix the code style. This takes 2 passes of Uncrustify.
|
||||||
"""
|
"""
|
||||||
fix_style_single_pass(src_file_list)
|
if not fix_style_single_pass(src_file_list):
|
||||||
fix_style_single_pass(src_file_list)
|
return 1
|
||||||
|
if not fix_style_single_pass(src_file_list):
|
||||||
|
return 1
|
||||||
|
|
||||||
# Guard against future changes that cause the codebase to require
|
# Guard against future changes that cause the codebase to require
|
||||||
# more passes.
|
# more passes.
|
||||||
|
|
Loading…
Reference in a new issue