diff options
author | Gilles Peskine <Gilles.Peskine@arm.com> | 2022-09-15 19:29:40 +0200 |
---|---|---|
committer | Gilles Peskine <Gilles.Peskine@arm.com> | 2022-09-15 20:33:07 +0200 |
commit | 945b23c46f5e462e476490e1bf24494c5495729b (patch) | |
tree | fdab9ba143e9827867ed93694b97c74413a7e8ad /tests/suites/helpers.function | |
parent | 208257b39f4128d75b4842e2ca963c6733b783a5 (diff) | |
download | mbedtls-945b23c46f5e462e476490e1bf24494c5495729b.zip mbedtls-945b23c46f5e462e476490e1bf24494c5495729b.tar.gz mbedtls-945b23c46f5e462e476490e1bf24494c5495729b.tar.bz2 |
Include platform.h unconditionally: automatic part
We used to include platform.h only when MBEDTLS_PLATFORM_C was enabled, and
to define ad hoc replacements for mbedtls_xxx functions on a case-by-case
basis when MBEDTLS_PLATFORM_C was disabled. The only reason for this
complication was to allow building individual source modules without copying
platform.h. This is not something we support or recommend anymore, so get
rid of the complication: include platform.h unconditionally.
There should be no change in behavior since just including the header should
not change the behavior of a program.
This commit replaces most occurrences of conditional inclusion of
platform.h, using the following code:
```
perl -i -0777 -pe 's!#if.*\n#include "mbedtls/platform.h"\n(#else.*\n(#define (mbedtls|MBEDTLS)_.*\n|#include <(stdarg|stddef|stdio|stdlib|string|time)\.h>\n)*)?#endif.*!#include "mbedtls/platform.h"!mg' $(git grep -l '#include "mbedtls/platform.h"')
```
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Diffstat (limited to 'tests/suites/helpers.function')
-rw-r--r-- | tests/suites/helpers.function | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/tests/suites/helpers.function b/tests/suites/helpers.function index a620178..0af4ca9 100644 --- a/tests/suites/helpers.function +++ b/tests/suites/helpers.function @@ -12,20 +12,7 @@ #if defined (MBEDTLS_ERROR_C) #include "mbedtls/error.h" #endif -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include <stdio.h> -#define mbedtls_fprintf fprintf -#define mbedtls_snprintf snprintf -#define mbedtls_calloc calloc -#define mbedtls_free free -#define mbedtls_exit exit -#define mbedtls_time time -#define mbedtls_time_t time_t -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) #include "mbedtls/memory_buffer_alloc.h" |