Generate static test functions & wrappers to fix missing-prototype errors in mbedtls/tests/suites

Required for: https://github.com/Mbed-TLS/mbedtls/pull/9189

Signed-off-by: Michael Schuster <michael@schuster.ms>
This commit is contained in:
Michael Schuster
2024-06-05 20:55:58 +02:00
parent 331565b041
commit 17bedf7059
+4 -1
View File
@@ -328,7 +328,7 @@ def gen_function_wrapper(name, local_vars, args_dispatch):
"""
# Then create the wrapper
wrapper = '''
void {name}_wrapper( void ** params )
static void {name}_wrapper( void ** params )
{{
{unused_params}{locals}
{name}( {args} );
@@ -651,6 +651,9 @@ def parse_function_code(funcs_f, dependencies, suite_dependencies):
raise GeneratorInputError("file: %s - Test functions not found!" %
funcs_f.name)
# Make the test function static
code = code.replace('void', 'static void', 1)
# Prefix test function name with 'test_'
code = code.replace(name, 'test_' + name, 1)
name = 'test_' + name