From 638dceb7e13b83ec4ccc17b985abcb76f13d62fb Mon Sep 17 00:00:00 2001 From: Simon Butcher Date: Wed, 3 Oct 2018 16:17:41 +0100 Subject: [PATCH] Change file scoping of test helpers.function Dependent on configured options, not all of the helper functions were being used, which was leading to warning of unused functions with Clang. To avoid any complex compile time options, or adding more logic to generate_test_code.py to screen out unused functions, those functions which were provoking the warning were changed to remove static, remove them from file scope, and expose them to the linker. --- tests/suites/helpers.function | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/tests/suites/helpers.function b/tests/suites/helpers.function index eef41c79a..10125c34a 100644 --- a/tests/suites/helpers.function +++ b/tests/suites/helpers.function @@ -128,6 +128,14 @@ test_info; /*----------------------------------------------------------------------------*/ /* Helper Functions */ +void test_fail( const char *test, int line_no, const char* filename ) +{ + test_info.failed = 1; + test_info.test = test; + test_info.line_no = line_no; + test_info.filename = filename; +} + #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) static int redirect_output( FILE** out_stream, const char* path ) { @@ -170,7 +178,7 @@ static void close_output( FILE* out_stream ) } #endif /* __unix__ || __APPLE__ __MACH__ */ -static int unhexify( unsigned char *obuf, const char *ibuf ) +int unhexify( unsigned char *obuf, const char *ibuf ) { unsigned char c, c2; int len = strlen( ibuf ) / 2; @@ -204,7 +212,7 @@ static int unhexify( unsigned char *obuf, const char *ibuf ) return len; } -static void hexify( unsigned char *obuf, const unsigned char *ibuf, int len ) +void hexify( unsigned char *obuf, const unsigned char *ibuf, int len ) { unsigned char l, h; @@ -258,7 +266,7 @@ static unsigned char *zero_alloc( size_t len ) * * For convenience, dies if allocation fails. */ -static unsigned char *unhexify_alloc( const char *ibuf, size_t *olen ) +unsigned char *unhexify_alloc( const char *ibuf, size_t *olen ) { unsigned char *obuf; @@ -309,7 +317,7 @@ static int rnd_std_rand( void *rng_state, unsigned char *output, size_t len ) * * rng_state shall be NULL. */ -static int rnd_zero_rand( void *rng_state, unsigned char *output, size_t len ) +int rnd_zero_rand( void *rng_state, unsigned char *output, size_t len ) { if( rng_state != NULL ) rng_state = NULL; @@ -336,7 +344,7 @@ typedef struct * * After the buffer is empty it will return rand(); */ -static int rnd_buffer_rand( void *rng_state, unsigned char *output, size_t len ) +int rnd_buffer_rand( void *rng_state, unsigned char *output, size_t len ) { rnd_buf_info *info = (rnd_buf_info *) rng_state; size_t use_len; @@ -382,7 +390,7 @@ typedef struct * * rng_state shall be a pointer to a rnd_pseudo_info structure. */ -static int rnd_pseudo_rand( void *rng_state, unsigned char *output, size_t len ) +int rnd_pseudo_rand( void *rng_state, unsigned char *output, size_t len ) { rnd_pseudo_info *info = (rnd_pseudo_info *) rng_state; uint32_t i, *k, sum, delta=0x9E3779B9;