From e3d8f31ba1787752eaf8786ec24f776bc1104c80 Mon Sep 17 00:00:00 2001 From: David Horstmann Date: Tue, 3 Jan 2023 11:07:09 +0000 Subject: [PATCH] Workaround Uncrustify parsing of "asm" The following code: #ifndef asm #define asm __asm #endif causes Uncrustify to stop correcting the rest of the file. This may be due to parsing the "asm" keyword in the definition. Work around this by wrapping the idiom in an *INDENT-OFF* comment wherever it appears. Signed-off-by: David Horstmann --- library/aesni.c | 2 ++ library/bn_mul.h | 2 ++ library/padlock.c | 2 ++ library/sha256.c | 2 ++ library/sha512.c | 4 ++++ programs/test/benchmark.c | 2 ++ 6 files changed, 14 insertions(+) diff --git a/library/aesni.c b/library/aesni.c index 87d818af71..12125c98c1 100644 --- a/library/aesni.c +++ b/library/aesni.c @@ -36,9 +36,11 @@ #include +/* *INDENT-OFF* */ #ifndef asm #define asm __asm #endif +/* *INDENT-ON* */ #if defined(MBEDTLS_HAVE_X86_64) diff --git a/library/bn_mul.h b/library/bn_mul.h index 6b8106f9fe..a34a7c7d50 100644 --- a/library/bn_mul.h +++ b/library/bn_mul.h @@ -82,9 +82,11 @@ #if defined(MBEDTLS_HAVE_ASM) +/* *INDENT-OFF* */ #ifndef asm #define asm __asm #endif +/* *INDENT-ON* */ /* armcc5 --gnu defines __GNUC__ but doesn't support GNU's extended asm */ #if defined(__GNUC__) && \ diff --git a/library/padlock.c b/library/padlock.c index a1287759e6..81bea1f8c7 100644 --- a/library/padlock.c +++ b/library/padlock.c @@ -31,9 +31,11 @@ #include +/* *INDENT-OFF* */ #ifndef asm #define asm __asm #endif +/* *INDENT-ON* */ #if defined(MBEDTLS_HAVE_X86) diff --git a/library/sha256.c b/library/sha256.c index 6965820a2a..6e6a58f880 100644 --- a/library/sha256.c +++ b/library/sha256.c @@ -89,9 +89,11 @@ static int mbedtls_a64_crypto_sha256_determine_support( void ) #include #include +/* *INDENT-OFF* */ #ifndef asm #define asm __asm__ #endif +/* *INDENT-ON* */ static jmp_buf return_from_sigill; diff --git a/library/sha512.c b/library/sha512.c index 5de151d602..46e3dabb1e 100644 --- a/library/sha512.c +++ b/library/sha512.c @@ -104,9 +104,11 @@ static int mbedtls_a64_crypto_sha512_determine_support( void ) #include #include +/* *INDENT-OFF* */ #ifndef asm #define asm __asm__ #endif +/* *INDENT-ON* */ static jmp_buf return_from_sigill; @@ -297,9 +299,11 @@ static const uint64_t K[80] = # define mbedtls_internal_sha512_process_a64_crypto mbedtls_internal_sha512_process #endif +/* *INDENT-OFF* */ #ifndef asm #define asm __asm__ #endif +/* *INDENT-ON* */ /* Accelerated SHA-512 implementation originally written by Simon Tatham for PuTTY, * under the MIT licence; dual-licensed as Apache 2 with his kind permission. diff --git a/programs/test/benchmark.c b/programs/test/benchmark.c index 1ad2034d4a..8fb0fef56f 100644 --- a/programs/test/benchmark.c +++ b/programs/test/benchmark.c @@ -61,9 +61,11 @@ int main( void ) #include "mbedtls/error.h" +/* *INDENT-OFF* */ #ifndef asm #define asm __asm #endif +/* *INDENT-ON* */ #if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32)